diff --git a/packages/ui/src/main/flow/CHECK_AND_DOWNLOAD_DEPENDENCIES/utils/browser-history.ts b/packages/ui/src/main/flow/CHECK_AND_DOWNLOAD_DEPENDENCIES/utils/browser-history.ts index 744c574..07f088c 100644 --- a/packages/ui/src/main/flow/CHECK_AND_DOWNLOAD_DEPENDENCIES/utils/browser-history.ts +++ b/packages/ui/src/main/flow/CHECK_AND_DOWNLOAD_DEPENDENCIES/utils/browser-history.ts @@ -33,6 +33,13 @@ export const getLastUsedAndAvailableBrowser = async (): Promise { - let puppeteerManager - puppeteerManager = await import('@puppeteer/browsers') + const puppeteerManager = await import('@puppeteer/browsers') return puppeteerManager } @@ -76,7 +74,8 @@ export const checkAndDownloadPuppeteerExecutable = async ( browser: puppeteerManager.Browser.CHROME, cacheDir, buildId: EXPECT_CHROMIUM_BUILD_ID, - downloadProgressCallback: options.downloadProgressCallback + downloadProgressCallback: options.downloadProgressCallback, + baseUrl: `https://registry.npmmirror.com/-/binary/chrome-for-testing` }) } else { gtag('use_installed_browser') @@ -128,33 +127,8 @@ export const getAnyAvailablePuppeteerExecutable = async (): Promise { const exceptChromiumMainVersion = Number(EXPECT_CHROMIUM_BUILD_ID.split('.')[0]) - // For windows, try to find Edge(chromium) - if (os.platform() === 'win32') { - // TODO: handle windows - const edgeExecutableLocation = path.join( - process.env['ProgramFiles(x86)']!, - 'Microsoft/Edge/Application', - 'msedge.exe' - ) - if (fs.existsSync(edgeExecutableLocation)) { - try { - const version = await getExecutableFileVersion(edgeExecutableLocation) - const mainVersion = Number(version.split('.')[0]) - if (mainVersion >= exceptChromiumMainVersion) { - return { - executablePath: edgeExecutableLocation, - browser: `Edge ${version}` - } - } - } catch (err) { - console.log(err) - } - } - } - - // For other, use findChrome - let findChrome: typeof import('find-chrome-bin').findChrome - findChrome = (await import('find-chrome-bin')).findChrome + const findChrome: typeof import('find-chrome-bin').findChrome = (await import('find-chrome-bin')) + .findChrome const targetBrowser = await findChrome({ min: exceptChromiumMainVersion }) diff --git a/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/ipc/index.ts b/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/ipc/index.ts index 34775b4..d0f39f9 100644 --- a/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/ipc/index.ts +++ b/packages/ui/src/main/flow/OPEN_SETTING_WINDOW/ipc/index.ts @@ -166,7 +166,7 @@ export default function initIpc() { subProcessOfPuppeteer = childProcess.spawn( process.argv[0], [ - ...process.argv.slice(1), + process.argv[1], `--mode=geekAutoStartWithBossDaemon`, `--mode-to-daemon=geekAutoStartWithBossMain` ], @@ -222,7 +222,7 @@ export default function initIpc() { } subProcessOfPuppeteer = childProcess.spawn( process.argv[0], - [...process.argv.slice(1), `--mode=readNoReplyAutoReminder`], + [process.argv[1], `--mode=readNoReplyAutoReminder`], { env: subProcessEnv, stdio: ['inherit', 'inherit', 'inherit', 'pipe', 'ipc'] @@ -282,7 +282,7 @@ export default function initIpc() { } subProcessOfCheckAndDownloadDependencies = childProcess.spawn( process.argv[0], - [...process.argv.slice(1), `--mode="checkAndDownloadDependenciesForInit"`], + [process.argv[1], `--mode=checkAndDownloadDependenciesForInit`], { stdio: [null, null, null, 'pipe', 'ipc'] } @@ -349,7 +349,7 @@ export default function initIpc() { } subProcessOfBossZhipinLoginPageWithPreloadExtension = childProcess.spawn( process.argv[0], - [...process.argv.slice(1), `--mode=launchBossZhipinLoginPageWithPreloadExtension`], + [process.argv[1], `--mode=launchBossZhipinLoginPageWithPreloadExtension`], { env: subProcessEnv, stdio: [null, null, null, 'pipe', 'ipc'] @@ -429,7 +429,7 @@ export default function initIpc() { } subProcessOfOpenBossSite = childProcess.spawn( process.argv[0], - [...process.argv.slice(1), `--mode=launchBossSite`], + [process.argv[1], `--mode=launchBossSite`], { env: subProcessEnv, stdio: ['inherit', 'inherit', 'inherit', 'pipe']