feat: 更新 OAuth 回调地址验证,支持 127.0.0.1 和 localhost

This commit is contained in:
QLHazyCoder
2026-04-11 16:44:09 +08:00
parent b3de099a2c
commit 1f91f6fcee
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ function isLocalhostOAuthCallbackUrl(rawUrl) {
const parsed = parseUrlSafely(rawUrl);
if (!parsed) return false;
if (!['http:', 'https:'].includes(parsed.protocol)) return false;
if (parsed.hostname !== 'localhost') return false;
if (!['localhost', '127.0.0.1'].includes(parsed.hostname)) return false;
if (parsed.pathname !== '/auth/callback') return false;
const code = (parsed.searchParams.get('code') || '').trim();