fix basic auth

This commit is contained in:
2025-06-28 17:38:57 +08:00
parent 1d41ad6ef1
commit 9647b7d3c9
3 changed files with 72 additions and 1 deletions
+2 -1
View File
@@ -5,7 +5,7 @@ export function withAuth(handler: (req: NextRequest) => Promise<NextResponse>) {
return async (req: NextRequest) => {
const url = new URL(req.url)
// Skip auth for certain paths
// Skip auth for certain paths (same logic as original Express app)
if (
url.pathname.startsWith('/api/') ||
url.pathname.startsWith('/screenshots/') ||
@@ -17,6 +17,7 @@ export function withAuth(handler: (req: NextRequest) => Promise<NextResponse>) {
return handler(req)
}
// For all other paths, require authentication
const authHeader = req.headers.get('authorization')
if (!authHeader) {