Compare commits

...

13 Commits

Author SHA1 Message Date
Faisal Salman
32d326b35b Update readme 2023-04-02 06:03:31 +07:00
Faisal Salman
786d502b01 Bump version 0.7.35 2023-03-31 17:56:50 +07:00
Faisal Salman
5b8adfef7b Backport - Prevent altering the result when supplied user-agent is different from current user-agent
Reference:
Commit: b09878934f
2023-03-31 15:55:44 +07:00
Faisal Salman
2e06a34062 Backport - Add new browser: TikTok
(cherry picked from commit 4af26c7a5e)
2023-03-31 15:49:21 +07:00
Faisal Salman
bf9ac43328 Backport - Add new engine: LibWeb + Add new OS: SerenityOS
(cherry picked from commit a6c85d0148)
2023-03-31 15:47:18 +07:00
Faisal Salman
3f8b5ba9cf Backport - Add new browser: Heytap
Reference:
Commit: 172f57ffea
2023-03-31 15:44:13 +07:00
Faisal Salman
1747707be6 Backport - Fix #678 - Improve Yandex detection
(cherry picked from commit 33f02099d1)
2023-03-31 15:40:54 +07:00
Faisal Salman
d41404551f Backport - Fix #519 #521 #616 - Improve iPhone & iOS detection
(cherry picked from commit a1d816ae21)
2023-03-31 15:37:30 +07:00
Faisal Salman
ba067bd351 Backport - Fix #624 - Detect Amazon Echo
(cherry picked from commit df1a1c7bb4)
2023-03-31 15:35:03 +07:00
Faisal Salman
3218051f07 Bump version 0.7.34 2023-03-05 20:46:16 +07:00
Faisal Salman
551ad88474 Add new device: Apple Watch, new os: watchOS
(cherry picked from commit 18730452f2)
2023-03-04 22:45:23 +07:00
Faisal Salman
097f736c4d Fix #387 #554 - Detect iPadOS 13
https://stackoverflow.com/questions/9038625/detect-if-device-is-ios
(cherry picked from commit 5ea9f0ec16)
2023-03-04 22:43:28 +07:00
Faisal Salman
73c25771dc Fix #498 - Detect Brave Browser by checking navigator.brave
https://github.com/brave/brave-browser/issues/10165#issuecomment-641128278
(cherry picked from commit 03b0a5afa6)
2023-03-04 22:42:39 +07:00
13 changed files with 278 additions and 54 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "0.7.33", "version": "0.7.35",
"authors": [ "authors": [
"Faisal Salman <f@faisalman.com>" "Faisal Salman <f@faisalman.com>"
], ],

View File

