From ed97ec4a4ab9ecce069ad56b7c8ac88c30cb5bbb Mon Sep 17 00:00:00 2001 From: QLHazyCoder <2825305047@qq.com> Date: Thu, 9 Apr 2026 01:50:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=9C=A8=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=B5=81=E7=A8=8B=E4=B8=AD=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=A6=96=E6=AC=A1=E8=AF=B7=E6=B1=82=E6=96=B0=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E7=9A=84=E9=80=89=E9=A1=B9=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=82=AE=E7=AE=B1=E8=BD=AE=E8=AF=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- background.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index c9604ba..289757c 100644 --- a/background.js +++ b/background.js @@ -1759,8 +1759,18 @@ async function resolveVerificationStep(step, state, mail, options = {}) { } let nextFilterAfterTimestamp = options.filterAfterTimestamp ?? null; + const requestFreshCodeFirst = Boolean(options.requestFreshCodeFirst); const maxSubmitAttempts = 3; + if (requestFreshCodeFirst) { + try { + nextFilterAfterTimestamp = await requestVerificationCodeResend(step); + await addLog(`步骤 ${step}:已先请求一封新的${getVerificationCodeLabel(step)}验证码,再开始轮询邮箱。`, 'warn'); + } catch (err) { + await addLog(`步骤 ${step}:首次重新获取验证码失败:${err.message},将继续使用当前时间窗口轮询。`, 'warn'); + } + } + for (let attempt = 1; attempt <= maxSubmitAttempts; attempt++) { const result = await pollFreshVerificationCode(step, state, mail, { excludeCodes: [...rejectedCodes], @@ -1851,7 +1861,10 @@ async function executeStep4(state) { }); } - await resolveVerificationStep(4, state, mail, { filterAfterTimestamp: stepStartedAt }); + await resolveVerificationStep(4, state, mail, { + filterAfterTimestamp: stepStartedAt, + requestFreshCodeFirst: true, + }); return; } @@ -1966,7 +1979,10 @@ async function executeStep7(state) { }); } - await resolveVerificationStep(7, state, mail, { filterAfterTimestamp: stepStartedAt }); + await resolveVerificationStep(7, state, mail, { + filterAfterTimestamp: stepStartedAt, + requestFreshCodeFirst: true, + }); return; }