Tauri: Correctly detect UA on macOS (#6506)
This commit is contained in:
parent
2781b6032a
commit
5a6d38a53f
8
package-lock.json
generated
8
package-lock.json
generated
@ -108,6 +108,7 @@
|
||||
"tsx": "^4.20.6",
|
||||
"typescript": "5.9.3",
|
||||
"typescript-eslint": "^8.46.4",
|
||||
"user-agent-data-types": "^0.4.2",
|
||||
"webpack": "^5.102.1",
|
||||
"webpack-dev-server": "^5.2.2"
|
||||
},
|
||||
@ -20413,6 +20414,13 @@
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/user-agent-data-types": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/user-agent-data-types/-/user-agent-data-types-0.4.2.tgz",
|
||||
"integrity": "sha512-jXep3kO/dGNmDOkbDa8ccp4QArgxR4I76m3QVcJ1aOF0B9toc+YtSXtX5gLdDTZXyWlpQYQrABr6L1L2GZOghw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
|
||||
@ -120,6 +120,7 @@
|
||||
"tsx": "^4.20.6",
|
||||
"typescript": "5.9.3",
|
||||
"typescript-eslint": "^8.46.4",
|
||||
"user-agent-data-types": "^0.4.2",
|
||||
"webpack": "^5.102.1",
|
||||
"webpack-dev-server": "^5.2.2"
|
||||
},
|
||||
|
||||
2
src/@types/global.d.ts
vendored
2
src/@types/global.d.ts
vendored
@ -1,3 +1,5 @@
|
||||
/// <reference types="user-agent-data-types" />
|
||||
|
||||
declare const process: NodeJS.Process;
|
||||
|
||||
declare module '*.module.scss';
|
||||
|
||||
@ -32,7 +32,9 @@ export const IS_LINUX = PLATFORM_ENV === 'Linux';
|
||||
export const IS_IOS = PLATFORM_ENV === 'iOS';
|
||||
export const IS_ANDROID = PLATFORM_ENV === 'Android';
|
||||
export const IS_MOBILE = IS_IOS || IS_ANDROID;
|
||||
export const IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
||||
export const IS_CHROMIUM = navigator.userAgentData?.brands.some((data) => data.brand === 'Chromium')
|
||||
|| /Chrom(e|ium)\//.test(navigator.userAgent);
|
||||
export const IS_SAFARI = !IS_CHROMIUM && /applewebkit/i.test(navigator.userAgent);
|
||||
export const IS_YA_BROWSER = navigator.userAgent.includes('YaBrowser');
|
||||
export const IS_FIREFOX = navigator.userAgent.toLowerCase().includes('firefox')
|
||||
|| navigator.userAgent.toLowerCase().includes('iceweasel')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user