feat: replace cookie cleanup step with registration success wait

This commit is contained in:
QLHazyCoder
2026-05-06 14:38:45 +08:00
parent 1bfb89eeb6
commit 9964b5a317
11 changed files with 69 additions and 189 deletions
-19
View File
@@ -1,19 +0,0 @@
(function attachBackgroundStep6(root, factory) {
root.MultiPageBackgroundStep6 = factory();
})(typeof self !== 'undefined' ? self : globalThis, function createBackgroundStep6Module() {
function createStep6Executor(deps = {}) {
const {
completeStepFromBackground,
runPreStep6CookieCleanup,
} = deps;
async function executeStep6() {
await runPreStep6CookieCleanup();
await completeStepFromBackground(6);
}
return { executeStep6 };
}
return { createStep6Executor };
});
@@ -0,0 +1,28 @@
(function attachBackgroundStep6(root, factory) {
root.MultiPageBackgroundStep6 = factory();
})(typeof self !== 'undefined' ? self : globalThis, function createBackgroundStep6Module() {
const DEFAULT_REGISTRATION_SUCCESS_WAIT_MS = 20000;
function createStep6Executor(deps = {}) {
const {
addLog = async () => {},
completeStepFromBackground,
registrationSuccessWaitMs = DEFAULT_REGISTRATION_SUCCESS_WAIT_MS,
sleepWithStop = async (ms) => new Promise((resolve) => setTimeout(resolve, Math.max(0, Number(ms) || 0))),
} = deps;
async function executeStep6() {
const waitMs = Math.max(0, Math.floor(Number(registrationSuccessWaitMs) || 0));
if (waitMs > 0) {
await addLog(`步骤 6:等待 ${Math.round(waitMs / 1000)} 秒,确认注册成功并让页面稳定...`, 'info');
await sleepWithStop(waitMs);
}
await addLog('步骤 6:注册成功等待完成,准备继续获取 OAuth 链接并登录。', 'ok');
await completeStepFromBackground(6);
}
return { executeStep6 };
}
return { createStep6Executor };
});