feat: 增加 OAuth 流程6分钟超时处理,优化验证码请求时间窗口逻辑

This commit is contained in:
QLHazyCoder
2026-04-17 19:12:06 +08:00
parent a827ede6f4
commit 4add7477d1
11 changed files with 500 additions and 92 deletions
+13 -1
View File
@@ -7,6 +7,7 @@
completeStepFromBackground,
getErrorMessage,
getLoginAuthStateLabel,
getOAuthFlowStepTimeoutMs,
getState,
isStep6RecoverableResult,
isStep6SuccessResult,
@@ -15,6 +16,7 @@
sendToContentScriptResilient,
shouldSkipLoginVerificationForCpaCallback,
skipLoginVerificationStepsForCpaCallback,
startOAuthFlowTimeoutWindow,
STEP6_MAX_ATTEMPTS,
throwIfStopped,
} = deps;
@@ -38,6 +40,15 @@
const currentState = attempt === 1 ? state : await getState();
const password = currentState.password || currentState.customPassword || '';
const oauthUrl = await refreshOAuthUrlBeforeStep6(currentState);
if (typeof startOAuthFlowTimeoutWindow === 'function') {
await startOAuthFlowTimeoutWindow({ step: 7, oauthUrl });
}
const loginTimeoutMs = typeof getOAuthFlowStepTimeoutMs === 'function'
? await getOAuthFlowStepTimeoutMs(180000, {
step: 7,
actionLabel: 'OAuth 登录并进入验证码页',
})
: 180000;
if (attempt === 1) {
await addLog('步骤 7:正在打开最新 OAuth 链接并登录...');
@@ -59,7 +70,8 @@
},
},
{
timeoutMs: 180000,
timeoutMs: loginTimeoutMs,
responseTimeoutMs: loginTimeoutMs,
retryDelayMs: 700,
logMessage: '步骤 7:认证页正在切换,等待页面重新就绪后继续登录...',
}