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

Function runPreStep6CookieCleanup

background.js:5752–5787  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5750}
5751
5752async function runPreStep6CookieCleanup() {
5753 await addLog(
5754 `步骤 6:开始前等待 ${Math.round(STEP6_PRE_LOGIN_COOKIE_CLEAR_DELAY_MS / 1000)} 秒,然后直接删除 ChatGPT / OpenAI cookies...`,
5755 'info'
5756 );
5757
5758 await sleepWithStop(STEP6_PRE_LOGIN_COOKIE_CLEAR_DELAY_MS);
5759
5760 if (!chrome.cookies?.getAll || !chrome.cookies?.remove) {
5761 await addLog('步骤 6:当前浏览器不支持 cookies API,无法直接删除 cookies。', 'warn');
5762 return;
5763 }
5764
5765 const cookies = await collectCookiesForPreLoginCleanup();
5766 let removedCount = 0;
5767
5768 for (const cookie of cookies) {
5769 throwIfStopped();
5770 if (await removeCookieDirectly(cookie)) {
5771 removedCount += 1;
5772 }
5773 }
5774
5775 if (chrome.browsingData?.removeCookies) {
5776 try {
5777 await chrome.browsingData.removeCookies({
5778 since: 0,
5779 origins: PRE_LOGIN_COOKIE_CLEAR_ORIGINS,
5780 });
5781 } catch (err) {
5782 await addLog(`步骤 6:browsingData 补扫 cookies 失败:${getErrorMessage(err)}`, 'warn');
5783 }
5784 }
5785
5786 await addLog(`步骤 6:已直接删除 ${removedCount} 个 ChatGPT / OpenAI cookies,准备继续获取链接并登录。`, 'ok');
5787}
5788
5789// ============================================================
5790// Step 6: Login and ensure the auth page reaches the login verification page

Callers 1

executeStep6Function · 0.85

Calls 6

sleepWithStopFunction · 0.85
removeCookieDirectlyFunction · 0.85
addLogFunction · 0.70
throwIfStoppedFunction · 0.70
getErrorMessageFunction · 0.70

Tested by

no test coverage detected