91244a5a2b
Brings the catalog to nine. Each is a single scoped [data-theme="..."] CSS file plus a registry entry — no markup changes. - ps1: charcoal BIOS, gray panels, uppercase letterspacing - ps3: animated XMB sky gradient + drifting wave, black glass - wii: white channels, rounded pills, soft blue glow - nds: silver shell with content framed as the touch screen - dreamcast: cream BIOS, conic-gradient orange swirl, lowercase blue - jv2002: dense boxy portal, Verdana 11px, red masthead, blue nav tabs Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
24 lines
804 B
TypeScript
24 lines
804 B
TypeScript
import { NextResponse, type NextRequest } from "next/server";
|
|
import { ADMIN_COOKIE, verifySessionToken } from "@/lib/session";
|
|
|
|
// Gate every /admin route behind a valid session, except the login page and its
|
|
// POST action. Runs on the Edge runtime, so it relies only on Web Crypto
|
|
// (see lib/session.ts) — no Node APIs.
|
|
export async function proxy(req: NextRequest) {
|
|
const { pathname } = req.nextUrl;
|
|
|
|
if (pathname === "/admin/login") return NextResponse.next();
|
|
|
|
const token = req.cookies.get(ADMIN_COOKIE)?.value;
|
|
if (await verifySessionToken(token)) return NextResponse.next();
|
|
|
|
const url = req.nextUrl.clone();
|
|
url.pathname = "/admin/login";
|
|
url.searchParams.set("next", pathname);
|
|
return NextResponse.redirect(url);
|
|
}
|
|
|
|
export const config = {
|
|
matcher: ["/admin/:path*"],
|
|
};
|