Update version to 2.0.0-rc.3

This commit is contained in:
Faisal Salman 2024-11-13 10:44:38 +07:00
parent 84c4613145
commit ee51caf422
17 changed files with 213 additions and 124 deletions

View File

@ -1,5 +1,6 @@
# UAParser.js Changelog # UAParser.js Changelog
# Version 2.0
## Migrating from v1 to v2 ## Migrating from v1 to v2
- What's breaking: - What's breaking:
@ -8,28 +9,38 @@
- OS detection: `"Mac OS" => "macOS"`, `"Chromium OS" => "Chrome OS"` - OS detection: `"Mac OS" => "macOS"`, `"Chromium OS" => "Chrome OS"`
- What's new: - What's new:
- New device type: `xr`, to identify AR/VR devices - 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 browser property: `browser.type`, to identify the type of the browser: `crawler`, `cli`, `email`, `fetcher`, `inapp`, `library`, `mediaplayer`
- New methods in result object (all of `get*()` return value): - New methods in result object (all of `get*()` return value):
- Support for client hints: `withClientHints()` - Enhance detection using client hints: `withClientHints()`
- Support for feature detection: `withFeatureCheck()` - Enhance detection using feature check: `withFeatureCheck()`
- Utility for easy comparison: `is()` - Utility for easy comparison: `is()`
- Utility to print full-name: `toString()` - Utility to print full-name: `toString()`
- Parse directly from command line using `npx ua-parser-js` - Parse user-agent directly from command line using `npx ua-parser-js "[User-Agent]"`
- Extensions can be passed as a list to `UAParser()` - Extensions can be passed as a list to `UAParser()`
- Support for ES module & TypeScript `import { UAParser } from 'ua-parser-js'` - Support for ES module & TypeScript `import { UAParser } from 'ua-parser-js'`
- Provided Enums submodule `'ua-parser-js/enums'` - Provided Enums submodule `'ua-parser-js/enums'`
- Provided Extensions submodule `'ua-parser-js/extensions'` - Provided Extensions submodule `'ua-parser-js/extensions'`
- Provided Helpers submodule `'ua-parser-js/helpers'`: - Provided Helpers submodule `'ua-parser-js/helpers'`:
- `getDeviceVendor()` to guess for a device vendor based on its model name - `getDeviceVendor()`: guess for a device vendor based on its model name
- `isAppleSilicon()` to check if the device has Apple Silicon Mac device properties - `isAppleSilicon()`: check if the device has Apple Silicon Mac device properties
- `isBot()` to check if the browser is identified as a bot - `isBot()`: 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.) - `isChromeFamily()`: 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 - `isElectron()`: check if current window is running inside Electron
- `isFromEU()` to check if current window is from an EU (European Union) country - `isFromEU()`: 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 - `isFrozenUA()`: check if a user-agent string match with the reduced/frozen user-agent pattern
- `isStandalonePWA()` to check if current window is a standalone PWA - `isStandalonePWA()`: check if current window is a standalone PWA
-- ---
## Version 2.0.0-rc.3
- Add support for Headers object
- Add new device: Advan, Cat, Energizer, Honor, IMO, Micromax, Smartfren
- Add new engine: Servo
- `ua-parser-js/extensions` submodule:
- Breaking change: rename `module` to `library`
- Add new email clients: Evolution, KMail, Kontact
- Add new bots: 360Spider, Archive.org Bots, CCBot, DataForSeoBot, DuckAssistBot, Exabot, Google Bots, Meta Bots, MojeekBot, PerplexityBot, PetalBot, TurnitinBot, Yeti, YisouSpider
## Version 2.0.0-rc.2 ## Version 2.0.0-rc.2
@ -59,7 +70,7 @@
- Rename `isChromiumBased()` to `isChromeFamily()` - Rename `isChromiumBased()` to `isChromeFamily()`
- Update `isAppleSilicon()` to also checks for WebGL renderer info - Update `isAppleSilicon()` to also checks for WebGL renderer info
- `ua-parser-js/extensions` submodule: - `ua-parser-js/extensions` submodule:
- Restore `bots` as a compilation of all these browser types: `clis`, `crawlers`, `fetchers`, and `modules` - Restore `Bots` as a compilation of all these browser types: `cli`, `crawler`, `fetcher`, and `library`
## Version 2.0.0-beta.3 ## Version 2.0.0-beta.3

View File