@@ -4,24 +4,30 @@
Version 1.0.x is basically the equivalent of version 0.7.x. See [#536](https://github.com/faisalman/ua-parser-js/issues/536) for the reason behind this confusion. Version 1.0.x is basically the equivalent of version 0.7.x. See [#536](https://github.com/faisalman/ua-parser-js/issues/536) for the reason behind this confusion.
## Version 0.7.30 / 1.0.1 ## Version 0.7.35 / 1.0.35
- Fix result from user-supplied user-agent being altered
- Add new browser: Heytap, TikTok
- Add new engine: LibWeb
- Add new OS: SerenityOS
- Improve browser detection: Yandex
- Improve device detection: iPhone, Amazon Echo
- Improve OS detection: iOS
- Add new browser : Obigo, UP.Browser, Klar ## Version 0.7.34 / 1.0.34
- Add new device : Oculus, Roku - Fix Sharp Mobile detected as Huawei Tablet
- Add new OS: Maemo, HP-UX, Android-x86, Deepin, elementary OS, GhostBSD, Linspire, Manjaro, Sabayon - Fix IE8 bug
- Improve detection for Sony Xperia 1ii, LG Android TV, and some more devices - Add new devices : Kobo e-Reader, Apple Watch, and some new SmartTV devices
- Improve detection for ARM64 CPU - Add new OS : watchOS
- Improve detection for Windows Mobile, Netscape, Mac on PowerPC - Improve browser detection : Kakao, Naver, Brave
- Categorize PDA as mobile - Improve device detection : Oculus, iPad
- Fix Sharp devices misjudged as Huawei - Improve OS detection : Chrome OS
- Fix trailing comma for ES3 compatibility - Using navigator.userAgentData as fallback for device.type & os.name
- Some code refactor
## Version 0.7.31 / 1.0.2 ## Version 0.7.33 / 1.0.33
- Fix OPPO Reno A5 incorrect detection - Add new browser : Cobalt
- Fix TypeError Bug - Identify Macintosh as an Apple device
- Use AST to extract regexes and verify them with safe-regex - Fix ReDoS vulnerability
## Version 0.7.32 / 1.0.32 ## Version 0.7.32 / 1.0.32
@@ -38,11 +44,24 @@ Version 1.0.x is basically the equivalent of version 0.7.x. See [#536](https://g
- Fix included commas in Safari / Mobile Safari version - Fix included commas in Safari / Mobile Safari version
- Increase UA_MAX_LENGTH to 350 - Increase UA_MAX_LENGTH to 350
## Version 0.7.33 / 1.0.33 ## Version 0.7.31 / 1.0.2
- Add new browser : Cobalt - Fix OPPO Reno A5 incorrect detection
- Identify Macintosh as an Apple device - Fix TypeError Bug
- Fix ReDoS vulnerability - Use AST to extract regexes and verify them with safe-regex
## Version 0.7.30 / 1.0.1
- Add new browser : Obigo, UP.Browser, Klar
- Add new device : Oculus, Roku
- Add new OS: Maemo, HP-UX, Android-x86, Deepin, elementary OS, GhostBSD, Linspire, Manjaro, Sabayon
- Improve detection for Sony Xperia 1ii, LG Android TV, and some more devices
- Improve detection for ARM64 CPU
- Improve detection for Windows Mobile, Netscape, Mac on PowerPC
- Categorize PDA as mobile
- Fix Sharp devices misjudged as Huawei
- Fix trailing comma for ES3 compatibility
- Some code refactor
# Version 0.8 # Version 0.8

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

19
images/51degrees.svg Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 161.93 86.82" style="enable-background:new 0 0 161.93 86.82;" xml:space="preserve">
<style type="text/css">
.st0{fill:#232628;}
.st1{fill:#E62E3A;}
.st2{fill:none;}
</style>
<g>
<path class="st0" d="M116.93,0.68H103.5V17.5h13.43c15.24,0,25.53,10.53,25.53,25.53v0.24c0,15-10.28,25.29-25.53,25.29H103.5
v16.82h13.43c26.62,0,45-18.51,45-42.34v-0.24C161.93,18.95,143.54,0.68,116.93,0.68"/>
<path class="st1" d="M8.11,0.68h52.02v16.33H24.07l-0.97,14.64c3.39-0.85,6.41-1.45,11.13-1.45c16.7,0,29.64,7.99,29.64,27.22
c0,18.03-12.7,29.4-32.18,29.4c-13.55,0-23.47-4.84-31.7-12.7l11.25-13.43c6.41,5.81,12.7,9.19,20.2,9.19
c8.71,0,14.15-4.23,14.15-11.86c0-7.38-5.93-11.61-15-11.61c-5.32,0-10.16,1.45-14.16,3.15L5.69,42.42L8.11,0.68z"/>
<polygon class="st1" points="86.14,0 98.84,0 98.84,85.29 80.45,85.29 80.45,18.87 65.69,22.5 61.82,7.26 "/>
</g>
<rect x="144.06" y="110.12" class="st2" width="566.93" height="113.39"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1,6 +1,6 @@
Package.describe({ Package.describe({
name: 'faisalman:ua-parser-js', name: 'faisalman:ua-parser-js',
version: '0.7.33', version: '0.7.35',
summary: 'Lightweight JavaScript-based user-agent string parser', summary: 'Lightweight JavaScript-based user-agent string parser',
git: 'https://github.com/faisalman/ua-parser-js.git', git: 'https://github.com/faisalman/ua-parser-js.git',
documentation: 'readme.md' documentation: 'readme.md'

View File

@@ -1,7 +1,7 @@
{ {
"title": "UAParser.js", "title": "UAParser.js",
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "0.7.33", "version": "0.7.35",
"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 data. Supports browser & node.js environment", "description": "Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data. Supports browser & node.js environment",
"keywords": [ "keywords": [

View File

@@ -18,6 +18,26 @@ JavaScript library to detect Browser, Engine, OS, CPU, and Device type/model fro
* Demo : https://faisalman.github.io/ua-parser-js * Demo : https://faisalman.github.io/ua-parser-js
* Source : https://github.com/faisalman/ua-parser-js * Source : https://github.com/faisalman/ua-parser-js
***
### From Our Sponsors:
<table>
<thead>
</thead>
<tbody>
<tr>
<td align="center" width="200px" rowspan="3"><a href="https://www.npmjs.com/package/@51degrees/ua-parser-js"><img src="images/51degrees.svg" alt="51degrees" width="75%" height="75%" ></a></td>
<td align="left" width="400px"><a href="https://www.npmjs.com/package/@51degrees/ua-parser-js">@51degrees/ua-parser-js</a></td>
</tr>
<tr>
<td><br/><p>UAParser.js has been upgraded to detect comprehensive device data based on the User-Agent and User-Agent Client Hints.</p><p>This package supports all device types including Apple and Android devices and can be used either in a browser (client-side) or Node.js environment (server-side).</p><p>Visit <a href="https://www.npmjs.com/package/@51degrees/ua-parser-js">↗ 51Degrees <u>UAParser</u></a> to get started.</p>
</td>
</tr>
</tbody>
</table>
---
# Documentation # Documentation
### UAParser([user-agent][,extensions]) ### UAParser([user-agent][,extensions])
typeof `user-agent` "string". typeof `user-agent` "string".
@@ -82,16 +102,16 @@ The methods are self explanatory, here's a small overview on all the available m
BIDUBrowser, Baidu, Basilisk, Blazer, Bolt, Brave, Bowser, Camino, Chimera, BIDUBrowser, Baidu, Basilisk, Blazer, Bolt, Brave, Bowser, Camino, Chimera,
Chrome Headless, Chrome WebView, Chrome, Chromium, Cobalt, Comodo Dragon, Dillo, Chrome Headless, Chrome WebView, Chrome, Chromium, Cobalt, Comodo Dragon, Dillo,
Dolphin, Doris, DuckDuckGo, Edge, Electron, Epiphany, Facebook, Falkon, Fennec, Dolphin, Doris, DuckDuckGo, Edge, Electron, Epiphany, Facebook, Falkon, Fennec,
Firebird, Firefox [Focus/Reality], Flock, Flow, GSA, GoBrowser, Huawei Browser, Firebird, Firefox [Focus/Reality], Flock, Flow, GSA, GoBrowser, Heytap,
ICE Browser, IE, IEMobile, IceApe, IceCat, IceDragon, Iceweasel, Instagram, Huawei Browser, ICE Browser, IE, IEMobile, IceApe, IceCat, IceDragon, Iceweasel,
Iridium, Iron, Jasmine, Kakao[Story/Talk], K-Meleon, Kindle, Klar, Konqueror, Instagram, Iridium, Iron, Jasmine, Kakao[Story/Talk], K-Meleon, Kindle, Klar,
LBBROWSER, Line, LinkedIn, Links, Lunascape, Lynx, MIUI Browser, Maemo Browser, Konqueror, LBBROWSER, Line, LinkedIn, Links, Lunascape, Lynx, MIUI Browser,
Maemo, Maxthon, MetaSr Midori, Minimo, Mobile Safari, Mosaic, Mozilla, NetFront, Maemo, Maxthon, MetaSr Midori, Minimo, Mobile Safari, Mosaic, Mozilla, NetFront,
NetSurf, Netfront, Netscape, NokiaBrowser, Obigo, Oculus Browser, OmniWeb, NetSurf, Netfront, Netscape, NokiaBrowser, Obigo, Oculus Browser, OmniWeb,
Opera Coast, Opera [Mini/Mobi/Tablet], PaleMoon, PhantomJS, Phoenix, Polaris, Opera Coast, Opera [Mini/Mobi/Tablet], PaleMoon, PhantomJS, Phoenix, Polaris,
Puffin, QQ, QQBrowser, QQBrowserLite, Quark, QupZilla, RockMelt, Safari, Puffin, QQ, QQBrowser, QQBrowserLite, Quark, QupZilla, RockMelt, Safari,
Sailfish Browser, Samsung Browser, SeaMonkey, Silk, Skyfire, Sleipnir, Slim, Sailfish Browser, Samsung Browser, SeaMonkey, Silk, Skyfire, Sleipnir, Slim,
SlimBrowser, Swiftfox, Tesla, Tizen Browser, UCBrowser, UP.Browser, Viera, SlimBrowser, Swiftfox, Tesla, TikTok, Tizen Browser, UCBrowser, UP.Browser, Viera,
Vivaldi, Waterfox, WeChat, Weibo, Yandex, baidu, iCab, w3m, Whale Browser... Vivaldi, Waterfox, WeChat, Weibo, Yandex, baidu, iCab, w3m, Whale Browser...
# 'browser.version' determined dynamically # 'browser.version' determined dynamically
@@ -126,8 +146,8 @@ Siemens, Sony[Ericsson], Sprint, Tesla, Vivo, Vodafone, Xbox, Xiaomi, Zebra, ZTE
```sh ```sh
# Possible 'engine.name' # Possible 'engine.name'
Amaya, Blink, EdgeHTML, Flow, Gecko, Goanna, iCab, KHTML, Links, Lynx, NetFront, Amaya, Blink, EdgeHTML, Flow, Gecko, Goanna, iCab, KHTML, LibWeb, Links, Lynx,
NetSurf, Presto, Tasman, Trident, w3m, WebKit NetFront, NetSurf, Presto, Tasman, Trident, w3m, WebKit
# 'engine.version' determined dynamically # 'engine.version' determined dynamically
``` ```
@@ -143,8 +163,9 @@ Fuchsia, Gentoo, GhostBSD, GNU, Haiku, HarmonyOS, HP-UX, Hurd, iOS, Joli, KaiOS,
Linpus, Linspire,Linux, Mac OS, Maemo, Mageia, Mandriva, Manjaro, MeeGo, Minix, Linpus, Linspire,Linux, Mac OS, Maemo, Mageia, Mandriva, Manjaro, MeeGo, Minix,
Mint, Morph OS, NetBSD, NetRange, NetTV, Nintendo, OpenBSD, OpenVMS, OS/2, Palm, Mint, Morph OS, NetBSD, NetRange, NetTV, Nintendo, OpenBSD, OpenVMS, OS/2, Palm,
PC-BSD, PCLinuxOS, Plan9, PlayStation, QNX, Raspbian, RedHat, RIM Tablet OS, PC-BSD, PCLinuxOS, Plan9, PlayStation, QNX, Raspbian, RedHat, RIM Tablet OS,
RISC OS, Sabayon, Sailfish, Series40, Slackware, Solaris, SUSE, Symbian, Tizen, RISC OS, Sabayon, Sailfish, SerenityOS, Series40, Slackware, Solaris, SUSE, Symbian,
Ubuntu, Unix, VectorLinux, Viera, WebOS, Windows [Phone/Mobile], Zenwalk, ... Tizen, Ubuntu, Unix, VectorLinux, Viera, watchOS, WebOS, Windows [Phone/Mobile],
Zenwalk, ...
# 'os.version' determined dynamically # 'os.version' determined dynamically
``` ```
@@ -312,9 +333,10 @@ console.log(myParser.setUA(myUA).getBrowser()); // {name: "MyBrowser", version:
# Development # Development
## Sponsors ## Backers & Sponsors
<a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/tiers/backers.svg?avatarHeight=64" height="80"/></a> <a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/tiers/sponsors.svg?avatarHeight=64" height="80"/></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://www.paypal.me/faisalman/"><img src="https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg" height="40"></a> <a href="https://www.paypal.me/faisalman/"><img src="https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg" height="40"></a>

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
/* UAParser.js v0.7.33 /* UAParser.js v0.7.35
Copyright © 2012-2021 Faisal Salman <f@faisalman.com> Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
MIT License *//* MIT 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.
@@ -17,7 +17,7 @@
///////////// /////////////
var LIBVERSION = '0.7.33', var LIBVERSION = '0.7.35',
EMPTY = '', EMPTY = '',
UNKNOWN = '?', UNKNOWN = '?',
FUNC_TYPE = 'function', FUNC_TYPE = 'function',
@@ -59,7 +59,9 @@
VIERA = 'Viera', VIERA = 'Viera',
XIAOMI = 'Xiaomi', XIAOMI = 'Xiaomi',
ZEBRA = 'Zebra', ZEBRA = 'Zebra',
FACEBOOK = 'Facebook'; FACEBOOK = 'Facebook',
CHROMIUM_OS = 'Chromium OS',
MAC_OS = 'Mac OS';
/////////// ///////////
// Helper // Helper
@@ -234,8 +236,9 @@
/(?: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 // 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|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i, /(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,
// Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ
/(heytap|ovi)browser\/([\d\.]+)/i, // Heytap/Ovi
/(weibo)__([\d\.]+)/i // Weibo /(weibo)__([\d\.]+)/i // Weibo
], [NAME, VERSION], [ ], [NAME, VERSION], [
/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser /(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser
@@ -249,7 +252,7 @@
], [VERSION, [NAME, 'Konqueror']], [ ], [VERSION, [NAME, 'Konqueror']], [
/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11 /trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11
], [VERSION, [NAME, 'IE']], [ ], [VERSION, [NAME, 'IE']], [
/yabrowser\/([\w\.]+)/i // Yandex /ya(?:search)?browser\/([\w\.]+)/i // Yandex
], [VERSION, [NAME, 'Yandex']], [ ], [VERSION, [NAME, 'Yandex']], [
/(avast|avg)\/([\w\.]+)/i // Avast/AVG Secure Browser /(avast|avg)\/([\w\.]+)/i // Avast/AVG Secure Browser
], [[NAME, /(.+)/, '$1 Secure '+BROWSER], VERSION], [ ], [[NAME, /(.+)/, '$1 Secure '+BROWSER], VERSION], [
@@ -293,6 +296,8 @@
], [NAME, VERSION], [ ], [NAME, VERSION], [
/\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS /\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS
], [VERSION, [NAME, 'GSA']], [ ], [VERSION, [NAME, 'GSA']], [
/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i // TikTok
], [VERSION, [NAME, 'TikTok']], [
/headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless /headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless
], [VERSION, [NAME, CHROME+' Headless']], [ ], [VERSION, [NAME, CHROME+' Headless']], [
@@ -388,7 +393,7 @@
], [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]], [ ], [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]], [
// Apple // Apple
/\((ip(?:hone|od)[\w ]*);/i // iPod/iPhone /(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i // iPod/iPhone
], [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]], [ ], [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]], [
/\((ipad);[-\w\),; ]+apple/i, // iPad /\((ipad);[-\w\),; ]+apple/i, // iPad
/applecoremedia\/[\w\.]+ \((ipad)/i, /applecoremedia\/[\w\.]+ \((ipad)/i,
@@ -478,7 +483,7 @@
// Amazon // Amazon
/(alexa)webm/i, /(alexa)webm/i,
/(kf[a-z]{2}wi)( bui|\))/i, // Kindle Fire without Silk /(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i, // Kindle Fire without Silk / Echo Show
/(kf[a-z]+)( bui|\)).+silk\//i // Kindle Fire HD /(kf[a-z]+)( bui|\)).+silk\//i // Kindle Fire HD
], [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]], [ ], [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]], [
/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i // Fire Phone /((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i // Fire Phone
@@ -648,6 +653,8 @@
/((pebble))app/i // Pebble /((pebble))app/i // Pebble
], [VENDOR, MODEL, [TYPE, WEARABLE]], [ ], [VENDOR, MODEL, [TYPE, WEARABLE]], [
/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i // Apple Watch
], [MODEL, [VENDOR, APPLE], [TYPE, WEARABLE]], [
/droid.+; (glass) \d/i // Google Glass /droid.+; (glass) \d/i // Google Glass
], [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]], [ ], [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]], [
/droid.+; (wt63?0{2,3})\)/i /droid.+; (wt63?0{2,3})\)/i
@@ -661,6 +668,8 @@
/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i // Tesla /(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i // Tesla
], [VENDOR, [TYPE, EMBEDDED]], [ ], [VENDOR, [TYPE, EMBEDDED]], [
/(aeobc)\b/i // Echo Dot
], [MODEL, [VENDOR, AMAZON], [TYPE, EMBEDDED]], [
//////////////////// ////////////////////
// MIXED (GENERIC) // MIXED (GENERIC)
@@ -690,7 +699,8 @@
/(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)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna
/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
/\b(libweb)/i
], [NAME, VERSION], [ ], [NAME, VERSION], [
/rv\:([\w\.]{1,9})\b.+(gecko)/i // Gecko /rv\:([\w\.]{1,9})\b.+(gecko)/i // Gecko
@@ -711,11 +721,12 @@
// iOS/macOS // iOS/macOS
/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i, // iOS /ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i, // iOS
/ios;fbsv\/([\d\.]+)/i,
/cfnetwork\/.+darwin/i /cfnetwork\/.+darwin/i
], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [ ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [
/(mac os x) ?([\w\. ]*)/i, /(mac os x) ?([\w\. ]*)/i,
/(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS /(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS
], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [ ], [[NAME, MAC_OS], [VERSION, /_/g, '.']], [
// Mobile OSes // Mobile OSes
/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS /droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS
@@ -734,12 +745,14 @@
/web0s;.+rt(tv)/i, /web0s;.+rt(tv)/i,
/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i // WebOS /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i // WebOS
], [VERSION, [NAME, 'webOS']], [ ], [VERSION, [NAME, 'webOS']], [
/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i // watchOS
], [VERSION, [NAME, 'watchOS']], [
// Google Chromecast // Google Chromecast
/crkey\/([\d\.]+)/i // Google Chromecast /crkey\/([\d\.]+)/i // Google Chromecast
], [VERSION, [NAME, CHROME+'cast']], [ ], [VERSION, [NAME, CHROME+'cast']], [
/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i // Chromium OS /(cros) [\w]+(?:\)| ([\w\.]+)\b)/i // Chromium OS
], [[NAME, 'Chromium OS'], VERSION],[ ], [[NAME, CHROMIUM_OS], VERSION],[
// Smart TVs // Smart TVs
/panasonic;(viera)/i, // Panasonic Viera /panasonic;(viera)/i, // Panasonic Viera
@@ -765,7 +778,7 @@
], [[NAME, 'Solaris'], VERSION], [ ], [[NAME, 'Solaris'], VERSION], [
/((?:open)?solaris)[-\/ ]?([\w\.]*)/i, // Solaris /((?:open)?solaris)[-\/ ]?([\w\.]*)/i, // Solaris
/(aix) ((\d)(?=\.|\)| )[\w\.])*/i, // AIX /(aix) ((\d)(?=\.|\)| )[\w\.])*/i, // AIX
/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i, // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX /\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i, // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX/SerenityOS
/(unix) ?([\w\.]*)/i // UNIX /(unix) ?([\w\.]*)/i // UNIX
], [NAME, VERSION] ], [NAME, VERSION]
] ]
@@ -786,16 +799,22 @@
return new UAParser(ua, extensions).getResult(); return new UAParser(ua, extensions).getResult();
} }
var _ua = ua || ((typeof window !== UNDEF_TYPE && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY); var _navigator = (typeof window !== UNDEF_TYPE && window.navigator) ? window.navigator : undefined;
var _uach = (typeof window !== UNDEF_TYPE && window.navigator && window.navigator.userAgentData) ? window.navigator.userAgentData : undefined; var _ua = ua || ((_navigator && _navigator.userAgent) ? _navigator.userAgent : EMPTY);
var _uach = (_navigator && _navigator.userAgentData) ? _navigator.userAgentData : undefined;
var _rgxmap = extensions ? extend(regexes, extensions) : regexes; var _rgxmap = extensions ? extend(regexes, extensions) : regexes;
var _isSelfNav = _navigator && _navigator.userAgent == _ua;
this.getBrowser = function () { this.getBrowser = function () {
var _browser = {}; var _browser = {};
_browser[NAME] = undefined; _browser[NAME] = undefined;
_browser[VERSION] = undefined; _browser[VERSION] = undefined;
rgxMapper.call(_browser, _ua, _rgxmap.browser); rgxMapper.call(_browser, _ua, _rgxmap.browser);
_browser.major = majorize(_browser.version); _browser[MAJOR] = majorize(_browser[VERSION]);
// Brave-specific detection
if (_isSelfNav && _navigator && _navigator.brave && typeof _navigator.brave.isBrave == FUNC_TYPE) {
_browser[NAME] = 'Brave';
}
return _browser; return _browser;
}; };
this.getCPU = function () { this.getCPU = function () {
@@ -810,9 +829,14 @@
_device[MODEL] = undefined; _device[MODEL] = undefined;
_device[TYPE] = undefined; _device[TYPE] = undefined;
rgxMapper.call(_device, _ua, _rgxmap.device); rgxMapper.call(_device, _ua, _rgxmap.device);
if (!_device[TYPE] && _uach && _uach.mobile) { if (_isSelfNav && !_device[TYPE] && _uach && _uach.mobile) {
_device[TYPE] = MOBILE; _device[TYPE] = MOBILE;
} }
// iPadOS-specific detection: identified as Mac, but has some iOS-only properties
if (_isSelfNav && _device[MODEL] == 'Macintosh' && _navigator && typeof _navigator.standalone !== UNDEF_TYPE && _navigator.maxTouchPoints && _navigator.maxTouchPoints > 2) {
_device[MODEL] = 'iPad';
_device[TYPE] = TABLET;
}
return _device; return _device;
}; };
this.getEngine = function () { this.getEngine = function () {
@@ -827,8 +851,10 @@
_os[NAME] = undefined; _os[NAME] = undefined;
_os[VERSION] = undefined; _os[VERSION] = undefined;
rgxMapper.call(_os, _ua, _rgxmap.os); rgxMapper.call(_os, _ua, _rgxmap.os);
if (!_os[NAME] && _uach && _uach.platform != 'Unknown') { if (_isSelfNav && !_os[NAME] && _uach && _uach.platform != 'Unknown') {
_os[NAME] = _uach.platform.replace(/chrome/i, 'Chromium').replace(/mac/i, 'Mac '); _os[NAME] = _uach.platform
.replace(/chrome os/i, CHROMIUM_OS)
.replace(/macos/i, MAC_OS); // backward compatibility
} }
return _os; return _os;
}; };

View File

@@ -1298,6 +1298,16 @@
"major" : "1" "major" : "1"
} }
}, },
{
"desc" : "Yandex",
"ua" : "Mozilla/5.0 (Linux; arm_64; Android 11; M2101K7AG) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.125 YaApp_Android/22.70 YaSearchBrowser/22.70 BroPP/1.0 SA/3 Mobile Safari/537.36",
"expect" :
{
"name" : "Yandex",
"version" : "22.70",
"major" : "22"
}
},
{ {
"desc" : "Puffin", "desc" : "Puffin",
"ua" : "Mozilla/5.0 (Linux; Android 6.0.1; Lenovo P2a42 Build/MMB29M; en-us) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Puffin/6.0.8.15804AP", "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; Lenovo P2a42 Build/MMB29M; en-us) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Puffin/6.0.8.15804AP",
@@ -1682,5 +1692,32 @@
"version": "10.25.0", "version": "10.25.0",
"major" : "10" "major" : "10"
} }
},
{
"desc" : "TikTok",
"ua" : "Mozilla/5.0 (Linux; Android 11; 21061119AG Build/RP1A.200720.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/92.0.4515.131 Mobile Safari/537.36 trill_2022109040 JsSdk/1.0 NetType/MOBILE Channel/googleplay AppName/musical_ly app_version/21.9.4 ByteLocale/ru-RU ByteFullLocale/ru-RU Region/KG BytedanceWebview/d8a21c6",
"expect" : {
"name" : "TikTok",
"version": "21.9.4",
"major" : "21"
}
},
{
"desc" : "TikTok",
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 musical_ly_21.1.0 JsSdk/2.0 NetType/4G Channel/App Store ByteLocale/ru Region/RU ByteFullLocale/ru-RU isDarkMode/1 WKWebView/1 BytedanceWebview/d8a21c6",
"expect" : {
"name" : "TikTok",
"version": "21.1.0",
"major" : "21"
}
},
{
"desc" : "TikTok",
"ua" : "Mozilla/5.0 (Linux; Android 10; STK-LX1 Build/HONORSTK-LX1; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/110.0.5481.153 Mobile Safari/537.36 musical_ly_2022803040 JsSdk/1.0 NetType/WIFI Channel/huaweiadsglobal_int AppName/musical_ly app_version/28.3.4 ByteLocale/en ByteFullLocale/en Region/IQ Spark/1.2.7-alpha.8 AppVersion/28.3.4 PIA/1.5.11 BytedanceWebview/d8a21c6",
"expect" : {
"name" : "TikTok",
"version": "28.3.4",
"major" : "28"
}
} }
] ]

