Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions scripts/prerender.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ const ROUTES = ['/', '404.html'];
function startServer(port) {
return new Promise((resolve) => {
const server = http.createServer((req, res) => {
// Normalize the URL pathname to prevent directory traversal
// Get the URL pathname
let urlPath = new URL(req.url, `http://localhost:${port}`).pathname;
urlPath = path.normalize(urlPath);

// Default to index.html for root or 404.html
if (urlPath === '/' || urlPath === '/404.html') {
urlPath = '/index.html';
}

// Resolve the full file path
let filePath = path.resolve(DIST_DIR, '.' + urlPath);
// Resolve the full file path safely
let filePath = path.join(DIST_DIR, urlPath);
const distDirResolved = path.resolve(DIST_DIR);

// Validate that the resolved path is within DIST_DIR (prevent directory traversal)
Expand Down
14 changes: 7 additions & 7 deletions src/Firebase/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { getAuth } from "firebase/auth";
import { getFirestore } from "firebase/firestore";

const firebaseConfig = {
apiKey: import.meta.env.VITE_FIREBASE_API_KEY,
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN,
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID,
storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET,
messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID,
appId: import.meta.env.VITE_FIREBASE_APP_ID,
measurementId: import.meta.env.VITE_FIREBASE_MEASUREMENT_ID
apiKey: import.meta.env.VITE_FIREBASE_API_KEY || "mock_key",
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN || "mock.firebaseapp.com",
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID || "mock_project",
storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET || "mock.appspot.com",
messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID || "123",
appId: import.meta.env.VITE_FIREBASE_APP_ID || "1:123:web:123",
measurementId: import.meta.env.VITE_FIREBASE_MEASUREMENT_ID || "G-123"
};

const app = initializeApp(firebaseConfig);
Expand Down
4 changes: 1 addition & 3 deletions src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useLayoutEffect, useRef } from "react";
import { Routes, Route, BrowserRouter } from "react-router-dom";
import { Routes, Route } from "react-router-dom";
import { AnimatePresence, motion } from "motion/react";
import { Navbar } from "./components/Navbar";
import { Hero } from "./components/Hero";
Expand Down Expand Up @@ -118,7 +118,6 @@ export default function App() {
transition={{ duration: loading.reducedMotion ? 0.2 : 0.8, ease: REVEAL_EASE }}
aria-hidden={!loading.isReady || undefined}
>
<BrowserRouter>
<AuthProvider>
<Routes>
<Route path="/" element={<LandingPage />} />
Expand All @@ -142,7 +141,6 @@ export default function App() {
<Route path="*" element={<NotFound />} />
</Routes>
</AuthProvider>
</BrowserRouter>
</motion.div>

<AnimatePresence onExitComplete={handleExitComplete}>
Expand Down
Loading