import { NextResponse, type NextRequest } from "next/server"; import { updateSession } from "@/lib/supabase/middleware"; export async function middleware(request: NextRequest) { // Interne Endpunkte mit eigener Authentifizierung (Shared Secret) umgehen // das Supabase-Session-Gating -- der pg_cron-Aufruf an diese Route traegt // kein Session-Cookie. if (request.nextUrl.pathname === "/api/notifications/dispatch") { return NextResponse.next(); } return await updateSession(request); } // Ausgeschlossen: Manifest (ohne Session Standard-Branding), Service Worker und // Offline-Seite -- muessen ohne Login-Redirect ladbar sein. export const config = { matcher: ["/((?!_next/static|_next/image|favicon.ico|manifest\\.webmanifest|sw\\.js|offline\\.html|.*\\.(?:svg|png|jpg|jpeg|gif|webp|wasm)$).*)"], };