-
-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Safari 17 now supports Ed25519
- Loading branch information
Showing
5 changed files
with
40 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,14 +27,27 @@ export const isWorkerd = | |
|
||
const BOWSER = 'https://cdn.jsdelivr.net/npm/[email protected]/src/bowser.js' | ||
|
||
async function isEngine(engine: string) { | ||
let parsedUserAgent: any | ||
async function parseUserAgent() { | ||
const { default: Bowser } = await import(BOWSER) | ||
return Bowser.parse(window.navigator.userAgent).engine.name === engine | ||
parsedUserAgent || (parsedUserAgent = Bowser.parse(window.navigator.userAgent)) | ||
return parsedUserAgent | ||
} | ||
|
||
async function isEngine(engine: string) { | ||
const userAgentData = await parseUserAgent() | ||
return userAgentData.engine.name === engine | ||
} | ||
|
||
async function isVersionAtLeast(version: number) { | ||
const userAgentData = await parseUserAgent() | ||
return parseInt(userAgentData.browser.version.split('.')[0], 10) >= version | ||
} | ||
|
||
export const isBlink = isBrowser && (await isEngine('Blink')) | ||
|
||
export const isWebKit = isBrowser && (await isEngine('WebKit')) | ||
export const isWebKitAbove17 = isBrowser && isWebKit && (await isVersionAtLeast(17)) | ||
|
||
export const isGecko = isBrowser && (await isEngine('Gecko')) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters