fixed nav, added sanity and guides pages
CI / test (push) Successful in 5s

This commit is contained in:
2026-03-12 07:10:37 -04:00
parent f8265063d5
commit fb52521495
14 changed files with 13284 additions and 179 deletions
+12 -3
View File
@@ -13,6 +13,7 @@ function isPublicPath(pathname: string) {
// Public pages
if (pathname === "/") return true;
if (pathname === "/login") return true;
if (pathname === "/register") return true;
if (pathname === "/tos") return true;
if (pathname === "/privacy") return true;
if (pathname === "/beta") return true;
@@ -20,12 +21,19 @@ function isPublicPath(pathname: string) {
if (pathname.startsWith("/auth")) return true;
if (pathname.startsWith("/api/auth")) return true;
// Content / guides — always public, no auth required
if (pathname === "/guides") return true;
if (pathname.startsWith("/guides/")) return true;
// Static / framework assets
if (pathname.startsWith("/_next")) return true;
if (pathname === "/favicon.ico") return true;
if (pathname === "/robots.txt") return true;
if (pathname === "/sitemap.xml") return true;
// Static images in /public
if (pathname.startsWith("/battl/")) return true;
// Health / misc APIs you may want public
if (pathname === "/api/health") return true;
@@ -45,11 +53,12 @@ function isProtectedLaunchPath(pathname: string) {
export function middleware(req: NextRequest) {
const { pathname } = req.nextUrl;
// Short-circuit: always let public paths through without any token checks.
if (isPublicPath(pathname)) return NextResponse.next();
const token = req.cookies.get("session_token")?.value;
const isLoggedIn = Boolean(token);
console.log("is logged in: " + isLoggedIn);
console.log("MW:", req.nextUrl.pathname)
// IMPORTANT: Use a server-only env var for middleware behavior.
// Set LAUNCH_ONLY_ROOT=true in your Docker compose.
const launchOnlyRoot = process.env.LAUNCH_ONLY_ROOT === "true";