diff --git a/src/app/debug/database/page.tsx b/src/app/debug/database/page.tsx index d2a6f7a..c36511b 100644 --- a/src/app/debug/database/page.tsx +++ b/src/app/debug/database/page.tsx @@ -13,6 +13,18 @@ export default function DatabaseDebugPage() { const [loading, setLoading] = useState(true) const [error, setError] = useState(null) const [testResult, setTestResult] = useState(null) + + // Restrict access in production + const isProduction = process.env.NODE_ENV === 'production' + const [redirecting, setRedirecting] = useState(false) + + useEffect(() => { + // In production, redirect to home page + if (isProduction) { + setRedirecting(true) + window.location.href = '/' + } + }, [isProduction]) useEffect(() => { async function fetchData() { @@ -58,6 +70,18 @@ export default function DatabaseDebugPage() { fetchData() }, [session]) + // If redirecting, show a simple loading message + if (isProduction || redirecting) { + return ( +
+
+

Debug mode is disabled in production.

+

Redirecting to home page...

+
+
+ ); + } + return (
diff --git a/src/app/debug/page.tsx b/src/app/debug/page.tsx index 40498c0..89a4371 100644 --- a/src/app/debug/page.tsx +++ b/src/app/debug/page.tsx @@ -13,6 +13,18 @@ export default function DebugPage() { const [jwtTest, setJwtTest] = useState(null); const [authTest, setAuthTest] = useState(null); const [authError, setAuthError] = useState(null); + + // Restrict access in production + const isProduction = process.env.NODE_ENV === 'production'; + const [redirecting, setRedirecting] = useState(false); + + useEffect(() => { + // In production, redirect to home page + if (isProduction) { + setRedirecting(true); + window.location.href = '/'; + } + }, [isProduction]); useEffect(() => { const checkAuth = async () => { @@ -146,6 +158,18 @@ export default function DebugPage() { WINDOW_LOCATION: typeof window !== 'undefined' ? window.location.hostname : null, }; + // If redirecting, show a simple loading message + if (isProduction || redirecting) { + return ( +
+
+

Debug mode is disabled in production.

+

Redirecting to home page...

+
+
+ ); + } + return (