MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / runStep7Attempt

Function runStep7Attempt

background/steps/fetch-login-code.js:32–106  ·  view source on GitHub ↗
(state)

Source from the content-addressed store, hash-verified

30 } = deps;
31
32 async function runStep7Attempt(state) {
33 const mail = getMailConfig(state);
34 if (mail.error) throw new Error(mail.error);
35 const stepStartedAt = Date.now();
36 const authTabId = await getTabId('signup-page');
37
38 if (authTabId) {
39 await chrome.tabs.update(authTabId, { active: true });
40 } else {
41 if (!state.oauthUrl) {
42 throw new Error('缺少登录用 OAuth 链接,请先完成步骤 6。');
43 }
44 await reuseOrCreateTab('signup-page', state.oauthUrl);
45 }
46
47 throwIfStopped();
48 await ensureStep7VerificationPageReady();
49 await addLog('步骤 7:登录验证码页面已就绪,开始获取验证码。', 'info');
50
51 if (shouldUseCustomRegistrationEmail(state)) {
52 await confirmCustomVerificationStepBypass(7);
53 return;
54 }
55
56 throwIfStopped();
57 if (mail.provider === HOTMAIL_PROVIDER || mail.provider === LUCKMAIL_PROVIDER || mail.provider === CLOUDFLARE_TEMP_EMAIL_PROVIDER) {
58 await addLog(`步骤 7:正在通过 ${mail.label} 轮询验证码...`);
59 } else {
60 await addLog(`步骤 7:正在打开${mail.label}...`);
61
62 const alive = await isTabAlive(mail.source);
63 if (alive) {
64 if (mail.navigateOnReuse) {
65 await reuseOrCreateTab(mail.source, mail.url, {
66 inject: mail.inject,
67 injectSource: mail.injectSource,
68 });
69 } else {
70 const tabId = await getTabId(mail.source);
71 await chrome.tabs.update(tabId, { active: true });
72 }
73 } else {
74 await reuseOrCreateTab(mail.source, mail.url, {
75 inject: mail.inject,
76 injectSource: mail.injectSource,
77 });
78 }
79 }
80
81 const shouldRefreshOAuthBeforeSubmit = getPanelMode(state) === 'cpa';
82 let step6ReplayCompleted = false;
83
84 await resolveVerificationStep(7, state, mail, {
85 filterAfterTimestamp: mail.provider === HOTMAIL_PROVIDER ? undefined : Math.max(0, stepStartedAt - 60000),
86 requestFreshCodeFirst: false,
87 resendIntervalMs: (mail.provider === HOTMAIL_PROVIDER || mail.provider === '2925')
88 ? 0
89 : STANDARD_MAIL_VERIFICATION_RESEND_INTERVAL_MS,

Callers 1

executeStep7Function · 0.85

Calls 12

getMailConfigFunction · 0.85
getTabIdFunction · 0.50
reuseOrCreateTabFunction · 0.50
throwIfStoppedFunction · 0.50
addLogFunction · 0.50
isTabAliveFunction · 0.50
getPanelModeFunction · 0.50
resolveVerificationStepFunction · 0.50

Tested by

no test coverage detected