mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 07:58:45 +03:00
Update version to 2.0.0-rc.2
This commit is contained in:
parent
0808d1d940
commit
a1644b6775
6
.github/ISSUE_TEMPLATE/bug_report.md
vendored
6
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -10,8 +10,6 @@ assignees: ''
|
|||||||
**Library version**
|
**Library version**
|
||||||
Which version of the library that you use, eg: v0.7.35 or v2.0.0-alpha.3
|
Which version of the library that you use, eg: v0.7.35 or v2.0.0-alpha.3
|
||||||
|
|
||||||
For the issue related with detection result, you can use the demo section in https://uaparser.dev to confirm
|
|
||||||
|
|
||||||
**Describe the bug**
|
**Describe the bug**
|
||||||
A clear and concise description of what the bug is.
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
@ -23,11 +21,13 @@ Steps to reproduce the behavior:
|
|||||||
4. See error
|
4. See error
|
||||||
|
|
||||||
**Expected behavior**
|
**Expected behavior**
|
||||||
A clear and concise description of what you expected to happen.
|
A clear and concise description of what you expected to happen, or what's referred in the docs https://docs.uaparser.dev/
|
||||||
|
|
||||||
**Screenshots**
|
**Screenshots**
|
||||||
If applicable, add screenshots to help explain your problem.
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
For issues related to detection results, you can send the screenshots of the demo section at https://uaparser.dev/#demo to confirm.
|
||||||
|
|
||||||
**Desktop (please complete the following information):**
|
**Desktop (please complete the following information):**
|
||||||
- OS: [e.g. iOS]
|
- OS: [e.g. iOS]
|
||||||
- Browser [e.g. chrome, safari]
|
- Browser [e.g. chrome, safari]
|
||||||
|
62
CHANGELOG.md
62
CHANGELOG.md
@ -1,5 +1,46 @@
|
|||||||
# UAParser.js Changelog
|
# UAParser.js Changelog
|
||||||
|
|
||||||
|
## Migrating from v1 to v2
|
||||||
|
|
||||||
|
- What's breaking:
|
||||||
|
- Licensed under AGPLv3 (open-source) or PRO License (commercial)
|
||||||
|
- Browser detection on mobile device: `"Chrome" => "Mobile Chrome"`, `"Firefox" => "Mobile Firefox"`
|
||||||
|
- OS detection: `"Mac OS" => "macOS"`, `"Chromium OS" => "Chrome OS"`
|
||||||
|
- What's new:
|
||||||
|
- New device type: `xr`, to identify AR/VR devices
|
||||||
|
- New browser property: `browser.type`, to identify the type of the browser: `crawler`, `cli`, `email`, `fetcher`, `inapp`, `mediaplayer`, `module`
|
||||||
|
- New methods in result object (all of `get*()` return value):
|
||||||
|
- Support for client hints: `withClientHints()`
|
||||||
|
- Support for feature detection: `withFeatureCheck()`
|
||||||
|
- Utility for easy comparison: `is()`
|
||||||
|
- Utility to print full-name: `toString()`
|
||||||
|
- Parse directly from command line using `npx ua-parser-js`
|
||||||
|
- Extensions can be passed as a list to `UAParser()`
|
||||||
|
- Support for ES module & TypeScript `import { UAParser } from 'ua-parser-js'`
|
||||||
|
- Provided Enums submodule `'ua-parser-js/enums'`
|
||||||
|
- Provided Extensions submodule `'ua-parser-js/extensions'`
|
||||||
|
- Provided Helpers submodule `'ua-parser-js/helpers'`:
|
||||||
|
- `getDeviceVendor()` to guess for a device vendor based on its model name
|
||||||
|
- `isAppleSilicon()` to check if the device has Apple Silicon Mac device properties
|
||||||
|
- `isBot()` to check if the browser is identified as a bot
|
||||||
|
- `isChromeFamily()` to check if the browser is Chrome-based / has Blink engine (i.e: New Opera, New Edge, Vivaldi, Brave, Arc, etc.)
|
||||||
|
- `isElectron()` to check if current window is running inside Electron
|
||||||
|
- `isFromEU()` to check if current window is from an EU (European Union) country
|
||||||
|
- `isFrozenUA()` to check if a user-agent string match with the reduced/frozen user-agent pattern
|
||||||
|
- `isStandalonePWA()` to check if current window is a standalone PWA
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
## Version 2.0.0-rc.2
|
||||||
|
|
||||||
|
- Fix incorrect import path in ESM files
|
||||||
|
- Add new browser: 115, SlimBoat, Slimjet, LibreWolf
|
||||||
|
- Improve browser detection: 2345, 360, Dragon, Iron, Maxthon
|
||||||
|
- `ua-parser-js/enums` submodule:
|
||||||
|
- Add Chromecast OS variants: Android/Fuchsia/Linux/SmartSpeaker
|
||||||
|
- `ua-parser-js/helpers` submodule:
|
||||||
|
- Add new method: `isBot()` to check if the browser is identified as a bot
|
||||||
|
|
||||||
## Version 2.0.0-rc.1
|
## Version 2.0.0-rc.1
|
||||||
|
|
||||||
- Fix Python Request mistakenly identified as Meta Quest
|
- Fix Python Request mistakenly identified as Meta Quest
|
||||||
@ -68,27 +109,6 @@
|
|||||||
|
|
||||||
- Initial work on new major version
|
- Initial work on new major version
|
||||||
|
|
||||||
## Version 2.0
|
|
||||||
|
|
||||||
- What's breaking:
|
|
||||||
- Dual-licensed under AGPLv3 or PRO License
|
|
||||||
- Browser detection on mobile device: `"Chrome" => "Mobile Chrome"`, `"Firefox" => "Mobile Firefox"`
|
|
||||||
- OS detection: `"Mac OS" => "macOS"`, `"Chromium OS" => "Chrome OS"`
|
|
||||||
- AR/VR devices moved to new device type: `xr`
|
|
||||||
- New property in `browser`: `type`
|
|
||||||
- What's new:
|
|
||||||
- Some new methods in result object:
|
|
||||||
- Support for client hints: `withClientHints()`
|
|
||||||
- Support for feature detection: `withFeatureCheck()`
|
|
||||||
- Utility for easy comparison: `is()`
|
|
||||||
- Utility to print full-name: `toString()`
|
|
||||||
- Parse directly from command line using `npx ua-parser-js`
|
|
||||||
- Extensions can be passed as a list to `UAParser()`
|
|
||||||
- Support for ES module `import { UAParser } from 'ua-parser-js'`
|
|
||||||
- Provided Enums submodule `'ua-parser-js/enums'`
|
|
||||||
- Provided Extensions submodule `'ua-parser-js/extensions'`
|
|
||||||
- Provided Helpers submodule `'ua-parser-js/helpers'`
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Version 0.7.38 / 1.0.38
|
## Version 0.7.38 / 1.0.38
|
||||||
|
4
dist/ua-parser.min.js
vendored
4
dist/ua-parser.min.js
vendored
File diff suppressed because one or more lines are too long
4
dist/ua-parser.pack.js
vendored
4
dist/ua-parser.pack.js
vendored
File diff suppressed because one or more lines are too long
46
package-lock.json
generated
46
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "2.0.0-rc.1",
|
"version": "2.0.0-rc.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "2.0.0-rc.1",
|
"version": "2.0.0-rc.2",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "opencollective",
|
"type": "opencollective",
|
||||||
@ -23,7 +23,9 @@
|
|||||||
],
|
],
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"detect-europe-js": "^0.1.1"
|
"detect-europe-js": "^0.1.1",
|
||||||
|
"is-standalone-pwa": "^0.1.0",
|
||||||
|
"ua-is-frozen": "^0.1.1"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"ua-parser-js": "script/cli.js"
|
"ua-parser-js": "script/cli.js"
|
||||||
@ -2609,6 +2611,25 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/is-standalone-pwa": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-standalone-pwa/-/is-standalone-pwa-0.1.0.tgz",
|
||||||
|
"integrity": "sha512-n5SQqXd0/JEkrKYEB7ZUndwuS7NKskZvk6rZZt6kTE1jiPxtPfPvVhXkfteIKpUfcEP07qsja/Wjz9NDjiZ5gg==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/faisalman"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/ua-parser-js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "paypal",
|
||||||
|
"url": "https://paypal.me/faisalman"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"node_modules/isarray": {
|
"node_modules/isarray": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||||
@ -4597,6 +4618,25 @@
|
|||||||
"node": "*"
|
"node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ua-is-frozen": {
|
||||||
|
"version": "0.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ua-is-frozen/-/ua-is-frozen-0.1.1.tgz",
|
||||||
|
"integrity": "sha512-TxhyfblPzcDJXRXu/j+73OI6s1jG6PUZBF/8hjTHoAsjZYKl9IhZzLQlnZHFLe5U2mvL1lMOOmcy647KpUq25A==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/faisalman"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/ua-parser-js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "paypal",
|
||||||
|
"url": "https://paypal.me/faisalman"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"node_modules/uglify-js": {
|
"node_modules/uglify-js": {
|
||||||
"version": "3.12.8",
|
"version": "3.12.8",
|
||||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.12.8.tgz",
|
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.12.8.tgz",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"title": "UAParser.js",
|
"title": "UAParser.js",
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "2.0.0-rc.1",
|
"version": "2.0.0-rc.2",
|
||||||
"author": "Faisal Salman <f@faisalman.com> (http://faisalman.com)",
|
"author": "Faisal Salman <f@faisalman.com> (http://faisalman.com)",
|
||||||
"description": "Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent & Client Hints data. Supports browser & node.js environment",
|
"description": "Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent & Client Hints data. Supports browser & node.js environment",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
/* Enums for UAParser.js v2.0.0-rc.1
|
/* Enums for UAParser.js v2.0.0-rc.2
|
||||||
https://github.com/faisalman/ua-parser-js
|
https://github.com/faisalman/ua-parser-js
|
||||||
Author: Faisal Salman <f@faisalman.com>
|
Author: Faisal Salman <f@faisalman.com>
|
||||||
AGPLv3 License */
|
AGPLv3 License */
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// Source: /src/enums/ua-parser-enums.js
|
// Source: /src/enums/ua-parser-enums.js
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
/* Enums for UAParser.js v2.0.0-rc.1
|
/* Enums for UAParser.js v2.0.0-rc.2
|
||||||
https://github.com/faisalman/ua-parser-js
|
https://github.com/faisalman/ua-parser-js
|
||||||
Author: Faisal Salman <f@faisalman.com>
|
Author: Faisal Salman <f@faisalman.com>
|
||||||
AGPLv3 License */
|
AGPLv3 License */
|
||||||
@ -12,8 +12,9 @@
|
|||||||
/*jshint esversion: 6 */
|
/*jshint esversion: 6 */
|
||||||
|
|
||||||
const Browser = Object.freeze({
|
const Browser = Object.freeze({
|
||||||
'2345_EXPLORER': '2345Explorer',
|
'115': '115',
|
||||||
'360': '360 Browser',
|
'2345': '2345',
|
||||||
|
'360': '360',
|
||||||
ALIPAY: 'Alipay',
|
ALIPAY: 'Alipay',
|
||||||
AMAYA: 'Amaya',
|
AMAYA: 'Amaya',
|
||||||
ANDROID: 'Android Browser',
|
ANDROID: 'Android Browser',
|
||||||
@ -36,11 +37,11 @@ const Browser = Object.freeze({
|
|||||||
CHROMIUM: 'Chromium',
|
CHROMIUM: 'Chromium',
|
||||||
COBALT: 'Cobalt',
|
COBALT: 'Cobalt',
|
||||||
COC_COC: 'Coc Coc',
|
COC_COC: 'Coc Coc',
|
||||||
COMODO_DRAGON: 'Comodo Dragon',
|
|
||||||
CONKEROR: 'Conkeror',
|
CONKEROR: 'Conkeror',
|
||||||
DILLO: 'Dillo',
|
DILLO: 'Dillo',
|
||||||
DOLPHIN: 'Dolphin',
|
DOLPHIN: 'Dolphin',
|
||||||
DORIS: 'Doris',
|
DORIS: 'Doris',
|
||||||
|
DRAGON: 'Dragon',
|
||||||
DUCKDUCKGO: 'DuckDuckGo',
|
DUCKDUCKGO: 'DuckDuckGo',
|
||||||
EDGE: 'Edge',
|
EDGE: 'Edge',
|
||||||
EPIPHANY: 'Epiphany',
|
EPIPHANY: 'Epiphany',
|
||||||
@ -78,6 +79,7 @@ const Browser = Object.freeze({
|
|||||||
KLARNA: 'Klarna',
|
KLARNA: 'Klarna',
|
||||||
KINDLE: 'Kindle',
|
KINDLE: 'Kindle',
|
||||||
LENOVO: 'Smart Lenovo Browser',
|
LENOVO: 'Smart Lenovo Browser',
|
||||||
|
LIBREWOLF: 'LibreWolf',
|
||||||
LIEBAO: 'LBBROWSER',
|
LIEBAO: 'LBBROWSER',
|
||||||
LINE: 'Line',
|
LINE: 'Line',
|
||||||
LINKEDIN: 'LinkedIn',
|
LINKEDIN: 'LinkedIn',
|
||||||
@ -126,7 +128,9 @@ const Browser = Object.freeze({
|
|||||||
SILK: 'Silk',
|
SILK: 'Silk',
|
||||||
SKYFIRE: 'Skyfire',
|
SKYFIRE: 'Skyfire',
|
||||||
SLEIPNIR: 'Sleipnir',
|
SLEIPNIR: 'Sleipnir',
|
||||||
|
SLIMBOAT: 'SlimBoat',
|
||||||
SLIMBROWSER: 'SlimBrowser',
|
SLIMBROWSER: 'SlimBrowser',
|
||||||
|
SLIMJET: 'Slimjet',
|
||||||
SNAPCHAT: 'Snapchat',
|
SNAPCHAT: 'Snapchat',
|
||||||
SOGOU_EXPLORER: 'Sogou Explorer',
|
SOGOU_EXPLORER: 'Sogou Explorer',
|
||||||
SOGOU_MOBILE: 'Sogou Mobile',
|
SOGOU_MOBILE: 'Sogou Mobile',
|
||||||
@ -291,6 +295,10 @@ const OS = Object.freeze({
|
|||||||
CENTOS: 'CentOS',
|
CENTOS: 'CentOS',
|
||||||
CHROME_OS: 'Chrome OS',
|
CHROME_OS: 'Chrome OS',
|
||||||
CHROMECAST: 'Chromecast',
|
CHROMECAST: 'Chromecast',
|
||||||
|
CHROMECAST_ANDROID: 'Chromecast Android',
|
||||||
|
CHROMECAST_FUCHSIA: 'Chromecast Fuchsia',
|
||||||
|
CHROMECAST_LINUX: 'Chromecast Linux',
|
||||||
|
CHROMECAST_SMARTSPEAKER: 'Chromecast SmartSpeaker',
|
||||||
CONTIKI: 'Contiki',
|
CONTIKI: 'Contiki',
|
||||||
DEBIAN: 'Debian',
|
DEBIAN: 'Debian',
|
||||||
DEEPIN: 'Deepin',
|
DEEPIN: 'Deepin',
|
||||||
|
2
src/extensions/ua-parser-extensions.d.ts
vendored
2
src/extensions/ua-parser-extensions.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
// Type definitions for Helpers submodule of UAParser.js v2.0.0-beta.3
|
// Type definitions for Helpers submodule of UAParser.js v2.0.0-rc.2
|
||||||
// Project: https://github.com/faisalman/ua-parser-js
|
// Project: https://github.com/faisalman/ua-parser-js
|
||||||
// Definitions by: Faisal Salman <https://github.com/faisalman>
|
// Definitions by: Faisal Salman <https://github.com/faisalman>
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
/* Extensions for UAParser.js v2.0.0-rc.1
|
/* Extensions for UAParser.js v2.0.0-rc.2
|
||||||
https://github.com/faisalman/ua-parser-js
|
https://github.com/faisalman/ua-parser-js
|
||||||
Author: Faisal Salman <f@faisalman.com>
|
Author: Faisal Salman <f@faisalman.com>
|
||||||
AGPLv3 License */
|
AGPLv3 License */
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// Source: /src/extensions/ua-parser-extensions.js
|
// Source: /src/extensions/ua-parser-extensions.js
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
/* Extensions for UAParser.js v2.0.0-rc.1
|
/* Extensions for UAParser.js v2.0.0-rc.2
|
||||||
https://github.com/faisalman/ua-parser-js
|
https://github.com/faisalman/ua-parser-js
|
||||||
Author: Faisal Salman <f@faisalman.com>
|
Author: Faisal Salman <f@faisalman.com>
|
||||||
AGPLv3 License */
|
AGPLv3 License */
|
||||||
|
2
src/helpers/ua-parser-helpers.d.ts
vendored
2
src/helpers/ua-parser-helpers.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
// Type definitions for Helpers submodule of UAParser.js v2.0.0-beta.3
|
// Type definitions for Helpers submodule of UAParser.js v2.0.0-rc.2
|
||||||
// Project: https://github.com/faisalman/ua-parser-js
|
// Project: https://github.com/faisalman/ua-parser-js
|
||||||
// Definitions by: Faisal Salman <https://github.com/faisalman>
|
// Definitions by: Faisal Salman <https://github.com/faisalman>
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
/* Helpers for UAParser.js v2.0.0-rc.1
|
/* Helpers for UAParser.js v2.0.0-rc.2
|
||||||
https://github.com/faisalman/ua-parser-js
|
https://github.com/faisalman/ua-parser-js
|
||||||
Author: Faisal Salman <f@faisalman.com>
|
Author: Faisal Salman <f@faisalman.com>
|
||||||
AGPLv3 License */
|
AGPLv3 License */
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// Source: /src/helpers/ua-parser-helpers.js
|
// Source: /src/helpers/ua-parser-helpers.js
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
/* Helpers for UAParser.js v2.0.0-rc.1
|
/* Helpers for UAParser.js v2.0.0-rc.2
|
||||||
https://github.com/faisalman/ua-parser-js
|
https://github.com/faisalman/ua-parser-js
|
||||||
Author: Faisal Salman <f@faisalman.com>
|
Author: Faisal Salman <f@faisalman.com>
|
||||||
AGPLv3 License */
|
AGPLv3 License */
|
||||||
@ -11,9 +11,11 @@
|
|||||||
|
|
||||||
/*jshint esversion: 6 */
|
/*jshint esversion: 6 */
|
||||||
|
|
||||||
import { CPU, OS, Engine } from './enums/ua-parser-enums.mjs';
|
import { UAParser } from '../main/ua-parser.mjs';
|
||||||
import { UAParser } from './main/ua-parser.mjs';
|
import { CPU, OS, Engine } from '../enums/ua-parser-enums.mjs';
|
||||||
import { isFromEU } from 'detect-europe-js';
|
import { isFromEU } from 'detect-europe-js';
|
||||||
|
import { isFrozenUA } from 'ua-is-frozen';
|
||||||
|
import { isStandalonePWA } from 'is-standalone-pwa';
|
||||||
|
|
||||||
const getDeviceVendor = (model) => UAParser(`Mozilla/5.0 (Linux; Android 10; ${model}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.0.0 Safari/537.36`).device.vendor;
|
const getDeviceVendor = (model) => UAParser(`Mozilla/5.0 (Linux; Android 10; ${model}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.0.0 Safari/537.36`).device.vendor;
|
||||||
|
|
||||||
@ -37,26 +39,17 @@ const isAppleSilicon = (res) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isBot = (res) => ['cli', 'crawler', 'fetcher', 'module'].includes(res.browser.type);
|
||||||
|
|
||||||
const isChromeFamily = (res) => res.engine.is(Engine.BLINK);
|
const isChromeFamily = (res) => res.engine.is(Engine.BLINK);
|
||||||
|
|
||||||
const isElectron = () => !!(process?.versions?.hasOwnProperty('electron') || // node.js
|
const isElectron = () => !!(process?.versions?.hasOwnProperty('electron') || // node.js
|
||||||
/ electron\//i.test(navigator?.userAgent)); // browser
|
/ electron\//i.test(navigator?.userAgent)); // browser
|
||||||
|
|
||||||
const isFrozenUA = (ua) => /^Mozilla\/5\.0 \((Windows NT 10\.0; Win64; x64|Macintosh; Intel Mac OS X 10_15_7|X11; Linux x86_64|X11; CrOS x86_64 14541\.0\.0|Fuchsia|Linux; Android 10; K)\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/\d+\.0\.0\.0 (Mobile )?Safari\/537\.36/.test(ua);
|
|
||||||
|
|
||||||
const isStandalonePWA = () => window && (window.matchMedia('(display-mode: standalone)').matches ||
|
|
||||||
// iOS
|
|
||||||
navigator.standalone ||
|
|
||||||
// Android
|
|
||||||
document.referrer.startsWith('android-app://') ||
|
|
||||||
// Windows
|
|
||||||
window.Windows ||
|
|
||||||
/trident.+(msapphost|webview)\//i.test(navigator.userAgent) ||
|
|
||||||
document.referrer.startsWith('app-info://platform/microsoft-store'));
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getDeviceVendor,
|
getDeviceVendor,
|
||||||
isAppleSilicon,
|
isAppleSilicon,
|
||||||
|
isBot,
|
||||||
isChromeFamily,
|
isChromeFamily,
|
||||||
isElectron,
|
isElectron,
|
||||||
isFromEU,
|
isFromEU,
|
||||||
|
2
src/main/ua-parser.d.ts
vendored
2
src/main/ua-parser.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
// Type definitions for UAParser.js v2.0.0-beta.3
|
// Type definitions for UAParser.js v2.0.0-rc.2
|
||||||
// Project: https://github.com/faisalman/ua-parser-js
|
// Project: https://github.com/faisalman/ua-parser-js
|
||||||
// Definitions by: Faisal Salman <https://github.com/faisalman>
|
// Definitions by: Faisal Salman <https://github.com/faisalman>
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
/* UAParser.js v2.0.0-rc.1
|
/* UAParser.js v2.0.0-rc.2
|
||||||
Copyright © 2012-2024 Faisal Salman <f@faisalman.com>
|
Copyright © 2012-2024 Faisal Salman <f@faisalman.com>
|
||||||
AGPLv3 License *//*
|
AGPLv3 License *//*
|
||||||
Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
|
Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
|
||||||
@ -19,7 +19,7 @@
|
|||||||
// Constants
|
// Constants
|
||||||
/////////////
|
/////////////
|
||||||
|
|
||||||
var LIBVERSION = '2.0.0-rc.1',
|
var LIBVERSION = '2.0.0-rc.2',
|
||||||
EMPTY = '',
|
EMPTY = '',
|
||||||
UNKNOWN = '?',
|
UNKNOWN = '?',
|
||||||
FUNC_TYPE = 'function',
|
FUNC_TYPE = 'function',
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// Source: /src/main/ua-parser.js
|
// Source: /src/main/ua-parser.js
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
/* UAParser.js v2.0.0-rc.1
|
/* UAParser.js v2.0.0-rc.2
|
||||||
Copyright © 2012-2024 Faisal Salman <f@faisalman.com>
|
Copyright © 2012-2024 Faisal Salman <f@faisalman.com>
|
||||||
AGPLv3 License *//*
|
AGPLv3 License *//*
|
||||||
Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
|
Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
|
||||||
@ -21,7 +21,7 @@
|
|||||||
// Constants
|
// Constants
|
||||||
/////////////
|
/////////////
|
||||||
|
|
||||||
var LIBVERSION = '2.0.0-rc.1',
|
var LIBVERSION = '2.0.0-rc.2',
|
||||||
EMPTY = '',
|
EMPTY = '',
|
||||||
UNKNOWN = '?',
|
UNKNOWN = '?',
|
||||||
FUNC_TYPE = 'function',
|
FUNC_TYPE = 'function',
|
||||||
@ -42,6 +42,7 @@
|
|||||||
WEARABLE = 'wearable',
|
WEARABLE = 'wearable',
|
||||||
XR = 'xr',
|
XR = 'xr',
|
||||||
EMBEDDED = 'embedded',
|
EMBEDDED = 'embedded',
|
||||||
|
INAPP = 'inapp',
|
||||||
USER_AGENT = 'user-agent',
|
USER_AGENT = 'user-agent',
|
||||||
UA_MAX_LENGTH = 500,
|
UA_MAX_LENGTH = 500,
|
||||||
BRANDS = 'brands',
|
BRANDS = 'brands',
|
||||||
@ -322,17 +323,19 @@
|
|||||||
// Mixed
|
// Mixed
|
||||||
/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i // Baidu
|
/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i // Baidu
|
||||||
], [VERSION, [NAME, 'Baidu']], [
|
], [VERSION, [NAME, 'Baidu']], [
|
||||||
|
/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i // Maxthon
|
||||||
|
], [VERSION, [NAME, 'Maxthon']], [
|
||||||
/(kindle)\/([\w\.]+)/i, // Kindle
|
/(kindle)\/([\w\.]+)/i, // Kindle
|
||||||
/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,
|
/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,
|
||||||
// Lunascape/Maxthon/Netfront/Jasmine/Blazer/Sleipnir
|
// Lunascape/Maxthon/Netfront/Jasmine/Blazer/Sleipnir
|
||||||
// Trident based
|
// Trident based
|
||||||
/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i, // Avant/IEMobile/SlimBrowser
|
/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i, // Avant/IEMobile/SlimBrowser/SlimBoat/Slimjet
|
||||||
/(?:ms|\()(ie) ([\w\.]+)/i, // Internet Explorer
|
/(?:ms|\()(ie) ([\w\.]+)/i, // Internet Explorer
|
||||||
|
|
||||||
// Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
|
// Blink/Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
|
||||||
/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio)\/([-\w\.]+)/i,
|
/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,
|
||||||
// Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ//Vivaldi/DuckDuckGo/Klar/Helio
|
// Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ//Vivaldi/DuckDuckGo/Klar/Helio/Dragon
|
||||||
/(heytap|ovi)browser\/([\d\.]+)/i, // HeyTap/Ovi
|
/(heytap|ovi|115)browser\/([\d\.]+)/i, // HeyTap/Ovi/115
|
||||||
/(weibo)__([\d\.]+)/i // Weibo
|
/(weibo)__([\d\.]+)/i // Weibo
|
||||||
], [NAME, VERSION], [
|
], [NAME, VERSION], [
|
||||||
/quark(?:pc)?\/([-\w\.]+)/i // Quark
|
/quark(?:pc)?\/([-\w\.]+)/i // Quark
|
||||||
@ -369,31 +372,31 @@
|
|||||||
], [VERSION, [NAME, 'MIUI' + SUFFIX_BROWSER]], [
|
], [VERSION, [NAME, 'MIUI' + SUFFIX_BROWSER]], [
|
||||||
/fxios\/([\w\.-]+)/i // Firefox for iOS
|
/fxios\/([\w\.-]+)/i // Firefox for iOS
|
||||||
], [VERSION, [NAME, PREFIX_MOBILE + FIREFOX]], [
|
], [VERSION, [NAME, PREFIX_MOBILE + FIREFOX]], [
|
||||||
/\bqihu|(qi?ho?o?|360)browser/i // 360
|
/\bqihoobrowser\/?([\w\.]*)/i // 360
|
||||||
], [[NAME, '360' + SUFFIX_BROWSER]], [
|
], [VERSION, [NAME, '360']], [
|
||||||
/\b(qq)\/([\w\.]+)/i // QQ
|
/\b(qq)\/([\w\.]+)/i // QQ
|
||||||
], [[NAME, /(.+)/, '$1Browser'], VERSION], [
|
], [[NAME, /(.+)/, '$1Browser'], VERSION], [
|
||||||
/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i
|
/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i
|
||||||
], [[NAME, /(.+)/, '$1' + SUFFIX_BROWSER], VERSION], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser/PicoBrowser
|
], [[NAME, /(.+)/, '$1' + SUFFIX_BROWSER], VERSION], [ // Oculus/Sailfish/HuaweiBrowser/VivoBrowser/PicoBrowser
|
||||||
/samsungbrowser\/([\w\.]+)/i // Samsung Internet
|
/samsungbrowser\/([\w\.]+)/i // Samsung Internet
|
||||||
], [VERSION, [NAME, SAMSUNG + ' Internet']], [
|
], [VERSION, [NAME, SAMSUNG + ' Internet']], [
|
||||||
/(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
|
|
||||||
], [[NAME, /_/g, ' '], VERSION], [
|
|
||||||
/metasr[\/ ]?([\d\.]+)/i // Sogou Explorer
|
/metasr[\/ ]?([\d\.]+)/i // Sogou Explorer
|
||||||
], [VERSION, [NAME, SOGOU + ' Explorer']], [
|
], [VERSION, [NAME, SOGOU + ' Explorer']], [
|
||||||
/(sogou)mo\w+\/([\d\.]+)/i // Sogou Mobile
|
/(sogou)mo\w+\/([\d\.]+)/i // Sogou Mobile
|
||||||
], [[NAME, SOGOU + ' Mobile'], VERSION], [
|
], [[NAME, SOGOU + ' Mobile'], VERSION], [
|
||||||
/(electron)\/([\w\.]+) safari/i, // Electron-based App
|
/(electron)\/([\w\.]+) safari/i, // Electron-based App
|
||||||
/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, // Tesla
|
/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, // Tesla
|
||||||
/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i // QQBrowser/2345 Browser
|
/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i // QQ/2345
|
||||||
], [NAME, VERSION], [
|
], [NAME, VERSION], [
|
||||||
/(lbbrowser|rekonq)/i, // LieBao Browser/Rekonq
|
/(lbbrowser|rekonq)/i // LieBao Browser/Rekonq
|
||||||
/\[(linkedin)app\]/i // LinkedIn App for iOS & Android
|
|
||||||
], [NAME], [
|
], [NAME], [
|
||||||
|
/ome\/([\w\.]+) \w* ?(iron) saf/i, // Iron
|
||||||
|
/ome\/([\w\.]+).+qihu (360)[es]e/i // 360
|
||||||
|
], [VERSION, NAME], [
|
||||||
|
|
||||||
// WebView
|
// WebView
|
||||||
/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android
|
/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android
|
||||||
], [[NAME, FACEBOOK], VERSION], [
|
], [[NAME, FACEBOOK], VERSION, [TYPE, INAPP]], [
|
||||||
/(Klarna)\/([\w\.]+)/i, // Klarna Shopping Browser for iOS & Android
|
/(Klarna)\/([\w\.]+)/i, // Klarna Shopping Browser for iOS & Android
|
||||||
/(kakao(?:talk|story))[\/ ]([\w\.]+)/i, // Kakao App
|
/(kakao(?:talk|story))[\/ ]([\w\.]+)/i, // Kakao App
|
||||||
/(naver)\(.*?(\d+\.[\w\.]+).*\)/i, // Naver InApp
|
/(naver)\(.*?(\d+\.[\w\.]+).*\)/i, // Naver InApp
|
||||||
@ -401,12 +404,17 @@
|
|||||||
/\b(line)\/([\w\.]+)\/iab/i, // Line App for Android
|
/\b(line)\/([\w\.]+)\/iab/i, // Line App for Android
|
||||||
/(alipay)client\/([\w\.]+)/i, // Alipay
|
/(alipay)client\/([\w\.]+)/i, // Alipay
|
||||||
/(twitter)(?:and| f.+e\/([\w\.]+))/i, // Twitter
|
/(twitter)(?:and| f.+e\/([\w\.]+))/i, // Twitter
|
||||||
/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i // Chromium/Instagram/Snapchat
|
/(instagram|snapchat)[\/ ]([-\w\.]+)/i // Instagram/Snapchat
|
||||||
], [NAME, VERSION], [
|
], [NAME, VERSION, [TYPE, INAPP]], [
|
||||||
/\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS
|
/\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS
|
||||||
], [VERSION, [NAME, 'GSA']], [
|
], [VERSION, [NAME, 'GSA'], [TYPE, INAPP]], [
|
||||||
/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i // TikTok
|
/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i // TikTok
|
||||||
], [VERSION, [NAME, 'TikTok']], [
|
], [VERSION, [NAME, 'TikTok'], [TYPE, INAPP]], [
|
||||||
|
/\[(linkedin)app\]/i // LinkedIn App for iOS & Android
|
||||||
|
], [NAME, [TYPE, INAPP]], [
|
||||||
|
|
||||||
|
/(chromium)[\/ ]([-\w\.]+)/i // Chromium
|
||||||
|
], [NAME, VERSION], [
|
||||||
|
|
||||||
/headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless
|
/headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless
|
||||||
], [VERSION, [NAME, CHROME+' Headless']], [
|
], [VERSION, [NAME, CHROME+' Headless']], [
|
||||||
@ -440,7 +448,7 @@
|
|||||||
], [[NAME, PREFIX_MOBILE + FIREFOX], VERSION], [
|
], [[NAME, PREFIX_MOBILE + FIREFOX], VERSION], [
|
||||||
/(navigator|netscape\d?)\/([-\w\.]+)/i // Netscape
|
/(navigator|netscape\d?)\/([-\w\.]+)/i // Netscape
|
||||||
], [[NAME, 'Netscape'], VERSION], [
|
], [[NAME, 'Netscape'], VERSION], [
|
||||||
/(wolvic)\/([\w\.]+)/i // Wolvic
|
/(wolvic|librewolf)\/([\w\.]+)/i // Wolvic/LibreWolf
|
||||||
], [NAME, VERSION], [
|
], [NAME, VERSION], [
|
||||||
/mobile vr; rv:([\w\.]+)\).+firefox/i // Firefox Reality
|
/mobile vr; rv:([\w\.]+)\).+firefox/i // Firefox Reality
|
||||||
], [VERSION, [NAME, FIREFOX+' Reality']], [
|
], [VERSION, [NAME, FIREFOX+' Reality']], [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user