fix sms otp retriver

This commit is contained in:
2026-05-31 00:05:21 +08:00
parent 80bf462d2c
commit 557931892f
6 changed files with 168 additions and 74 deletions

View File

@@ -17,8 +17,6 @@ const TOKEN_AUTO_REBIND_KEY = 'token_auto_rebind_enabled';
const TOKEN_AUTO_REBIND_SCAN_MS_KEY = 'token_auto_rebind_scan_ms';
const TOKEN_AUTO_REBIND_COOLDOWN_MS_KEY = 'token_auto_rebind_cooldown_ms';
const TOKEN_AUTO_REBIND_FAIL_COOLDOWN_MS_KEY = 'token_auto_rebind_fail_cooldown_ms';
const TOKEN_AUTO_REBIND_DEBUG_KEY = 'token_auto_rebind_debug';
/** 扫 list 间隔 */
const DEFAULT_TOKEN_AUTO_REBIND_SCAN_MS = 1 * 60 * 1000;
/** 重绑成功后冷却 */
@@ -27,7 +25,6 @@ const DEFAULT_TOKEN_AUTO_REBIND_COOLDOWN_MS = 1 * 60 * 1000;
const DEFAULT_TOKEN_AUTO_REBIND_FAIL_COOLDOWN_MS = 1 * 60 * 1000;
let _tokenAutoRebindEnabled = false;
let _tokenAutoRebindDebug = false;
let _tokenAutoRebindScanMs = DEFAULT_TOKEN_AUTO_REBIND_SCAN_MS;
let _tokenAutoRebindCooldownMs = DEFAULT_TOKEN_AUTO_REBIND_COOLDOWN_MS;
let _tokenAutoRebindFailCooldownMs = DEFAULT_TOKEN_AUTO_REBIND_FAIL_COOLDOWN_MS;
@@ -57,8 +54,6 @@ export async function loadServerDomain(): Promise<string> {
const n = parseInt(failCooldownMs, 10);
if (Number.isFinite(n) && n > 0) _tokenAutoRebindFailCooldownMs = n;
}
const debug = await AsyncStorage.getItem(TOKEN_AUTO_REBIND_DEBUG_KEY);
_tokenAutoRebindDebug = debug === 'true';
console.log('loadServerDomain', _domain, 'https:', _useHttps);
return _domain;
}
@@ -67,25 +62,14 @@ export function getTokenAutoRebindOptions(): {
scanIntervalMs: number;
cooldownMs: number;
failCooldownMs: number;
debugLog: boolean;
} {
return {
scanIntervalMs: _tokenAutoRebindScanMs,
cooldownMs: _tokenAutoRebindCooldownMs,
failCooldownMs: _tokenAutoRebindFailCooldownMs,
debugLog: _tokenAutoRebindDebug,
};
}
export function getTokenAutoRebindDebug(): boolean {
return _tokenAutoRebindDebug;
}
export async function saveTokenAutoRebindDebug(enabled: boolean): Promise<void> {
_tokenAutoRebindDebug = enabled;
await AsyncStorage.setItem(TOKEN_AUTO_REBIND_DEBUG_KEY, String(enabled));
}
export async function saveTokenAutoRebindOptions(
scanIntervalMs: number,
cooldownMs: number,