View File

@@ -763,6 +763,15 @@
"type": "undefined" "type": "undefined"
} }
}, },
{
"desc": "Apple Watch",
"ua": "atc/1.0 watchOS/7.3.3 model/Watch4,2 hwp/t8006 build/18S830 (6; dt:191)",
"expect": {
"vendor": "Apple",
"model": "watch",
"type": "wearable"
}
},
{ {
"desc": "iPad using UCBrowser", "desc": "iPad using UCBrowser",
"ua": "Mozilla/5.0 (iPad; U; CPU OS 11_2 like Mac OS X; zh-CN; iPad5,3) AppleWebKit/534.46 (KHTML, like Gecko) UCBrowser/3.0.1.776 U3/ Mobile/10A403 Safari/7543.48.3", "ua": "Mozilla/5.0 (iPad; U; CPU OS 11_2 like Mac OS X; zh-CN; iPad5,3) AppleWebKit/534.46 (KHTML, like Gecko) UCBrowser/3.0.1.776 U3/ Mobile/10A403 Safari/7543.48.3",
@@ -1629,6 +1638,33 @@
"type": "tablet" "type": "tablet"
} }
}, },
{
"desc": "Echo Show 5",
"ua": "Mozilla/5.0 (Linux; Android 5.1; AEORK Build/LVY48F; xx-xx) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/70.0.3538.110 Mobile Safari/537.36",
"expect": {
"vendor": "Amazon",
"model": "AEORK",
"type": "tablet"
}
},
{
"desc": "Echo Show 8",
"ua": "Mozilla/5.0 (Linux; Android 7.1; AEOCH) AppleWebKit/537.36 (KHTML, like Gecko) Silk/77.2.21 like Chrome/77.0.3865.92 Mobile Safari/537.36",
"expect": {
"vendor": "Amazon",
"model": "AEOCH",
"type": "tablet"
}
},
{
"desc": "Echo Dot",
"ua": "Dalvik/2.1.0 (Linux; U; Android 5.1.1; AEOBC Build/LVY48F)",
"expect": {
"vendor": "Amazon",
"model": "AEOBC",
"type": "embedded"
}
},
{ {
"desc": "Samsung Galaxy A21s", "desc": "Samsung Galaxy A21s",
"ua": "Mozilla/5.0 (Linux; Android 10; SAMSUNG SM-A217F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/11.0 Chrome/75.0.3770.143 Mobile Safari/537.36", "ua": "Mozilla/5.0 (Linux; Android 10; SAMSUNG SM-A217F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/11.0 Chrome/75.0.3770.143 Mobile Safari/537.36",
@@ -3100,6 +3136,17 @@
"desc": "FaceBook Mobile App", "desc": "FaceBook Mobile App",
"ua": "[FBAN/FBIOS;FBAV/283.0.0.44.117;FBBV/238386386;FBDV/iPhone12,1;FBMD/iPhone;FBSN/iOS;FBSV/13.6.1;FBSS/2;FBID/phone;FBLC/en_US;FBOP/5;FBRV/240127608]", "ua": "[FBAN/FBIOS;FBAV/283.0.0.44.117;FBBV/238386386;FBDV/iPhone12,1;FBMD/iPhone;FBSN/iOS;FBSV/13.6.1;FBSS/2;FBID/phone;FBLC/en_US;FBOP/5;FBRV/240127608]",
"expect": { "expect": {
"vendor": "Apple",
"model": "iPhone12,1",
"type": "mobile"
}
},
{
"desc": "Issue #519",
"ua": "ios/iPhone/14.2/SOME_CUSTOM_APP_VERSION",
"expect": {
"vendor": "Apple",
"model": "iPhone",
"type": "mobile" "type": "mobile"
} }
}, },

