diff --git a/admin-ui/src/components/Sidebar.tsx b/admin-ui/src/components/Sidebar.tsx index 2b7e5ef..27ef83d 100644 --- a/admin-ui/src/components/Sidebar.tsx +++ b/admin-ui/src/components/Sidebar.tsx @@ -226,41 +226,21 @@ export function Sidebar({ locale, mobileOpen = false, onClose }: SidebarProps) {
- {!mounted ? ( - - - {t("login")} - - ) : hasStoredKey ? ( - - ) : !hasEnvKey ? ( - - - {t("login")} - - ) : null} +
diff --git a/admin-ui/src/middleware.ts b/admin-ui/src/middleware.ts index f3b4048..f82508e 100644 --- a/admin-ui/src/middleware.ts +++ b/admin-ui/src/middleware.ts @@ -3,15 +3,7 @@ import type { NextRequest } from "next/server"; import { getIronSession } from "iron-session"; import { sessionOptions, type SessionData } from "@/lib/session"; -const PUBLIC_PREFIXES = ["/admin/login", "/admin/api/auth"]; - export async function middleware(request: NextRequest) { - const { pathname } = request.nextUrl; - - if (PUBLIC_PREFIXES.some((p) => pathname.startsWith(p))) { - return NextResponse.next(); - } - const response = NextResponse.next(); const session = await getIronSession(request, response, sessionOptions); @@ -23,6 +15,11 @@ export async function middleware(request: NextRequest) { return response; } +// Next.js prepends basePath (/admin) to these patterns automatically. +// "/" matches /admin, "/((?!login|api/auth|_next|favicon.ico).+)" matches /admin/content/... etc. export const config = { - matcher: ["/admin", "/admin/((?!_next|favicon.ico).*)"], + matcher: [ + "/", + "/((?!login|api/auth|_next|favicon.ico).+)", + ], };