fix: 收敛 2925 邮箱修复范围
- 回退非必要的 2925 行为改动,仅保留已验证有效的修复 - 保留 bounce 转发地址解析、中文日期解析与邮箱页复用时的 ready 恢复 - 同步最小化测试断言,保持当前代码与测试一致
This commit is contained in:
@@ -537,6 +537,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof ensureContentScriptReadyOnTab === 'function') {
|
||||||
|
await ensureContentScriptReadyOnTab(MAIL2925_SOURCE, tabId, {
|
||||||
|
inject: MAIL2925_INJECT,
|
||||||
|
injectSource: MAIL2925_INJECT_SOURCE,
|
||||||
|
timeoutMs: 20000,
|
||||||
|
retryDelayMs: 800,
|
||||||
|
logMessage: '步骤 0:2925 登录页内容脚本未就绪,正在等待页面稳定后继续登录...',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!forceRelogin && !isMail2925LoginUrl(openedUrl) && !normalizedExpectedMailboxEmail) {
|
if (!forceRelogin && !isMail2925LoginUrl(openedUrl) && !normalizedExpectedMailboxEmail) {
|
||||||
await addLog('2925:当前邮箱页未跳转到登录页,将直接复用已登录会话。', 'info');
|
await addLog('2925:当前邮箱页未跳转到登录页,将直接复用已登录会话。', 'info');
|
||||||
return buildSuccessPayload();
|
return buildSuccessPayload();
|
||||||
@@ -553,16 +563,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof ensureContentScriptReadyOnTab === 'function') {
|
|
||||||
await ensureContentScriptReadyOnTab(MAIL2925_SOURCE, tabId, {
|
|
||||||
inject: MAIL2925_INJECT,
|
|
||||||
injectSource: MAIL2925_INJECT_SOURCE,
|
|
||||||
timeoutMs: 20000,
|
|
||||||
retryDelayMs: 800,
|
|
||||||
logMessage: '步骤 0:2925 登录页内容脚本未就绪,正在等待页面稳定后继续登录...',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (forceRelogin && typeof sleepWithStop === 'function') {
|
if (forceRelogin && typeof sleepWithStop === 'function') {
|
||||||
await addLog('2925:登录页已打开,等待 3 秒后开始检查输入框并执行登录...', 'info');
|
await addLog('2925:登录页已打开,等待 3 秒后开始检查输入框并执行登录...', 'info');
|
||||||
await sleepWithStop(3000);
|
await sleepWithStop(3000);
|
||||||
|
|||||||
@@ -69,10 +69,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getExpectedMail2925MailboxEmail(state = {}) {
|
function getExpectedMail2925MailboxEmail(state = {}) {
|
||||||
if (String(state?.mail2925Mode || '').trim().toLowerCase() === 'receive') {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Boolean(state?.mail2925UseAccountPool)) {
|
if (Boolean(state?.mail2925UseAccountPool)) {
|
||||||
const currentAccountId = String(state?.currentMail2925AccountId || '').trim();
|
const currentAccountId = String(state?.currentMail2925AccountId || '').trim();
|
||||||
const accounts = Array.isArray(state?.mail2925Accounts) ? state.mail2925Accounts : [];
|
const accounts = Array.isArray(state?.mail2925Accounts) ? state.mail2925Accounts : [];
|
||||||
|
|||||||
@@ -26,10 +26,6 @@
|
|||||||
} = deps;
|
} = deps;
|
||||||
|
|
||||||
function getExpectedMail2925MailboxEmail(state = {}) {
|
function getExpectedMail2925MailboxEmail(state = {}) {
|
||||||
if (String(state?.mail2925Mode || '').trim().toLowerCase() === 'receive') {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Boolean(state?.mail2925UseAccountPool)) {
|
if (Boolean(state?.mail2925UseAccountPool)) {
|
||||||
const currentAccountId = String(state?.currentMail2925AccountId || '').trim();
|
const currentAccountId = String(state?.currentMail2925AccountId || '').trim();
|
||||||
const accounts = Array.isArray(state?.mail2925Accounts) ? state.mail2925Accounts : [];
|
const accounts = Array.isArray(state?.mail2925Accounts) ? state.mail2925Accounts : [];
|
||||||
|
|||||||
@@ -214,7 +214,8 @@
|
|||||||
|
|
||||||
function getVerificationPollPayload(step, state, overrides = {}) {
|
function getVerificationPollPayload(step, state, overrides = {}) {
|
||||||
const is2925Provider = state?.mailProvider === '2925';
|
const is2925Provider = state?.mailProvider === '2925';
|
||||||
const mail2925MatchTargetEmail = is2925Provider;
|
const mail2925MatchTargetEmail = is2925Provider
|
||||||
|
&& String(state?.mail2925Mode || '').trim().toLowerCase() === 'receive';
|
||||||
if (step === 4) {
|
if (step === 4) {
|
||||||
return {
|
return {
|
||||||
filterAfterTimestamp: is2925Provider ? 0 : getHotmailVerificationRequestTimestamp(4, state),
|
filterAfterTimestamp: is2925Provider ? 0 : getHotmailVerificationRequestTimestamp(4, state),
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
// content/mail-2925.js - Content script for 2925 Mail (steps 4, 8)
|
// content/mail-2925.js - Content script for 2925 Mail (steps 4, 8)
|
||||||
// Injected dynamically on: 2925.com
|
// Injected dynamically on: 2925.com
|
||||||
|
|
||||||
(function initMail2925ContentScript() {
|
|
||||||
if (window.__MULTIPAGE_MAIL2925_SCRIPT_LOADED__) {
|
|
||||||
console.log('[MultiPage:mail-2925] Duplicate injection skipped on', location.href);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
window.__MULTIPAGE_MAIL2925_SCRIPT_LOADED__ = true;
|
|
||||||
|
|
||||||
const MAIL2925_PREFIX = '[MultiPage:mail-2925]';
|
const MAIL2925_PREFIX = '[MultiPage:mail-2925]';
|
||||||
const isTopFrame = window === window.top;
|
const isTopFrame = window === window.top;
|
||||||
|
|
||||||
@@ -1223,4 +1216,3 @@ async function handlePollEmail(step, payload) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
// Injected on: auth0.openai.com, auth.openai.com, accounts.openai.com
|
// Injected on: auth0.openai.com, auth.openai.com, accounts.openai.com
|
||||||
// Dynamically injected on: chatgpt.com
|
// Dynamically injected on: chatgpt.com
|
||||||
|
|
||||||
(function initSignupPageContentScript() {
|
|
||||||
console.log('[MultiPage:signup-page] Content script loaded on', location.href);
|
console.log('[MultiPage:signup-page] Content script loaded on', location.href);
|
||||||
|
|
||||||
const SIGNUP_PAGE_LISTENER_SENTINEL = 'data-multipage-signup-page-listener';
|
const SIGNUP_PAGE_LISTENER_SENTINEL = 'data-multipage-signup-page-listener';
|
||||||
@@ -3561,4 +3560,3 @@ async function step5_fillNameBirthday(payload) {
|
|||||||
log('步骤 5:已点击“完成帐户创建”,当前步骤直接完成,不再等待页面结果。');
|
log('步骤 5:已点击“完成帐户创建”,当前步骤直接完成,不再等待页面结果。');
|
||||||
return completionPayload;
|
return completionPayload;
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
|
|||||||
+5
-5
@@ -1,6 +1,6 @@
|
|||||||
// content/utils.js — Shared utilities for all content scripts
|
// content/utils.js — Shared utilities for all content scripts
|
||||||
|
|
||||||
var getActivationStrategy = self.MultiPageActivationUtils?.getActivationStrategy;
|
const getActivationStrategy = self.MultiPageActivationUtils?.getActivationStrategy;
|
||||||
|
|
||||||
function detectScriptSource({
|
function detectScriptSource({
|
||||||
injectedSource,
|
injectedSource,
|
||||||
@@ -26,7 +26,7 @@ function detectScriptSource({
|
|||||||
return 'vps-panel';
|
return 'vps-panel';
|
||||||
}
|
}
|
||||||
|
|
||||||
var SCRIPT_SOURCE = (() => {
|
const SCRIPT_SOURCE = (() => {
|
||||||
return detectScriptSource({
|
return detectScriptSource({
|
||||||
injectedSource: window.__MULTIPAGE_SOURCE,
|
injectedSource: window.__MULTIPAGE_SOURCE,
|
||||||
url: location.href,
|
url: location.href,
|
||||||
@@ -38,9 +38,9 @@ function getRuntimeScriptSource() {
|
|||||||
return window.__MULTIPAGE_SOURCE || SCRIPT_SOURCE;
|
return window.__MULTIPAGE_SOURCE || SCRIPT_SOURCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
var LOG_PREFIX = `[MultiPage:${SCRIPT_SOURCE}]`;
|
const LOG_PREFIX = `[MultiPage:${SCRIPT_SOURCE}]`;
|
||||||
var STOP_ERROR_MESSAGE = '流程已被用户停止。';
|
const STOP_ERROR_MESSAGE = '流程已被用户停止。';
|
||||||
var flowStopped = false;
|
let flowStopped = false;
|
||||||
|
|
||||||
if (!window.__MULTIPAGE_UTILS_LISTENER_READY__) {
|
if (!window.__MULTIPAGE_UTILS_LISTENER_READY__) {
|
||||||
window.__MULTIPAGE_UTILS_LISTENER_READY__ = true;
|
window.__MULTIPAGE_UTILS_LISTENER_READY__ = true;
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ test('ensureMail2925MailboxSession reuses current mailbox page without sending l
|
|||||||
});
|
});
|
||||||
|
|
||||||
assert.equal(sendCalls, 0);
|
assert.equal(sendCalls, 0);
|
||||||
assert.equal(readyCalls, 0);
|
assert.equal(readyCalls, 1);
|
||||||
assert.equal(result.result.usedExistingSession, true);
|
assert.equal(result.result.usedExistingSession, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ test('verification flow keeps 2925 polling cadence in the default payload', () =
|
|||||||
assert.equal(step8Payload.intervalMs, 15000);
|
assert.equal(step8Payload.intervalMs, 15000);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('verification flow enables 2925 target email matching in both provide and receive modes', () => {
|
test('verification flow only enables 2925 target email matching in receive mode', () => {
|
||||||
const helpers = api.createVerificationFlowHelpers({
|
const helpers = api.createVerificationFlowHelpers({
|
||||||
addLog: async () => {},
|
addLog: async () => {},
|
||||||
chrome: { tabs: { update: async () => {} } },
|
chrome: { tabs: { update: async () => {} } },
|
||||||
@@ -82,7 +82,7 @@ test('verification flow enables 2925 target email matching in both provide and r
|
|||||||
mail2925Mode: 'receive',
|
mail2925Mode: 'receive',
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.equal(providePayload.mail2925MatchTargetEmail, true);
|
assert.equal(providePayload.mail2925MatchTargetEmail, false);
|
||||||
assert.equal(receivePayload.mail2925MatchTargetEmail, true);
|
assert.equal(receivePayload.mail2925MatchTargetEmail, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user