View File

@@ -53,6 +53,15 @@
"version" : "4.5.4" "version" : "4.5.4"
} }
}, },
{
"desc" : "LibWeb",
"ua" : "Mozilla/4.0 (SerenityOS; x86) LibWeb+LibJS (Not KHTML, nor Gecko) LibWeb",
"expect" :
{
"name" : "LibWeb",
"version" : "undefined"
}
},
{ {
"desc" : "NetFront", "desc" : "NetFront",
"ua" : "Mozilla/4.0 (PDA; Windows CE/1.0.1) NetFront/3.0", "ua" : "Mozilla/4.0 (PDA; Windows CE/1.0.1) NetFront/3.0",

View File

@@ -764,6 +764,42 @@
"version" : "undefined" "version" : "undefined"
} }
}, },
{
"desc": "iOS with FaceBook Mobile App",
"ua": "[FBAN/FBIOS;FBAV/283.0.0.44.117;FBBV/238386386;FBDV/iPhone12,1;FBMD/iPhone;FBSN/iOS;FBSV/13.6.1;FBSS/2;FBID/phone;FBLC/en_US;FBOP/5;FBRV/240127608]",
"expect":
{
"name" : "iOS",
"version" : "13.6.1"
}
},
{
"desc" : "watchOS",
"ua" : "server-bag [Watch OS,8.4,19S546,Watch3,4]",
"expect" :
{
"name" : "watchOS",
"version" : "8.4"
}
},
{
"desc" : "watchOS",
"ua" : "atc/1.0 watchOS/7.4.1 model/Watch3,3 hwp/t8004 build/18T201 (6; dt:155)",
"expect" :
{
"name" : "watchOS",
"version" : "7.4.1"
}
},
{
"desc" : "watchOS",
"ua" : "Watch4,3/5.3.8 (16U680)",
"expect" :
{
"name" : "watchOS",
"version" : "5.3.8"
}
},
{ {
"desc" : "Mac OS on PowerPC", "desc" : "Mac OS on PowerPC",
"ua" : "Mozilla/4.0 (compatible; MSIE 5.0b1; Mac_PowerPC)", "ua" : "Mozilla/4.0 (compatible; MSIE 5.0b1; Mac_PowerPC)",
@@ -1168,5 +1204,14 @@
"name" : "Linspire", "name" : "Linspire",
"version" : "1.5.0.4" "version" : "1.5.0.4"
} }
},
{
"desc" : "SerenityOS",
"ua" : "Mozilla/4.0 (SerenityOS; x86) LibWeb+LibJS (Not KHTML, nor Gecko) LibWeb",
"expect" :
{
"name" : "SerenityOS",
"version" : "undefined"
}
} }
] ]