mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-05 07:27:35 +08:00
add edge to block list due to https://github.com/geekgeekrun/geekgeekrun/issues/5
This commit is contained in:
@@ -33,6 +33,13 @@ export const getLastUsedAndAvailableBrowser = async (): Promise<BrowserInfo | nu
|
|||||||
await removeLastUsedAndAvailableBrowserPath()
|
await removeLastUsedAndAvailableBrowserPath()
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// blacklist browser
|
||||||
|
if (path.includes(`Microsoft\\Edge\\Application\\msedge.exe`)) {
|
||||||
|
await removeLastUsedAndAvailableBrowserPath()
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
executablePath: path,
|
executablePath: path,
|
||||||
browser
|
browser
|
||||||
|
|||||||
+3
-30
@@ -8,12 +8,10 @@ import {
|
|||||||
getLastUsedAndAvailableBrowser,
|
getLastUsedAndAvailableBrowser,
|
||||||
removeLastUsedAndAvailableBrowserPath
|
removeLastUsedAndAvailableBrowserPath
|
||||||
} from '../browser-history'
|
} from '../browser-history'
|
||||||
import { getExecutableFileVersion } from '@geekgeekrun/utils/windows-only/file.mjs'
|
|
||||||
import gtag from '../../../../utils/gtag'
|
import gtag from '../../../../utils/gtag'
|
||||||
|
|
||||||
const getPuppeteerManagerModule = async () => {
|
const getPuppeteerManagerModule = async () => {
|
||||||
let puppeteerManager
|
const puppeteerManager = await import('@puppeteer/browsers')
|
||||||
puppeteerManager = await import('@puppeteer/browsers')
|
|
||||||
|
|
||||||
return puppeteerManager
|
return puppeteerManager
|
||||||
}
|
}
|
||||||
@@ -129,33 +127,8 @@ export const getAnyAvailablePuppeteerExecutable = async (): Promise<BrowserInfo
|
|||||||
|
|
||||||
export async function findAndLocateUserInstalledChromiumExecutableSync(): Promise<BrowserInfo> {
|
export async function findAndLocateUserInstalledChromiumExecutableSync(): Promise<BrowserInfo> {
|
||||||
const exceptChromiumMainVersion = Number(EXPECT_CHROMIUM_BUILD_ID.split('.')[0])
|
const exceptChromiumMainVersion = Number(EXPECT_CHROMIUM_BUILD_ID.split('.')[0])
|
||||||
// For windows, try to find Edge(chromium)
|
const findChrome: typeof import('find-chrome-bin').findChrome = (await import('find-chrome-bin'))
|
||||||
if (os.platform() === 'win32') {
|
.findChrome
|
||||||
// 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 targetBrowser = await findChrome({
|
const targetBrowser = await findChrome({
|
||||||
min: exceptChromiumMainVersion
|
min: exceptChromiumMainVersion
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user