import type { Metadata } from 'next'; import Link from 'next/link'; import { cookies } from 'next/headers'; import { redirect } from 'next/navigation'; import { ADMIN_COOKIE, adminConfigured, cookieValueFor, isAdmin, tokenMatches } from '@/lib/admin/auth'; export const metadata: Metadata = { title: 'Admin', robots: { index: false, follow: false } }; export const dynamic = 'force-dynamic'; const ADMIN_NAV = [ { href: '/admin', label: 'Overview' }, { href: '/admin/connectors', label: 'Connectors' }, { href: '/admin/unresolved', label: 'Unresolved labels' }, { href: '/admin/trace', label: 'Trace' }, { href: '/admin/rankings', label: 'Rankings' }, ]; /** * Admin console (§140-141, §253). Token via `?token=` once → httpOnly cookie (sha256 of the token) * compared to ADMIN_TOKEN. Wrong or missing token renders a login hint instead of the console. */ export default async function AdminLayout({ children }: { children: React.ReactNode }) { if (!adminConfigured()) { return (
Admin
Set ADMIN_TOKEN in the environment to enable the console.
Admin
Append ?token=<ADMIN_TOKEN> to an admin URL once; a session cookie (hash of the token, httpOnly) is then set and the token is removed from the URL.
Admin console · not indexed