diff --git a/README.md b/README.md index 6da734c..43468ac 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ - `接收邮箱`:注册邮箱回退到普通“邮箱生成 / 手动填写”路线,2925 只负责收信 4. `2925 号池` 现在是独立配置行;开启 `号池` 后可从下拉框中选择当前 2925 账号。若当前处于 `提供邮箱` 模式,这个账号也会同步作为别名基邮箱 5. 可先点 `使用此账号` 让当前 2925 账号切到这条记录,再点 `登录` 手动验证网页邮箱登录态 -6. 只有在 `号池` 开关开启时,自动流程执行到 Step 4 / Step 8 前才会自动检查 2925 登录态;如果未登录,会先清理登录 cookie、等待 `3 秒`,再打开登录页,并在页面打开后再等待 `3 秒`,然后使用当前账号自动登录;点击登录后若 `20 秒`内仍未进入收件箱,则会判定当前登录失败 +6. 只有在 `号池` 开关开启时,自动流程执行到 Step 4 / Step 8 前才会自动检查 2925 登录态;如果未登录,会先清理登录 cookie、等待 `3 秒`,再打开登录页,并在页面打开后再等待 `3 秒`,然后使用当前账号自动登录;填写完账号密码后会额外等待 `1 秒` 再点击登录,点击后若 `40 秒`内仍未进入收件箱,则会判定当前登录失败 7. 当 Step 4 / Step 8 轮询邮箱时遇到“子邮箱已达上限邮箱”,扩展会记录当前时间;如果还有下一个可用账号,就禁用当前账号 24 小时并自动切换登录;如果没有下一个可用账号,或当前未启用号池模式,则会直接复用现有“手动暂停 / 停止”逻辑终止自动流程 8. 如果你同时开启了 `Auto` 的自动重试,当前尝试结束后会按现有逻辑自动进入下一次尝试,不需要再手动介入 9. 只有 `Mail = 2925` 且模式为 `提供邮箱` 时,才会继续走 Gmail / 2925 共用的别名邮箱链路;例如 `name@2925.com -> name123456@2925.com` diff --git a/background/mail-2925-session.js b/background/mail-2925-session.js index 7e8f2af..c78a350 100644 --- a/background/mail-2925-session.js +++ b/background/mail-2925-session.js @@ -525,14 +525,14 @@ }, }, { - timeoutMs: forceRelogin ? 30000 : 25000, + timeoutMs: 50000, retryDelayMs: 800, - responseTimeoutMs: forceRelogin ? 30000 : 25000, + responseTimeoutMs: 50000, logMessage: '步骤 0:2925 登录页通信异常,正在等待页面恢复...', } ); } catch (err) { - const message = `2925:${actionLabel}失败(${getErrorMessage(err) || '20 秒内未进入收件箱'})。`; + const message = `2925:${actionLabel}失败(${getErrorMessage(err) || '40 秒内未进入收件箱'})。`; const stopped = await stopAutoRunForMail2925LoginFailure(`${message}已按手动停止逻辑暂停自动流程。`); if (stopped) { throw new Error('流程已被用户停止。'); diff --git a/content/mail-2925.js b/content/mail-2925.js index 1c3a6b0..0bbb977 100644 --- a/content/mail-2925.js +++ b/content/mail-2925.js @@ -935,11 +935,12 @@ async function ensureMail2925Session(payload = {}) { await sleep(150); fillInput(passwordInput, password); await sleep(200); + await sleep(1000); log(`步骤 0:2925 已定位到登录表单,准备点击“登录”,当前地址 ${location.href}`, 'info'); simulateClick(loginButton); log(`步骤 0:2925 已点击“登录”,点击后地址 ${location.href}`, 'info'); - const finalState = await waitForMail2925View('mailbox', 20000); + const finalState = await waitForMail2925View('mailbox', 40000); log(`步骤 0:2925 登录等待结束,状态=${finalState.view},地址=${location.href}`, 'info'); if (finalState.view !== 'mailbox') { throw new Error('2925:提交账号密码后未进入收件箱。'); diff --git a/tests/background-mail2925-relogin-wait.test.js b/tests/background-mail2925-relogin-wait.test.js index 1f3cd4a..161988b 100644 --- a/tests/background-mail2925-relogin-wait.test.js +++ b/tests/background-mail2925-relogin-wait.test.js @@ -8,6 +8,13 @@ test('background mail2925 session uses /login/ as relogin entry url', () => { assert.match(source, /const MAIL2925_LOGIN_URL = 'https:\/\/2925\.com\/login\/';/); }); +test('background mail2925 session keeps login message timeout above the 40-second mailbox wait', () => { + const source = fs.readFileSync('background/mail-2925-session.js', 'utf8'); + assert.match(source, /timeoutMs:\s*50000,/); + assert.match(source, /responseTimeoutMs:\s*50000,/); + assert.match(source, /40 秒内未进入收件箱/); +}); + test('ensureMail2925MailboxSession waits 3 seconds before and after opening login page on force relogin', async () => { const source = fs.readFileSync('background/mail-2925-session.js', 'utf8'); const globalScope = {}; diff --git a/tests/mail-2925-content.test.js b/tests/mail-2925-content.test.js index 0349208..ddbe65d 100644 --- a/tests/mail-2925-content.test.js +++ b/tests/mail-2925-content.test.js @@ -4,8 +4,12 @@ const fs = require('node:fs'); const source = fs.readFileSync('content/mail-2925.js', 'utf8'); -test('ensureMail2925Session waits at most 20 seconds for mailbox after clicking login', () => { - assert.match(source, /waitForMail2925View\('mailbox',\s*20000\)/); +test('ensureMail2925Session waits at most 40 seconds for mailbox after clicking login', () => { + assert.match(source, /waitForMail2925View\('mailbox',\s*40000\)/); +}); + +test('ensureMail2925Session waits 1 second after filling credentials before clicking login', () => { + assert.match(source, /fillInput\(passwordInput,\s*password\);[\s\S]*?await sleep\(200\);[\s\S]*?await sleep\(1000\);[\s\S]*?simulateClick\(loginButton\);/); }); function extractFunction(name) { diff --git a/项目完整链路说明.md b/项目完整链路说明.md index c7c8c33..7f4f5c6 100644 --- a/项目完整链路说明.md +++ b/项目完整链路说明.md @@ -561,7 +561,7 @@ 3. 只有当 sidepanel 中的 `mail2925UseAccountPool` 开关开启时,provide 模式下的别名基邮箱才会优先取当前账号池选中的 2925 账号邮箱;关闭时会回退到原来的手填 `mail2925BaseEmail` 4. 手动点击 `登录` 或自动流程进入 Step 4 前,后台会先打开当前 2925 邮箱页:如果仍停留在收件箱则直接复用;如果跳到登录页,则仅在号池模式开启时才自动登录,关闭号池时直接调用现有停止逻辑结束流程 5. 一旦轮询期间出现“子邮箱已达上限邮箱”,后台会先判断是否启用了号池模式:若已启用且还有下一个可用账号,则把当前账号禁用 24 小时并自动切到下一个账号重新登录;若未启用,则直接调用现有停止逻辑结束流程 -6. 如果登录提交后 20 秒内仍未进入收件箱,且当前正处于自动运行中,则后台会直接复用现有 `requestStop()` 停止链路,把整个自动流程停成和用户手动点击“停止”一致的状态;这类情况常见于图片验证、行为验证或其他阻断登录的中间页 +6. 如果登录页已经识别到账号密码输入框,内容脚本会在填完账号密码后额外等待 1 秒再点击登录;若点击登录后 40 秒内仍未进入收件箱,且当前正处于自动运行中,则后台会直接复用现有 `requestStop()` 停止链路,把整个自动流程停成和用户手动点击“停止”一致的状态;这类情况常见于图片验证、行为验证或其他阻断登录的中间页 7. 如果没有下一个可用账号,或当前未启用号池模式,则不会继续消耗自动重试次数,而是直接复用现有 `requestStop()` 停止链路,把整个自动流程停成和用户手动点击“停止”一致的状态 8. sidepanel 中 2925 账号池的新增表单也走与 Hotmail 相同的共享交互:默认收起,头部按钮切换“添加账号 / 取消添加”,操作行右侧提供“批量导入”,保存成功后自动收起并清空。 9. 当 2925 号池模式开启时,当前选中的号池邮箱会同步回写到同一个 `mail2925BaseEmail` 字段;因此用户切换号池账号后,即使再次关闭号池模式,也会直接沿用刚才选中的邮箱作为手动基邮箱,无需重新输入。