This commit is contained in:
949036910@qq.com
2026-06-03 22:12:20 +08:00
parent 7d65e3e602
commit 0b93813b68
2 changed files with 118 additions and 3 deletions

View File

@@ -1,8 +1,9 @@
"use strict";
const {
newLoginPage,
newLoginPageKeepOpen,
detachLoginBrowser,
bringPageToFront,
LOGIN_URLS,
} = require("./publish_browser.js");
@@ -25,11 +26,13 @@ globalThis.__nodejsMain = async function main(params) {
}
globalThis.__native?.emitProgress?.("正在打开浏览器…");
const page = await newLoginPage(platform, accountId, cookies, targetUrl);
const page = await newLoginPageKeepOpen(platform, accountId, cookies, targetUrl);
const cur = page.url();
if (!cur || cur === "about:blank" || !cur.includes("://")) {
await page.goto(targetUrl, { waitUntil: "domcontentloaded", timeout: 60000 });
}
await bringPageToFront(page);
// 断开 Puppeteer保留 detached Chrome 窗口Node 退出后不关浏览器)
await detachLoginBrowser(platform, accountId);
return {