website refactor

This commit is contained in:
2026-01-17 22:55:03 +01:00
parent 64d9e7fd16
commit 69d4cce7f1
64 changed files with 1146 additions and 1014 deletions

View File

@@ -26,12 +26,6 @@ export async function middleware(request: NextRequest) {
cookiePreview: cookieHeader.substring(0, 100) + (cookieHeader.length > 100 ? '...' : '')
});
// Handle /sponsor root redirect (preserves cookies)
if (pathname === '/sponsor') {
logger.info('[MIDDLEWARE] Redirecting /sponsor → /sponsor/dashboard');
return NextResponse.redirect(new URL('/sponsor/dashboard', request.url));
}
// Set x-pathname header for layout-level protection
const response = NextResponse.next();
response.headers.set('x-pathname', pathname);
@@ -101,6 +95,13 @@ export async function middleware(request: NextRequest) {
return redirectResponse;
}
// Handle /sponsor root redirect (preserves cookies)
// Only reached if authenticated and allowed
if (pathname === '/sponsor') {
logger.info('[MIDDLEWARE] Redirecting /sponsor → /sponsor/dashboard');
return NextResponse.redirect(new URL('/sponsor/dashboard', request.url));
}
// All checks passed
logger.info('[MIDDLEWARE] ALLOWING ACCESS', { pathname });
logger.info('[MIDDLEWARE] ========== REQUEST END (ALLOW) ==========');