From 6c11c8ac26eef6b160a79c24d197fdfe5e8edf45 Mon Sep 17 00:00:00 2001 From: Codex Bot Date: Tue, 27 Oct 2026 00:41:31 +0800 Subject: [PATCH] Recognize Next.js data redirects in authentication checks --- apps/waterfall-wiki/scripts/auth-cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/waterfall-wiki/scripts/auth-cli.ts b/apps/waterfall-wiki/scripts/auth-cli.ts index f06cd2f..aa8a769 100644 --- a/apps/waterfall-wiki/scripts/auth-cli.ts +++ b/apps/waterfall-wiki/scripts/auth-cli.ts @@ -47,7 +47,7 @@ async function main() { if (command === 'verify' || command === 'exercise') { const request = (path:string,init:RequestInit={}) => fetch(base+path,{...init,redirect:'manual'}); for (const path of ['/','/library/import','/skills/shadow-puppet/egret-example.png','/studio','/_next/data/auth-test/index.json']) { - const response = await request(path); assert.equal(response.status,307,path); assert.match(response.headers.get('location') || '',/\/login\?/); + const response = await request(path); assert.equal(response.status,307,path); assert.match(response.headers.get('location') || response.headers.get('x-nextjs-redirect') || '',/\/login\?/,path+' must redirect to login'); } for (const path of ['/api/feed','/api/upload','/studio/api/export/test','/api/media/missing']) assert.equal((await request(path)).status,401,path); assert.equal((await request('/api/posts',{method:'POST',body:'{}'})).status,401);