优化无法登录的错误

This commit is contained in:
CN-JS-HuiBai
2026-04-10 23:53:25 +08:00
parent 3519003a77
commit 4467b62a01
2 changed files with 51 additions and 7 deletions

View File

@@ -31,8 +31,19 @@ function normalizeGeo(geo) {
}
async function getLocation(target) {
// Normalize target (strip port if present)
const cleanTarget = target.split(':')[0];
// Normalize target (strip port if present, handle IPv6 brackets)
let cleanTarget = target;
if (cleanTarget.startsWith('[')) {
const closingBracket = cleanTarget.indexOf(']');
if (closingBracket !== -1) {
cleanTarget = cleanTarget.substring(1, closingBracket);
}
} else {
const parts = cleanTarget.split(':');
if (parts.length === 2) {
cleanTarget = parts[0];
}
}
// 1. Check if we already have this IP/Domain in DB (FASTEST)
try {