@ -44,15 +44,15 @@ see what's new & breaking.
<tbody> <tbody>
<tr> <tr>
<td>License options</td> <td>License options</td>
<td>MIT (v1.x)</td> <td>MIT (v0.7~v1.0)</td>
<td>AGPL (v2.x)</td> <td>AGPL (&gt;=v2.0)</td>
<td>PRO Personal</td> <td>PRO Personal</td>
<td>PRO Business</td> <td>PRO Business</td>
<td>PRO Enterprise</td> <td>PRO Enterprise</td>
</tr> </tr>
<tr> <tr>
<td>Browser detection</td> <td>Browser detection</td>
<td><strong title="Basic detection">⚠️</strong></td> <td><a href="#demo" title="Basic detection">⚠️</a></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
@ -60,7 +60,7 @@ see what's new & breaking.
</tr> </tr>
<tr> <tr>
<td>CPU detection</td> <td>CPU detection</td>
<td><strong title="Basic detection">⚠️</strong></td> <td><a href="#demo" title="Basic detection">⚠️</a></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
@ -68,7 +68,7 @@ see what's new & breaking.
</tr> </tr>
<tr> <tr>
<td>Device detection</td> <td>Device detection</td>
<td><strong title="Basic detection">⚠️</strong></td> <td><a href="#demo" title="Basic detection">⚠️</a></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
@ -76,7 +76,7 @@ see what's new & breaking.
</tr> </tr>
<tr> <tr>
<td>Engine detection</td> <td>Engine detection</td>
<td><strong title="Basic detection">⚠️</strong></td> <td><a href="#demo" title="Basic detection">⚠️</a></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
@ -84,15 +84,31 @@ see what's new & breaking.
</tr> </tr>
<tr> <tr>
<td>OS detection</td> <td>OS detection</td>
<td><strong title="Basic detection">⚠️</strong></td> <td><a href="#demo" title="Basic detection">⚠️</a></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Enhanced detection</td> <td>Bot detection</td>
<td>⛔️</td> <td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Extras (Apps, Libs, Emails, Media Players, etc)</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Enhanced detection result</td>
<td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
@ -100,15 +116,7 @@ see what's new & breaking.
</tr> </tr>
<tr> <tr>
<td>Client Hints support</td> <td>Client Hints support</td>
<td>⛔️</td> <td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Extras (Apps, Bots, Libs, Emails, Media Players, etc)</td>
<td>⛔️</td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
@ -124,14 +132,14 @@ see what's new & breaking.
</tr> </tr>
<tr> <tr>
<td>ES modules support</td> <td>ES modules support</td>
<td>⛔️</td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>npm module available</td> <td>npm module</td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
@ -139,25 +147,25 @@ see what's new & breaking.
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>TypeScript declarations available</td> <td>TypeScript declarations</td>
<td><strong title="Community version">⚠️</strong></td> <td><a href="#demo" title="Community version">⚠️</a></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Allowed for commercial use</td> <td>Allows commercial use</td>
<td></td> <td></td>
<td></td> <td></td>
<td>⛔️</td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>Permissive (non-copyleft) license</td> <td>Permissive (non-copyleft) license</td>
<td></td> <td></td>
<td><strong title="Copyleft license">⛔️</strong></td> <td><strong title="Copyleft license"></strong></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
@ -167,13 +175,13 @@ see what's new & breaking.
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td><strong title="1 project per 1 license">⛔️</strong></td> <td><strong title="1 project per 1 license"></strong></td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>1-year support</td> <td>1-year product support</td>
<td>⛔️</td> <td></td>
<td>⛔️</td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
@ -192,13 +200,13 @@ see what's new & breaking.
<td><strong title="Pay as you want">FREE (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/master/LICENSE.md">License</a>)</strong></td> <td><strong title="Pay as you want">FREE (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/master/LICENSE.md">License</a>)</strong></td>
<td><strong title="$14 (one-time fee)">$14 (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/pro-personal/LICENSE.md">License</a>)</strong></td> <td><strong title="$14 (one-time fee)">$14 (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/pro-personal/LICENSE.md">License</a>)</strong></td>
<td><strong title="$29 (one-time fee)">$29 (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/pro-business/LICENSE.md">License</a>)</strong></td> <td><strong title="$29 (one-time fee)">$29 (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/pro-business/LICENSE.md">License</a>)</strong></td>
<td><strong title="$588 (one-time fee)">$588 (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/pro-enterprise/LICENSE.md">License</a>)</strong></td> <td><strong title="$599 (one-time fee)">$599 (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/pro-enterprise/LICENSE.md">License</a>)</strong></td>
</tr> </tr>
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<th align="right" colspan="6"> <th align="right" colspan="6">
<a target="_blank" href="https://store.faisalman.com/checkout/buy/e236ea87-9b2b-400e-9683-24367f731b35"> GET THE PRO PACKAGES 📥</a> <h3><a target="_blank" href="https://store.faisalman.com/checkout/buy/e236ea87-9b2b-400e-9683-24367f731b35"> GET THE PRO PACKAGES 📥</a></h3>
</th> </th>
</tr> </tr>
</tfoot> </tfoot>
@ -221,4 +229,4 @@ Made with [contributors-img](https://contrib.rocks).
<a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/organizations.svg?avatarHeight=64"></a> <a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/organizations.svg?avatarHeight=64"></a>
<a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/individuals.svg?avatarHeight=64"></a> <a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/individuals.svg?avatarHeight=64"></a>
Support the open-source versions of UAParser.js on [OpenCollective](https://opencollective.com/ua-parser-js) or [GitHub Sponsors](https://github.com/sponsors/faisalman). Support the open-source editions of UAParser.js on [OpenCollective](https://opencollective.com/ua-parser-js) or [GitHub Sponsors](https://github.com/sponsors/faisalman).

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

28
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "2.0.0-rc.2", "version": "2.0.0-rc.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "2.0.0-rc.2", "version": "2.0.0-rc.3",
"funding": [ "funding": [
{ {
"type": "opencollective", "type": "opencollective",
@ -23,9 +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.2",
"is-standalone-pwa": "^0.1.0", "is-standalone-pwa": "^0.1.1",
"ua-is-frozen": "^0.1.1" "ua-is-frozen": "^0.1.2"
}, },
"bin": { "bin": {
"ua-parser-js": "script/cli.js" "ua-parser-js": "script/cli.js"
@ -1670,9 +1670,9 @@
"dev": true "dev": true
}, },
"node_modules/detect-europe-js": { "node_modules/detect-europe-js": {
"version": "0.1.1", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/detect-europe-js/-/detect-europe-js-0.1.1.tgz", "resolved": "https://registry.npmjs.org/detect-europe-js/-/detect-europe-js-0.1.2.tgz",
"integrity": "sha512-+bUXDf+tI3L4dcEuRdAFa44Amx9aEaJzoZssx7Xis4H1bXWc5fAcOP850BOj0wJPRzOdovOuOVEvrg6T+GflZA==", "integrity": "sha512-lgdERlL3u0aUdHocoouzT10d9I89VVhk0qNRmll7mXdGfJT1/wqZ2ZLA4oJAjeACPY5fT1wsbq2AT+GkuInsow==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@ -2612,9 +2612,9 @@
} }
}, },
"node_modules/is-standalone-pwa": { "node_modules/is-standalone-pwa": {
"version": "0.1.0", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/is-standalone-pwa/-/is-standalone-pwa-0.1.0.tgz", "resolved": "https://registry.npmjs.org/is-standalone-pwa/-/is-standalone-pwa-0.1.1.tgz",
"integrity": "sha512-n5SQqXd0/JEkrKYEB7ZUndwuS7NKskZvk6rZZt6kTE1jiPxtPfPvVhXkfteIKpUfcEP07qsja/Wjz9NDjiZ5gg==", "integrity": "sha512-9Cbovsa52vNQCjdXOzeQq5CnCbAcRk05aU62K20WO372NrTv0NxibLFCK6lQ4/iZEFdEA3p3t2VNOn8AJ53F5g==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@ -4619,9 +4619,9 @@
} }
}, },
"node_modules/ua-is-frozen": { "node_modules/ua-is-frozen": {
"version": "0.1.1", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/ua-is-frozen/-/ua-is-frozen-0.1.1.tgz", "resolved": "https://registry.npmjs.org/ua-is-frozen/-/ua-is-frozen-0.1.2.tgz",
"integrity": "sha512-TxhyfblPzcDJXRXu/j+73OI6s1jG6PUZBF/8hjTHoAsjZYKl9IhZzLQlnZHFLe5U2mvL1lMOOmcy647KpUq25A==", "integrity": "sha512-RwKDW2p3iyWn4UbaxpP2+VxwqXh0jpvdxsYpZ5j/MLLiQOfbsV5shpgQiw93+KMYQPcteeMQ289MaAFzs3G9pw==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",

View File

@ -1,7 +1,7 @@
{ {
"title": "UAParser.js", "title": "UAParser.js",
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "2.0.0-rc.2", "version": "2.0.0-rc.3",
"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": [
@ -211,9 +211,9 @@
"test:playwright": "playwright test" "test:playwright": "playwright test"
}, },
"dependencies": { "dependencies": {
"detect-europe-js": "^0.1.1", "detect-europe-js": "^0.1.2",
"is-standalone-pwa": "^0.1.0", "is-standalone-pwa": "^0.1.1",
"ua-is-frozen": "^0.1.1" "ua-is-frozen": "^0.1.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/parser": "7.15.8", "@babel/parser": "7.15.8",

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////// ///////////////////////////////////////////////
/* Enums for UAParser.js v2.0.0-rc.2 /* Enums for UAParser.js v2.0.0-rc.3
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 */

View File

@ -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.2 /* Enums for UAParser.js v2.0.0-rc.3
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 */
@ -59,6 +59,7 @@ const Browser = Object.freeze({
GOOGLE_SEARCH: 'GSA', GOOGLE_SEARCH: 'GSA',
HELIO: 'Helio', HELIO: 'Helio',
HEYTAP: 'HeyTap', HEYTAP: 'HeyTap',
HONOR: 'Honor',
HUAWEI: 'Huawei Browser', HUAWEI: 'Huawei Browser',
ICAB: 'iCab', ICAB: 'iCab',
ICE: 'ICE Browser', ICE: 'ICE Browser',
@ -162,7 +163,7 @@ const BrowserType = Object.freeze({
FETCHER: 'fetcher', FETCHER: 'fetcher',
INAPP: 'inapp', INAPP: 'inapp',
MEDIAPLAYER: 'mediaplayer', MEDIAPLAYER: 'mediaplayer',
MODULE: 'module' LIBRARY: 'library'
}); });
const CPU = Object.freeze({ const CPU = Object.freeze({
@ -198,6 +199,7 @@ const Device = Object.freeze({
const Vendor = Object.freeze({ const Vendor = Object.freeze({
ACER: 'Acer', ACER: 'Acer',
ADVAN: 'Advan',
ALCATEL: 'Alcatel', ALCATEL: 'Alcatel',
APPLE: 'Apple', APPLE: 'Apple',
AMAZON: 'Amazon', AMAZON: 'Amazon',
@ -206,7 +208,9 @@ const Vendor = Object.freeze({
ATT: 'AT&T', ATT: 'AT&T',
BENQ: 'BenQ', BENQ: 'BenQ',
BLACKBERRY: 'BlackBerry', BLACKBERRY: 'BlackBerry',
CAT: 'Cat',
DELL: 'Dell', DELL: 'Dell',
ENERGIZER: 'Energizer',
ESSENTIAL: 'Essential', ESSENTIAL: 'Essential',
FACEBOOK: 'Facebook', FACEBOOK: 'Facebook',
FAIRPHONE: 'Fairphone', FAIRPHONE: 'Fairphone',
@ -216,6 +220,7 @@ const Vendor = Object.freeze({
HP: 'HP', HP: 'HP',
HTC: 'HTC', HTC: 'HTC',
HUAWEI: 'Huawei', HUAWEI: 'Huawei',
IMO: 'IMO',
INFINIX: 'Infinix', INFINIX: 'Infinix',
ITEL: 'itel', ITEL: 'itel',
JOLLA: 'Jolla', JOLLA: 'Jolla',
@ -223,6 +228,7 @@ const Vendor = Object.freeze({
LENOVO: 'Lenovo', LENOVO: 'Lenovo',
LG: 'LG', LG: 'LG',
MEIZU: 'Meizu', MEIZU: 'Meizu',
MICROMAX: 'Micromax',
MICROSOFT: 'Microsoft', MICROSOFT: 'Microsoft',
MOTOROLA: 'Motorola', MOTOROLA: 'Motorola',
NEXIAN: 'Nexian', NEXIAN: 'Nexian',
@ -244,6 +250,7 @@ const Vendor = Object.freeze({
SAMSUNG: 'Samsung', SAMSUNG: 'Samsung',
SHARP: 'Sharp', SHARP: 'Sharp',
SIEMENS: 'Siemens', SIEMENS: 'Siemens',
SMARTFREN: 'Smartfren',
SONY: 'Sony', SONY: 'Sony',
SPRINT: 'Sprint', SPRINT: 'Sprint',
TCL: 'TCL', TCL: 'TCL',
@ -277,6 +284,7 @@ const Engine = Object.freeze({
NETFRONT: 'NetFront', NETFRONT: 'NetFront',
NETSURF: 'NetSurf', NETSURF: 'NetSurf',
PRESTO: 'Presto', PRESTO: 'Presto',
SERVO: 'Servo',
TASMAN: 'Tasman', TASMAN: 'Tasman',
TRIDENT: 'Trident', TRIDENT: 'Trident',
W3M: 'w3m', W3M: 'w3m',

View File

@ -1,4 +1,4 @@
// Type definitions for Helpers submodule of UAParser.js v2.0.0-rc.2 // Type definitions for Helpers submodule of UAParser.js v2.0.0-rc.3
// 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>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////// ///////////////////////////////////////////////
/* Extensions for UAParser.js v2.0.0-rc.2 /* Extensions for UAParser.js v2.0.0-rc.3
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 */

View File

@ -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.2 /* Extensions for UAParser.js v2.0.0-rc.3
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 */
@ -24,7 +24,7 @@ const EMAIL = 'email';
const FETCHER = 'fetcher'; const FETCHER = 'fetcher';
const INAPP = 'inapp'; const INAPP = 'inapp';
const MEDIAPLAYER = 'mediaplayer'; const MEDIAPLAYER = 'mediaplayer';
const MODULE = 'module'; const LIBRARY = 'library';
////////////////////// //////////////////////
// COMMAND LINE APPS // COMMAND LINE APPS
@ -48,26 +48,36 @@ const Crawlers = Object.freeze({
// Amazonbot - https://developer.amazon.com/amazonbot // Amazonbot - https://developer.amazon.com/amazonbot
// Applebot - http://apple.com/go/applebot // Applebot - http://apple.com/go/applebot
// Bingbot - http://www.bing.com/bingbot.htm // Bingbot - http://www.bing.com/bingbot.htm
// CCBot - https://commoncrawl.org/faq
// Dotbot - https://moz.com/help/moz-procedures/crawlers/dotbot // Dotbot - https://moz.com/help/moz-procedures/crawlers/dotbot
// DuckDuckBot - http://duckduckgo.com/duckduckbot.html // DuckDuckBot - http://duckduckgo.com/duckduckbot.html
// FacebookBot - https://developers.facebook.com/docs/sharing/bot/ // FacebookBot - https://developers.facebook.com/docs/sharing/bot/
// GPTBot - https://platform.openai.com/docs/gptbot // GPTBot - https://platform.openai.com/docs/gptbot
// MJ12bot - https://mj12bot.com/ // MJ12bot - https://mj12bot.com/
// OpenAI Search - https://platform.openai.com/docs/bots // MojeekBot - https://www.mojeek.com/bot.html
// OpenAI's SearchGPT - https://platform.openai.com/docs/bots
// PerplexityBot - https://perplexity.ai/perplexitybot
// SemrushBot - http://www.semrush.com/bot.html // SemrushBot - http://www.semrush.com/bot.html
/((?:ahrefs|amazon|apple|bing|dot|duckduck|facebook|gpt|mj12|oai-search|semrush)bot)\/([\w\.]+)/i, /((?:ahrefs|amazon|apple|bing|cc|dot|duckduck|exa|facebook|gpt|mj12|mojeek|oai-search|perplexity|semrush)bot)\/([\w\.]+)/i,
// Baiduspider https://help.baidu.com/question?prod_id=99&class=0&id=3001 // Baiduspider https://help.baidu.com/question?prod_id=99&class=0&id=3001
/(baiduspider)[-imagevdonsfcpr]{0,6}\/([\w\.]+)/i, /(baiduspider)[-imagevdonsfcpr]{0,6}\/([\w\.]+)/i,
// ClaudeBot // ClaudeBot (Anthropic)
/(claude(?:bot|-web))\/([\w\.]+)/i, /(claude(?:bot|-web))\/([\w\.]+)/i,
// Coc Coc Bot - https://help.coccoc.com/en/search-engine // Coc Coc Bot - https://help.coccoc.com/en/search-engine
/(coccocbot-(?:image|web))\/([\w\.]+)/i, /(coccocbot-(?:image|web))\/([\w\.]+)/i,
// Facebook / Meta
// https://developers.facebook.com/docs/sharing/webmasters/web-crawlers
/(facebook(?:externalhit|catalog)|meta-externalagent)\/([\w\.]+)/i,
// Googlebot - http://www.google.com/bot.html // Googlebot - http://www.google.com/bot.html
/(google(?:bot|other)(?:-image|-video|-news|-extended)?|(?:storebot-)?google(?:-inspectiontool)?)\/?([\w\.]*)/i, /(google(?:bot|other|-inspectiontool)(?:-image|-video|-news)?|storebot-google)\/?([\w\.]*)/i,
// Internet Archive (archive.org)
/(ia_archiver|archive\.org_bot)\/?([\w\.]*)/i,
// Sogou Spider // Sogou Spider
/(sogou (?:pic|head|web|orion|news) spider)\/([\w\.]+)/i, /(sogou (?:pic|head|web|orion|news) spider)\/([\w\.]+)/i,
@ -76,14 +86,29 @@ const Crawlers = Object.freeze({
/(y!?j-(?:asr|br[uw]|dscv|mmp|vsidx|wsc))\/([\w\.]+)/i, /(y!?j-(?:asr|br[uw]|dscv|mmp|vsidx|wsc))\/([\w\.]+)/i,
// Yandex Bots - https://yandex.com/bots // Yandex Bots - https://yandex.com/bots
/(yandex(?:(?:mobile)?(?:accessibility|additional|renderresources|screenshot|sprav)?bot|image(?:s|resizer)|video(?:parser)?|blogs|adnet|favicons|fordomain|market|media|metrika|news|ontodb(?:api)?|pagechecker|partner|rca|tracker|turbo|vertis|webmaster|antivirus))\/([\w\.]+)/i /(yandex(?:(?:mobile)?(?:accessibility|additional|renderresources|screenshot|sprav)?bot|image(?:s|resizer)|video(?:parser)?|blogs|adnet|favicons|fordomain|market|media|metrika|news|ontodb(?:api)?|pagechecker|partner|rca|tracker|turbo|vertis|webmaster|antivirus))\/([\w\.]+)/i,
// Yeti (Naver)
/(yeti)\/([\w\.]+)/i,
// YisouSpider
/(yisouspider)\/?([\w\.]*)/i
], ],
[NAME, VERSION, [TYPE, CRAWLER]], [NAME, VERSION, [TYPE, CRAWLER]],
// Bytespider [
// Yahoo! Slurp - http://help.yahoo.com/help/us/ysearch/slurp // Google Bots
[/((?:bytespider|(?=yahoo! )slurp))/i], /((?:adsbot|apis|mediapartners)-google(?:-mobile)?|google-?(?:other|cloudvertexbot|extended|safety))/i,
// Bytespider
// DataForSeoBot - https://dataforseo.com/dataforseo-bot
// Huawei AspiegelBot / PetalBot https://aspiegel.com/petalbot
// Qihoo 360Spider
// TurnitinBot - https://www.turnitin.com/robot/crawlerinfo.html
// Yahoo! Slurp - http://help.yahoo.com/help/us/ysearch/slurp
/(360spider-?(?:image|video)?|bytespider|(?:aspiegel|dataforseo|petal|turnitin)bot|(?=yahoo! )slurp)/i
],
[NAME, [TYPE, CRAWLER]] [NAME, [TYPE, CRAWLER]]
] ]
}); });
@ -174,8 +199,8 @@ const ExtraDevices = Object.freeze({
const Emails = Object.freeze({ const Emails = Object.freeze({
browser : [ browser : [
// Microsoft Outlook / Thunderbird // Evolution / Kontact/KMail / [Microsoft/Mac] Outlook / Thunderbird
[/(microsoft outlook|thunderbird)[\s\/]([\w\.]+)/i], [NAME, VERSION, [TYPE, EMAIL]] [/(evolution|kmail2?|kontact|(?:microsoft |mac)outlook|thunderbird)[\s\/]([\w\.]+)/i], [NAME, VERSION, [TYPE, EMAIL]]
] ]
}); });
@ -188,8 +213,15 @@ const Fetchers = Object.freeze({
[ [
// AhrefsSiteAudit - https://ahrefs.com/robot/site-audit // AhrefsSiteAudit - https://ahrefs.com/robot/site-audit
// ChatGPT-User - https://platform.openai.com/docs/plugins/bot // ChatGPT-User - https://platform.openai.com/docs/plugins/bot
// DuckAssistBot - https://duckduckgo.com/duckassistbot/
// BingPreview / Mastodon / Pinterestbot / Redditbot / Rogerbot / Telegrambot / Twitterbot / UptimeRobot // BingPreview / Mastodon / Pinterestbot / Redditbot / Rogerbot / Telegrambot / Twitterbot / UptimeRobot
/(ahrefssiteaudit|bingpreview|chatgpt-user|mastodon|(?:discord|linkedin|pinterest|reddit|roger|telegram|twitter|uptimero)bot)\/([\w\.]+)/i, /(ahrefssiteaudit|bingpreview|chatgpt-user|mastodon|(?:discord|duckassist|linkedin|pinterest|reddit|roger|telegram|twitter|uptimero)bot)\/([\w\.]+)/i,
// Google Site Verifier
/(google-site-verification)\/([\w\.]+)/i,
// Meta
/(meta-externalfetcher)\/([\w\.]+)/i,
// Slackbot - https://api.slack.com/robots // Slackbot - https://api.slack.com/robots
/(slack(?:bot)?(?:-imgproxy|-linkexpanding)?) ([\w\.]+)/i, /(slack(?:bot)?(?:-imgproxy|-linkexpanding)?) ([\w\.]+)/i,
@ -207,7 +239,7 @@ const Fetchers = Object.freeze({
[NAME, VERSION, [TYPE, FETCHER]], [NAME, VERSION, [TYPE, FETCHER]],
// Google Bots / Snapchat // Google Bots / Snapchat
[/(feedfetcher-google|google-read-aloud|(?=bot; )snapchat)/i], [/(feedfetcher-google|google(?:-read-aloud|producer)|(?=bot; )snapchat)/i],
[NAME, [TYPE, FETCHER]], [NAME, [TYPE, FETCHER]],
] ]
}); });
@ -256,8 +288,8 @@ const MediaPlayers = Object.freeze({
/(flrp)\/([\w\.-]+)/i // Flip Player /(flrp)\/([\w\.-]+)/i // Flip Player
], [[NAME, 'Flip Player'], VERSION, [TYPE, MEDIAPLAYER]], [ ], [[NAME, 'Flip Player'], VERSION, [TYPE, MEDIAPLAYER]], [
/(fstream|nativehost|queryseekspider|ia-archiver|facebookexternalhit)/i /(fstream|nativehost|queryseekspider)/i
// FStream/NativeHost/QuerySeekSpider/IA Archiver/facebookexternalhit // FStream/NativeHost/QuerySeekSpider
], [NAME, [TYPE, MEDIAPLAYER]], [ ], [NAME, [TYPE, MEDIAPLAYER]], [
/(gstreamer) souphttpsrc.+libsoup\/([\w\.-]+)/i /(gstreamer) souphttpsrc.+libsoup\/([\w\.-]+)/i
@ -336,14 +368,14 @@ const MediaPlayers = Object.freeze({
] ]
}); });
//////////////////////// /////////////
// MODULES / LIBRARIES // LIBRARIES
/////////////////////// //////////////
const Modules = Object.freeze({ const Libraries = Object.freeze({
browser : [ browser : [
// Axios/jsdom/Scrapy // Axios/jsdom/Scrapy
[/\b(axios|jsdom|scrapy)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, MODULE]] [/\b(axios|jsdom|scrapy)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, LIBRARY]]
] ]
}); });
@ -356,7 +388,7 @@ const Bots = Object.freeze({
...CLIs.browser, ...CLIs.browser,
...Crawlers.browser, ...Crawlers.browser,
...Fetchers.browser, ...Fetchers.browser,
...Modules.browser ...Libraries.browser
] ]
}); });
@ -368,6 +400,6 @@ export {
Emails, Emails,
Fetchers, Fetchers,
InApps, InApps,
MediaPlayers, Libraries,
Modules MediaPlayers
}; };

View File

@ -1,4 +1,4 @@
// Type definitions for Helpers submodule of UAParser.js v2.0.0-rc.2 // Type definitions for Helpers submodule of UAParser.js v2.0.0-rc.3
// 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>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////// ///////////////////////////////////////////////
/* Helpers for UAParser.js v2.0.0-rc.2 /* Helpers for UAParser.js v2.0.0-rc.3
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 */

View File

@ -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.2 /* Helpers for UAParser.js v2.0.0-rc.3
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 */
@ -19,27 +19,29 @@ 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;
const isAppleSilicon = (res) => { const isAppleSilicon = (res, useFeatureDetection) => {
if (res.os.is(OS.MACOS)) { if (res.os.is(OS.MACOS)) {
if (res.cpu.is(CPU.ARM)) { if (res.cpu.is(CPU.ARM)) {
return true; return true;
} }
try { if (useFeatureDetection) {
const canvas = document.createElement('canvas'); try {
const webgl = canvas.getContext('webgl2') || canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); const canvas = document.createElement('canvas');
const debug = webgl.getExtension('WEBGL_debug_renderer_info'); const webgl = canvas.getContext('webgl2') || canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
const renderer = webgl.getParameter(debug.UNMASKED_RENDERER_WEBGL); const debug = webgl.getExtension('WEBGL_debug_renderer_info');
if (renderer.match(/apple m\d/i)) { const renderer = webgl.getParameter(debug.UNMASKED_RENDERER_WEBGL);
return true; if (renderer.match(/apple m\d/i)) {
return true;
}
} catch {
return false;
} }
} catch {
return false;
} }
} }
return false; return false;
} }
const isBot = (res) => ['cli', 'crawler', 'fetcher', 'module'].includes(res.browser.type); const isBot = (res) => ['cli', 'crawler', 'fetcher', 'library'].includes(res.browser.type);
const isChromeFamily = (res) => res.engine.is(Engine.BLINK); const isChromeFamily = (res) => res.engine.is(Engine.BLINK);

View File

@ -1,4 +1,4 @@
// Type definitions for UAParser.js v2.0.0-rc.2 // Type definitions for UAParser.js v2.0.0-rc.3
// 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>
@ -19,7 +19,7 @@ declare namespace UAParser {
} }
interface ICPU extends IData<ICPU> { interface ICPU extends IData<ICPU> {
architecture?: 'ia32' | 'ia64' | 'amd64' | 'arm' | 'arm64' | 'armhf' | 'avr' | 'irix' | 'irix64' | 'mips' | 'mips64' | '68k' | 'ppc' | 'sparc' | 'sparc64'; architecture?: 'ia32' | 'ia64' | 'amd64' | 'arm' | 'arm64' | 'armhf' | 'avr' | 'avr32' | 'irix' | 'irix64' | 'mips' | 'mips64' | '68k' | 'pa-risc' | 'ppc' | 'sparc' | 'sparc64';
} }
interface IDevice extends IData<IDevice> { interface IDevice extends IData<IDevice> {
@ -29,7 +29,7 @@ declare namespace UAParser {
} }
interface IEngine extends IData<IEngine> { interface IEngine extends IData<IEngine> {
name?: 'Amaya' | 'Blink' | 'EdgeHTML' | 'Flow' | 'Gecko' | 'Goanna' | 'iCab' | 'KHTML' | 'LibWeb' | 'Links' | 'Lynx' | 'NetFront' | 'NetSurf' | 'Presto' | 'Tasman' | 'Trident' | 'w3m' | 'WebKit'; name?: 'Amaya' | 'ArkWeb' | 'Blink' | 'EdgeHTML' | 'Flow' | 'Gecko' | 'Goanna' | 'iCab' | 'KHTML' | 'LibWeb' | 'Links' | 'Lynx' | 'NetFront' | 'NetSurf' | 'Presto' | 'Servo' | 'Tasman' | 'Trident' | 'w3m' | 'WebKit';
version?: string; version?: string;
} }

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
/* UAParser.js v2.0.0-rc.2 /* UAParser.js v2.0.0-rc.3
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.2', var LIBVERSION = '2.0.0-rc.3',
EMPTY = '', EMPTY = '',
UNKNOWN = '?', UNKNOWN = '?',
FUNC_TYPE = 'function', FUNC_TYPE = 'function',

View File

@ -3,7 +3,7 @@
// Source: /src/main/ua-parser.js // Source: /src/main/ua-parser.js
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
/* UAParser.js v2.0.0-rc.2 /* UAParser.js v2.0.0-rc.3
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.2', var LIBVERSION = '2.0.0-rc.3',
EMPTY = '', EMPTY = '',
UNKNOWN = '?', UNKNOWN = '?',
FUNC_TYPE = 'function', FUNC_TYPE = 'function',
@ -74,6 +74,7 @@
GOOGLE = 'Google', GOOGLE = 'Google',
HUAWEI = 'Huawei', HUAWEI = 'Huawei',
LENOVO = 'Lenovo', LENOVO = 'Lenovo',
HONOR = 'Honor',
LG = 'LG', LG = 'LG',
MICROSOFT = 'Microsoft', MICROSOFT = 'Microsoft',
MOTOROLA = 'Motorola', MOTOROLA = 'Motorola',
@ -529,10 +530,14 @@
/\b(sh-?[altvz]?\d\d[a-ekm]?)/i /\b(sh-?[altvz]?\d\d[a-ekm]?)/i
], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [ ], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [
// Honor
/(?:honor)([-\w ]+)[;\)]/i
], [MODEL, [VENDOR, HONOR], [TYPE, MOBILE]], [
// Huawei // Huawei
/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i /\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i
], [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]], [ ], [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]], [
/(?:huawei|honor)([-\w ]+)[;\)]/i, /(?:huawei)([-\w ]+)[;\)]/i,
/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i
], [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]], [ ], [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]], [
@ -597,7 +602,7 @@
], [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]], [ ], [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]], [
// Sony // Sony
/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i /droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i
], [MODEL, [VENDOR, SONY], [TYPE, MOBILE]], [ ], [MODEL, [VENDOR, SONY], [TYPE, MOBILE]], [
/sony tablet [ps]/i, /sony tablet [ps]/i,
/\b(?:sony)?sgp\w+(?: bui|\))/i /\b(?:sony)?sgp\w+(?: bui|\))/i
@ -663,13 +668,28 @@
/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i /; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i
], [MODEL, [VENDOR, 'Ulefone'], [TYPE, MOBILE]], [ ], [MODEL, [VENDOR, 'Ulefone'], [TYPE, MOBILE]], [
// Energizer
/; (energy ?\w+)(?: bui|\))/i,
/; energizer ([\w ]+)(?: bui|\))/i
], [MODEL, [VENDOR, 'Energizer'], [TYPE, MOBILE]], [
// Cat
/; cat (b35);/i,
/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i
], [MODEL, [VENDOR, 'Cat'], [TYPE, MOBILE]], [
// Smartfren
/((?:new )?andromax[\w- ]+)(?: bui|\))/i
], [MODEL, [VENDOR, 'Smartfren'], [TYPE, MOBILE]], [
// Nothing // Nothing
/droid.+; (a(?:015|06[35]|142p?))/i /droid.+; (a(?:015|06[35]|142p?))/i
], [MODEL, [VENDOR, 'Nothing'], [TYPE, MOBILE]], [ ], [MODEL, [VENDOR, 'Nothing'], [TYPE, MOBILE]], [
// MIXED // MIXED
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i, /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,
// BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron/Infinix/Tecno/Micromax/Advan
/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i, // IMO
/(hp) ([\w ]+\w)/i, // HP iPAQ /(hp) ([\w ]+\w)/i, // HP iPAQ
/(asus)-?(\w+)/i, // Asus /(asus)-?(\w+)/i, // Asus
/(microsoft); (lumia[\w ]+)/i, // Microsoft Lumia /(microsoft); (lumia[\w ]+)/i, // Microsoft Lumia
@ -678,6 +698,7 @@
/(oppo) ?([\w ]+) bui/i // OPPO /(oppo) ?([\w ]+) bui/i // OPPO
], [VENDOR, MODEL, [TYPE, MOBILE]], [ ], [VENDOR, MODEL, [TYPE, MOBILE]], [
/(imo) (tab \w+)/i, // IMO
/(kobo)\s(ereader|touch)/i, // Kobo /(kobo)\s(ereader|touch)/i, // Kobo
/(archos) (gamepad2?)/i, // Archos /(archos) (gamepad2?)/i, // Archos
/(hp).+(touchpad(?!.+tablet)|tablet)/i, // HP TouchPad /(hp).+(touchpad(?!.+tablet)|tablet)/i, // HP TouchPad
@ -811,7 +832,7 @@
], [VERSION, [NAME, 'Blink']], [ ], [VERSION, [NAME, 'Blink']], [
/(presto)\/([\w\.]+)/i, // Presto /(presto)\/([\w\.]+)/i, // Presto
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna/Servo
/ekioh(flow)\/([\w\.]+)/i, // Flow /ekioh(flow)\/([\w\.]+)/i, // Flow
/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, // KHTML/Tasman/Links /(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, // KHTML/Tasman/Links
/(icab)[\/ ]([23]\.[\d\.]+)/i, // iCab /(icab)[\/ ]([23]\.[\d\.]+)/i, // iCab
@ -1239,13 +1260,20 @@
extensions = undefined; extensions = undefined;
} }
// Convert Headers object into a plain object
if (headers && typeof headers.append === FUNC_TYPE) {
var kv = {};
headers.forEach(function (v, k) { kv[k] = v; });
headers = kv;
}
if (!(this instanceof UAParser)) { if (!(this instanceof UAParser)) {
return new UAParser(ua, extensions, headers).getResult(); return new UAParser(ua, extensions, headers).getResult();
} }
var userAgent = typeof ua === STR_TYPE ? ua : // Passed user-agent string var userAgent = typeof ua === STR_TYPE ? ua : // Passed user-agent string
((NAVIGATOR && NAVIGATOR.userAgent) ? NAVIGATOR.userAgent : // navigator.userAgent
(headers && headers[USER_AGENT] ? headers[USER_AGENT] : // User-Agent from passed headers (headers && headers[USER_AGENT] ? headers[USER_AGENT] : // User-Agent from passed headers
((NAVIGATOR && NAVIGATOR.userAgent) ? NAVIGATOR.userAgent : // navigator.userAgent
EMPTY)), // empty string EMPTY)), // empty string
httpUACH = new UACHData(headers, true), httpUACH = new UACHData(headers, true),