fix(oauth): 整合 Step 8/9 回调修复并补充回归测试

- 支持 localhost 和 127.0.0.1 的本地回调识别,同时兼容 /auth/callback 与 /codex/callback
- 修复 Step 8 停止时的监听清理问题,并补充 onCommitted 和 onUpdated 的回调捕获路径
- 修复 Step 9 在本地 CPA 场景下的自动跳过与精确清理逻辑,避免误关正常本地页面
- 补充 Step 8 与 Step 9 的回归测试
This commit is contained in:
QLHazyCoder
2026-04-12 00:57:38 +08:00
parent 1105e9d4d9
commit 3e2457f7c7
8 changed files with 876 additions and 46 deletions
+1 -1
View File
@@ -169,7 +169,7 @@ function isLocalhostOAuthCallbackUrl(rawUrl) {
if (!parsed) return false;
if (!['http:', 'https:'].includes(parsed.protocol)) return false;
if (!['localhost', '127.0.0.1'].includes(parsed.hostname)) return false;
if (parsed.pathname !== '/auth/callback') return false;
if (!['/auth/callback', '/codex/callback'].includes(parsed.pathname)) return false;
const code = (parsed.searchParams.get('code') || '').trim();
const state = (parsed.searchParams.get('state') || '').trim();