mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-11-21 09:36:40 +03:00
Compare commits
1 Commits
2.0.0-alph
...
v0.7.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a21b0f2294 |
12
.github/FUNDING.yml
vendored
12
.github/FUNDING.yml
vendored
@@ -1,12 +0,0 @@
|
|||||||
# These are supported funding model platforms
|
|
||||||
|
|
||||||
github: faisalman
|
|
||||||
patreon: # Replace with a single Patreon username
|
|
||||||
open_collective: ua-parser-js
|
|
||||||
ko_fi: # Replace with a single Ko-fi username
|
|
||||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
|
||||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
||||||
liberapay: # Replace with a single Liberapay username
|
|
||||||
issuehunt: # Replace with a single IssueHunt username
|
|
||||||
otechie: # Replace with a single Otechie username
|
|
||||||
custom: ['https://www.paypal.me/faisalman/']
|
|
||||||
20
.github/workflows/run-test.yml
vendored
20
.github/workflows/run-test.yml
vendored
@@ -1,20 +0,0 @@
|
|||||||
name: ua-parser-js-run-test
|
|
||||||
|
|
||||||
on: [push, pull_request]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run-test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
arch: [amd64, ppc64le]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-node@v2
|
|
||||||
- name: Run the test
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npm run test-ci
|
|
||||||
12
.gitignore
vendored
12
.gitignore
vendored
@@ -1,18 +1,12 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
<<<<<<< HEAD
|
||||||
### vim ###
|
### vim ###
|
||||||
.*.s[a-w][a-z]
|
.*.s[a-w][a-z]
|
||||||
*.un~
|
*.un~
|
||||||
Session.vim
|
Session.vim
|
||||||
.netrwhist
|
.netrwhist
|
||||||
*~
|
*~
|
||||||
.versions
|
|
||||||
|
|
||||||
### editors ###
|
|
||||||
.vscode
|
|
||||||
.idea
|
|
||||||
*.sublime-*
|
|
||||||
|
|
||||||
### OSX ###
|
### OSX ###
|
||||||
.DS_Store
|
.DS_Store
|
||||||
@@ -20,9 +14,13 @@ Session.vim
|
|||||||
.LSOverride
|
.LSOverride
|
||||||
Icon
|
Icon
|
||||||
|
|
||||||
|
|
||||||
# Thumbnails
|
# Thumbnails
|
||||||
._*
|
._*
|
||||||
|
|
||||||
# Files that might appear on external disk
|
# Files that might appear on external disk
|
||||||
.Spotlight-V100
|
.Spotlight-V100
|
||||||
.Trashes
|
.Trashes
|
||||||
|
=======
|
||||||
|
.idea
|
||||||
|
>>>>>>> baf4bb99b4ef92c71419931e8fd334e34c051e52
|
||||||
|
|||||||
16
.travis.yml
16
.travis.yml
@@ -1,18 +1,6 @@
|
|||||||
arch:
|
|
||||||
- amd64
|
|
||||||
- ppc64le
|
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- stable
|
- 0.8
|
||||||
- lts/*
|
- 0.6
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- node_modules
|
|
||||||
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
script: npm run test-ci
|
|
||||||
52
bower.json
52
bower.json
@@ -1,17 +1,39 @@
|
|||||||
{
|
{
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "2.0.0-alpha.2",
|
"version": "0.7.0",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Faisal Salman <f@faisalman.com>"
|
"Faisal Salman <fyzlman@gmail.com>"
|
||||||
],
|
],
|
||||||
"private": false,
|
"private": false,
|
||||||
"main": "src/ua-parser.js",
|
"main": "src/ua-parser.js",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"build",
|
"build",
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"bower_components",
|
"bower_components",
|
||||||
"test",
|
"test",
|
||||||
"tests"
|
"tests"
|
||||||
],
|
],
|
||||||
"dependencies": {}
|
"contributors": [
|
||||||
|
"Faisal Salman <fyzlman@gmail.com>",
|
||||||
|
"Benjamin Bertrand <bertrand.design@gmail.com>",
|
||||||
|
"Christopher De Cairos <chris.decairos@gmail.com>",
|
||||||
|
"Davit Barbakadze <jayarjo@gmail.com>",
|
||||||
|
"Dmitry Tyschenko <dtyschenko@gmail.com>",
|
||||||
|
"Douglas Li <doug@knotch.it>",
|
||||||
|
"Erik Hesselink <hesselink@gmail.com>",
|
||||||
|
"Fabian Becker <halfdan@xnorfz.de>",
|
||||||
|
"Jackpoll <jackpoll123456@gmail.com>",
|
||||||
|
"Jake Mc <startswithaj@users.noreply.github.com>",
|
||||||
|
"John Tantalo <john.tantalo@gmail.com>",
|
||||||
|
"John Yanarella <jmy@codecatalyst.com>",
|
||||||
|
"Jon Buckley <jon@jbuckley.ca>",
|
||||||
|
"Lee Treveil <leetreveil@gmail.com>",
|
||||||
|
"Leonardo <leofiore@libero.it>",
|
||||||
|
"Michael Hess <mhess@connectify.me>",
|
||||||
|
"Ross Noble <rosshnoble@gmail.com>",
|
||||||
|
"Sandro Sonntag <sandro.sonntag@adorsys.de>"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
37
build/build.sh
Executable file
37
build/build.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
JSHINT_DIR="node_modules/jshint/bin/jshint"
|
||||||
|
MOCHA_DIR="node_modules/mocha/bin/mocha"
|
||||||
|
UGLIFY_DIR="node_modules/uglify-js/bin/uglifyjs"
|
||||||
|
|
||||||
|
# check module directory & install if not found
|
||||||
|
function check_module {
|
||||||
|
if ! type $2 &> /dev/null
|
||||||
|
then
|
||||||
|
echo "$2 is not found"
|
||||||
|
if ! type "npm" &> /dev/null
|
||||||
|
then
|
||||||
|
echo "npm is not installed"
|
||||||
|
echo "Exiting"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Installing $1..."
|
||||||
|
npm install $1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
check_module "jshint" $JSHINT_DIR
|
||||||
|
check_module "mocha" $MOCHA_DIR
|
||||||
|
check_module "uglify-js" $UGLIFY_DIR
|
||||||
|
|
||||||
|
echo "Verifiying code..."
|
||||||
|
$JSHINT_DIR src/ua-parser.js
|
||||||
|
|
||||||
|
echo "Running test..."
|
||||||
|
$MOCHA_DIR -R nyan test/test.js
|
||||||
|
|
||||||
|
echo "Minifying script..."
|
||||||
|
$UGLIFY_DIR src/ua-parser.js > src/ua-parser.min.js
|
||||||
|
echo "OK"
|
||||||
89
changelog.md
89
changelog.md
@@ -1,89 +0,0 @@
|
|||||||
# UAParser.js Changelog
|
|
||||||
|
|
||||||
# Version 2.0
|
|
||||||
- What's breaking:
|
|
||||||
- Browser detection on mobile device: `"Chrome" => "Mobile Chrome"`, `"Firefox" => "Mobile Firefox"`
|
|
||||||
- OS detection: `"Mac OS" => "macOS"`, `"Chromium OS" => "Chrome OS"`
|
|
||||||
- What's new:
|
|
||||||
- Add some new methods in result object:
|
|
||||||
- Add support for client hints: `withClientHints()`
|
|
||||||
- Utility for easy comparison: `is()`
|
|
||||||
- Utility to print full-name: `toString()`
|
|
||||||
- Add support for ES module `import { UAParser } from 'ua-parser-js'`
|
|
||||||
- Provide Enums `'ua-parser-js/enums'`
|
|
||||||
- Provide Extensions `'ua-parser-js/extensions'`
|
|
||||||
|
|
||||||
## Version 2.0.0-alpha.2
|
|
||||||
- Fix browser result always returning Chromium when using `withClientHints()`
|
|
||||||
- Fix infinite-loop when await-ing `withClientHints()` in non-client-hints browser
|
|
||||||
|
|
||||||
## Version 2.0.0-alpha.1
|
|
||||||
- Initial work on new major version
|
|
||||||
|
|
||||||
|
|
||||||
# Version 0.7 / 1.0
|
|
||||||
|
|
||||||
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.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
|
|
||||||
|
|
||||||
## Version 0.7.34 / 1.0.34
|
|
||||||
- Fix Sharp Mobile detected as Huawei Tablet
|
|
||||||
- Fix IE8 bug
|
|
||||||
- Add new devices : Kobo e-Reader, Apple Watch, and some new SmartTV devices
|
|
||||||
- Add new OS : watchOS
|
|
||||||
- Improve browser detection : Kakao, Naver, Brave
|
|
||||||
- Improve device detection : Oculus, iPad
|
|
||||||
- Improve OS detection : Chrome OS
|
|
||||||
- Using navigator.userAgentData as fallback for device.type & os.name
|
|
||||||
|
|
||||||
## Version 0.7.33 / 1.0.33
|
|
||||||
|
|
||||||
- Add new browser : Cobalt
|
|
||||||
- Identify Macintosh as an Apple device
|
|
||||||
- Fix ReDoS vulnerability
|
|
||||||
|
|
||||||
## Version 0.7.32 / 1.0.32
|
|
||||||
|
|
||||||
- Add new browser : DuckDuckGo, Huawei Browser, LinkedIn
|
|
||||||
- Add new OS : HarmonyOS
|
|
||||||
- Add some Huawei models
|
|
||||||
- Add Sharp Aquos TV
|
|
||||||
- Improve detection Xiaomi Mi CC9
|
|
||||||
- Fix Sony Xperia 1 III misidentified as Acer tablet
|
|
||||||
- Fix Detect Sony BRAVIA as SmartTV
|
|
||||||
- Fix Detect Xiaomi Mi TV as SmartTV
|
|
||||||
- Fix Detect Galaxy Tab S8 as tablet
|
|
||||||
- Fix WeGame mistakenly identified as WeChat
|
|
||||||
- Fix included commas in Safari / Mobile Safari version
|
|
||||||
- Increase UA_MAX_LENGTH to 350
|
|
||||||
|
|
||||||
## Version 0.7.31 / 1.0.2
|
|
||||||
|
|
||||||
- Fix OPPO Reno A5 incorrect detection
|
|
||||||
- Fix TypeError Bug
|
|
||||||
- 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 was created by accident. This version is now deprecated and no longer maintained, please update to version 0.7 / 1.0.
|
|
||||||
14
component.json
Normal file
14
component.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "ua-parser-js",
|
||||||
|
"version": "0.7.0",
|
||||||
|
"description": "Lightweight JavaScript-based user-agent string parser",
|
||||||
|
"keywords": ["user-agent", "parser", "browser", "engine", "os", "device", "cpu"],
|
||||||
|
"scripts": ["src/ua-parser.js"],
|
||||||
|
"main": "src/ua-parser.js",
|
||||||
|
"license": "MIT",
|
||||||
|
"development": {
|
||||||
|
"jshint/jshint": "*",
|
||||||
|
"visionmedia/mocha": "*",
|
||||||
|
"mishoo/uglifyjs2": "*"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
dist/ua-parser.html
vendored
1
dist/ua-parser.html
vendored
@@ -1 +0,0 @@
|
|||||||
<script src="./ua-parser.min.js"></script>
|
|
||||||
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
@@ -1,19 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
Before Width: | Height: | Size: 1.2 KiB |
21
license.md
21
license.md
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2012-2023 Faisal Salman <<f@faisalman.com>>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
12
package.js
12
package.js
@@ -1,12 +0,0 @@
|
|||||||
Package.describe({
|
|
||||||
name: 'faisalman:ua-parser-js',
|
|
||||||
version: '2.0.0-alpha.2',
|
|
||||||
summary: 'Lightweight JavaScript-based user-agent string parser',
|
|
||||||
git: 'https://github.com/faisalman/ua-parser-js.git',
|
|
||||||
documentation: 'readme.md'
|
|
||||||
});
|
|
||||||
|
|
||||||
Package.onUse(function (api) {
|
|
||||||
api.addFiles("src/ua-parser.js");
|
|
||||||
api.export("UAParser");
|
|
||||||
});
|
|
||||||
207
package.json
207
package.json
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"title": "UAParser.js",
|
"title": "UAParser.js",
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "2.0.0-alpha.2",
|
"version": "0.7.0",
|
||||||
"author": "Faisal Salman <f@faisalman.com> (http://faisalman.com)",
|
"author": "Faisal Salman <fyzlman@gmail.com> (http://faisalman.com)",
|
||||||
"description": "Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data. Supports browser & node.js environment",
|
"description": "Lightweight JavaScript-based user-agent string parser",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"user-agent",
|
"user-agent",
|
||||||
"parser",
|
"parser",
|
||||||
@@ -11,212 +11,57 @@
|
|||||||
"engine",
|
"engine",
|
||||||
"os",
|
"os",
|
||||||
"device",
|
"device",
|
||||||
"cpu",
|
"cpu"
|
||||||
"jquery-plugin",
|
|
||||||
"ecosystem:jquery"
|
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/faisalman/ua-parser-js",
|
"homepage": "http://github.com/faisalman/ua-parser-js",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Aamir Poonawalla <aamir@urx.com>",
|
"Faisal Salman <fyzlman@gmail.com>",
|
||||||
"Admas <mollases@users.noreply.github.com>",
|
|
||||||
"algenon <m@antonz.ru>",
|
|
||||||
"Alvin Portillo <alvin@8thwall.com>",
|
|
||||||
"Amumu <yoyo837@hotmail.com>",
|
|
||||||
"Andrea Vaghi <andrea.vaghi@jobrapido.com>",
|
|
||||||
"Anton Zhiyanov <m@antonz.ru>",
|
|
||||||
"Arturo Mejia <amejia@blim.com>",
|
|
||||||
"Arun Rama Reddy <arunramareddy@gmail.com>",
|
|
||||||
"Austin Pray <austin@austinpray.com>",
|
|
||||||
"Bendeguz <symunona@gmail.com>",
|
|
||||||
"Benjamin Bertrand <bertrand.design@gmail.com>",
|
"Benjamin Bertrand <bertrand.design@gmail.com>",
|
||||||
"Benjamin Urban <benjamin.urban@sueddeutsche.de>",
|
|
||||||
"boneyao <admin@boneyao.com>",
|
|
||||||
"Carl C Von Lewin <carlchristianlewin@gmail.com>",
|
|
||||||
"CESAR RAMOS <c@imagenproactiva.com>",
|
|
||||||
"Chad Killingsworth <ckillingsworth@jackhenry.com>",
|
|
||||||
"Christopher De Cairos <chris.decairos@gmail.com>",
|
"Christopher De Cairos <chris.decairos@gmail.com>",
|
||||||
"Cyrille David <cyrille@qonto.eu>",
|
|
||||||
"Dario Vladovic <d.vladimyr@gmail.com>",
|
|
||||||
"David Annez <david.annez@gmail.com>",
|
|
||||||
"Davit Barbakadze <jayarjo@gmail.com>",
|
"Davit Barbakadze <jayarjo@gmail.com>",
|
||||||
"ddivernois <david-emmanuel.divernois@amadeus.com>",
|
|
||||||
"Deliaz <D3liaz@gmail.com>",
|
|
||||||
"Demis Palma <demis.palma@gmail.com>",
|
|
||||||
"dhoko <aurelien@protonmail.com>",
|
|
||||||
"dianhe <dianhe@webank.com>",
|
|
||||||
"dineshks1 <dineshks1@d.kumar44@outlook.com>",
|
|
||||||
"Dmitry Tyschenko <dtyschenko@gmail.com>",
|
"Dmitry Tyschenko <dtyschenko@gmail.com>",
|
||||||
"Douglas Li <doug@knotch.it>",
|
"Douglas Li <doug@knotch.it>",
|
||||||
"Dumitru Uzun <contact@duzun.me>",
|
|
||||||
"Dustin <duburns@fanatics.com>",
|
|
||||||
"Elchin Valiyev <elchin.valiyev@autodesk.com>",
|
|
||||||
"Emil Hesslow <hesslow@gmail.com>",
|
|
||||||
"Eric Redon <eric.redon@coox.org>",
|
|
||||||
"Eric Schrenker <eric.schrenker@gmail.com>",
|
|
||||||
"Erik Hesselink <hesselink@gmail.com>",
|
"Erik Hesselink <hesselink@gmail.com>",
|
||||||
"Fabian Becker <halfdan@xnorfz.de>",
|
"Fabian Becker <halfdan@xnorfz.de>",
|
||||||
"Faisal Salman <f@faisalman.com>",
|
"Jackpoll <jackpoll123456@gmail.com>",
|
||||||
"Frédéric Camblor <fcamblor@gmail.com>",
|
|
||||||
"Frederik Ring <frederik.ring@gmail.com>",
|
|
||||||
"Gerald Host <me@jacobford.co.uk>",
|
|
||||||
"Germán M. Bravo <german.mb@gmail.com>",
|
|
||||||
"Grigory Dmitrenko <grigory@snsk.ru>",
|
|
||||||
"gulpin <gulping.gulpin@gmail.com>",
|
|
||||||
"Hendrik Helwich <h.helwich@iplabs.de>",
|
|
||||||
"Hermann Ebert <ebbmo@HE.local>",
|
|
||||||
"hr6r <hedian@gmail.com>",
|
|
||||||
"Igor Topal <i.topal@smartweb.com.ua>",
|
|
||||||
"Ildar Kamalov <i.kamalov@adguard.com>",
|
|
||||||
"insanehong <insane.hong@navercorp.com>",
|
|
||||||
"jackpoll <jackpoll123456@gmail.com>",
|
|
||||||
"Jake Mc <startswithaj@users.noreply.github.com>",
|
"Jake Mc <startswithaj@users.noreply.github.com>",
|
||||||
"JBYoshi <12983479+JBYoshi@users.noreply.github.com>",
|
|
||||||
"Joey Parrish <joeyparrish@google.com>",
|
|
||||||
"John Tantalo <john.tantalo@gmail.com>",
|
"John Tantalo <john.tantalo@gmail.com>",
|
||||||
"John Yanarella <jmy@codecatalyst.com>",
|
"John Yanarella <jmy@codecatalyst.com>",
|
||||||
"Jon Buckley <jon@jbuckley.ca>",
|
"Jon Buckley <jon@jbuckley.ca>",
|
||||||
"Josh Goldberg <joshuakgoldberg@outlook.com>",
|
|
||||||
"Junki-Ishida <junki_ishida@dwango.co.jp>",
|
|
||||||
"Kendall Buchanan <kendall@kendagriff.com>",
|
|
||||||
"Lee Treveil <leetreveil@gmail.com>",
|
"Lee Treveil <leetreveil@gmail.com>",
|
||||||
"leonardo <leofiore@libero.it>",
|
"Leonardo <leofiore@libero.it>",
|
||||||
"Levente Balogh <balogh.levente.hu@gmail.com>",
|
|
||||||
"Liam Quinn <lquinn@blackberry.com>",
|
|
||||||
"Lithin <lithin@webklipper.com>",
|
|
||||||
"ll-syber <670159357@qq.com>",
|
|
||||||
"Loris Guignard <loris.guignard@gmail.com>",
|
|
||||||
"Lukas Drgon <lukas.drgon@gmail.com>",
|
|
||||||
"Lukas Eipert <leipert@users.noreply.github.com>",
|
|
||||||
"Malash <i@malash.me>",
|
|
||||||
"Martynas <martynas@firmfirm.co>",
|
|
||||||
"Masahiko Sato <masasato@yahoo-corp.jp>",
|
|
||||||
"Matt Brophy <matt@brophy.org>",
|
|
||||||
"Matthew Origer <karatecowboy@gmail.com>",
|
|
||||||
"Maximilian Haupt <mail@maximilianhaupt.com>",
|
|
||||||
"Max Maurer <maxemanuel.maurer@gmail.com>",
|
|
||||||
"Max Nordlund <max.nordlund@gmail.com>",
|
|
||||||
"Michael Hess <mhess@connectify.me>",
|
"Michael Hess <mhess@connectify.me>",
|
||||||
"MimyyK <michele.marais@hakisa.com>",
|
|
||||||
"naoh <naoh.cs03g@nctu.edu.tw>",
|
|
||||||
"Nicholas Ionata <nionata@ufl.edu>",
|
|
||||||
"Nikhil Motiani <nikhil.motiani@outlook.com>",
|
|
||||||
"Nik Rolls <nik@rolls.cc>",
|
|
||||||
"nionata <n.ionata129@gmail.com>",
|
|
||||||
"niris <nirisix@gmail.com>",
|
|
||||||
"Nobuo Okada <nookada@yahoo-corp.jp>",
|
|
||||||
"o.drapeza <o.drapeza@tinkoff.ru>",
|
|
||||||
"otakuSiD <otakusid@gmail.com>",
|
|
||||||
"patrick-nurt <github@pereira.dk>",
|
|
||||||
"Pavel Studeny <studeny@avast.com>",
|
|
||||||
"Peter Dave Hello <PeterDaveHello@users.noreply.github.com>",
|
|
||||||
"philippsimon <github@philippsimon.de>",
|
|
||||||
"Pieter Hendrickx <pieter.hendrickx@belfius.be>",
|
|
||||||
"Piper Chester <piperchester@gmail.com>",
|
|
||||||
"Queen Vinyl Darkscratch <vinyldarkscratch@gmail.com>",
|
|
||||||
"Raine Makelainen <raine.makelainen@jolla.com>",
|
|
||||||
"Raman Savaryn <homeneartheocean@gmail.com>",
|
|
||||||
"Robert Tod <robert@qubit.com>",
|
|
||||||
"roman.savarin <roman.savarin@skywindgroup.com>",
|
|
||||||
"Ron Korland <ron@testim.io>",
|
|
||||||
"Ross Noble <rosshnoble@gmail.com>",
|
"Ross Noble <rosshnoble@gmail.com>",
|
||||||
"ruicong <466403866@qq.com>",
|
"Sandro Sonntag <sandro.sonntag@adorsys.de>"
|
||||||
"Sandro Sonntag <sandro.sonntag@adorsys.de>",
|
|
||||||
"sgautrea <shanegautreau@gmail.com>",
|
|
||||||
"Shane Gautreau <sgautrea@opentext.com>",
|
|
||||||
"Shane Thacker <shane@steadymade.com>",
|
|
||||||
"Shreedhar <shreedhar@uber.com>",
|
|
||||||
"Simon Eisenmann <simon@longsleep.org>",
|
|
||||||
"Simon Lang <me@simonlang.org>",
|
|
||||||
"Stiekel <histkc@gmail.com>",
|
|
||||||
"sUP <dani3l@gmail.com>",
|
|
||||||
"Sylvain Gizard <sylvain.gizard@gmail.com>",
|
|
||||||
"szchenghuang <szchenghuang@gmail.com>",
|
|
||||||
"Tanguy Krotoff <tkrotoff@gmail.com>",
|
|
||||||
"Tony Tomarchio <tony@tomarchio.cc>",
|
|
||||||
"Ulrich Schmidt <u.schmidt@velian.de>",
|
|
||||||
"Vadim Kurachevsky <vadim@hmvs.org>",
|
|
||||||
"Yılmaz <yilmazdemir36@gmail.com>",
|
|
||||||
"yuanyang <work_yuanyang@163.com>",
|
|
||||||
"Yun Young-jin <yupmin@yupmin-office-macmini.local>",
|
|
||||||
"Zach Bjornson <zbbjornson@gmail.com>"
|
|
||||||
],
|
],
|
||||||
"type": "commonjs",
|
|
||||||
"main": "src/ua-parser.js",
|
"main": "src/ua-parser.js",
|
||||||
"module": "src/ua-parser.mjs",
|
|
||||||
"exports": {
|
|
||||||
".": {
|
|
||||||
"require": "./src/ua-parser.js",
|
|
||||||
"import": "./src/ua-parser.mjs"
|
|
||||||
},
|
|
||||||
"./enums": {
|
|
||||||
"require": "./src/enum/ua-parser-enum.js",
|
|
||||||
"import": "./src/enum/ua-parser-enum.mjs"
|
|
||||||
},
|
|
||||||
"./extensions": {
|
|
||||||
"require": "./src/extension/ua-parser-extension.js",
|
|
||||||
"import": "./src/extension/ua-parser-extension.mjs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist",
|
|
||||||
"src"
|
|
||||||
],
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "uglifyjs src/ua-parser.js -o dist/ua-parser.min.js --comments '/^ UA/' && uglifyjs src/ua-parser.js -o dist/ua-parser.pack.js --comments '/^ UA/' --compress --mangle && node -e \"const fs=require('fs');fs.writeFileSync('src/ua-parser.mjs','// Generated ESM version of UAParser.js\\n// DO NOT EDIT THIS FILE!\\n// Source: /src/ua-parser.js\\n\\nconst window = undefined;\\n\\n'+fs.readFileSync('src/ua-parser.js','utf-8').replace(/\\(func[\\s\\S]+strict\\';/ig,'').replace(/\\/[\\/\\s]+export[\\s\\S]+/ig,'export {UAParser};'),'utf-8');fs.writeFileSync('src/enum/ua-parser-enum.mjs','// Generated ESM version of UAParser.js enums\\n// DO NOT EDIT THIS FILE!\\n// Source: /src/enum/ua-parser-enum.js\\n\\n'+fs.readFileSync('src/enum/ua-parser-enum.js','utf-8').replace(/module\\.exports =/ig,'export'),'utf-8');fs.writeFileSync('src/extension/ua-parser-extension.mjs','// Generated ESM version of UAParser.js extensions\\n// DO NOT EDIT THIS FILE!\\n// Source: /src/extension/ua-parser-extension.js\\n\\n'+fs.readFileSync('src/extension/ua-parser-extension.js','utf-8').replace(/const UA.+\\)/ig,'import UAParser from \\'ua-parser-js\\'').replace(/module\\.exports =/ig,'export'),'utf-8')\"",
|
"test": "./build/build.sh"
|
||||||
"test": "jshint src/ua-parser.js && mocha -R nyan test",
|
|
||||||
"test-ci": "jshint src/ua-parser.js && mocha -R spec test",
|
|
||||||
"verup": "node ./node_modules/verup",
|
|
||||||
"version": "node ./node_modules/verup 0"
|
|
||||||
},
|
|
||||||
"verup": {
|
|
||||||
"files": [
|
|
||||||
"bower.json",
|
|
||||||
"package.js",
|
|
||||||
"src/ua-parser.js"
|
|
||||||
],
|
|
||||||
"regs": [
|
|
||||||
"^((?:\\$|(\\s*\\*\\s*@)|(\\s*(?:var|,)?\\s+))(?:LIBVERSION|version)[\\s\\:='\"]+)([0-9]+(?:\\.[0-9]+){2,2})",
|
|
||||||
"^(\\/?\\s?\\*.*v)([0-9]+(?:\\.[0-9]+){2,2})"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/parser": "7.15.8",
|
"jshint": "~1.1.0",
|
||||||
"@babel/traverse": "7.15.4",
|
"mocha": "~1.7.1",
|
||||||
"jshint": "~2.12.0",
|
"uglify-js": "~1.3.4"
|
||||||
"mocha": "~8.2.0",
|
|
||||||
"requirejs": "^2.3.2",
|
|
||||||
"safe-regex": "^2.1.1",
|
|
||||||
"uglify-js": "~3.12.0",
|
|
||||||
"verup": "^1.3.x"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository" : {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/faisalman/ua-parser-js.git"
|
"url": "https://github.com/faisalman/ua-parser-js.git"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"licenses": [
|
||||||
|
{
|
||||||
|
"type": "GPLv2",
|
||||||
|
"url": "http://www.gnu.org/licenses/gpl-2.0.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "MIT",
|
||||||
|
"url": "http://www.opensource.org/licenses/mit-license.php"
|
||||||
|
}
|
||||||
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "*"
|
"node": "*"
|
||||||
},
|
},
|
||||||
"directories": {
|
"directories": {
|
||||||
"dist": "dist",
|
"lib": "src",
|
||||||
"src": "src",
|
|
||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
}
|
||||||
"bugs": "https://github.com/faisalman/ua-parser-js/issues",
|
|
||||||
"demo": "https://faisalman.github.io/ua-parser-js",
|
|
||||||
"download": "https://raw.github.com/faisalman/ua-parser-js/master/dist/ua-parser.min.js",
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "opencollective",
|
|
||||||
"url": "https://opencollective.com/ua-parser-js"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "paypal",
|
|
||||||
"url": "https://paypal.me/faisalman"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/faisalman"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
566
readme.md
566
readme.md
@@ -1,144 +1,49 @@
|
|||||||
<p align="center">
|
|
||||||
<img src="https://raw.githubusercontent.com/faisalman/ua-parser-js/gh-pages/images/logo.png" width="256" height="256">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
<a href="https://travis-ci.org/faisalman/ua-parser-js"><img src="https://travis-ci.org/faisalman/ua-parser-js.svg?branch=master"></a>
|
|
||||||
<a href="https://www.npmjs.com/package/ua-parser-js"><img src="https://img.shields.io/npm/v/ua-parser-js.svg"></a>
|
|
||||||
<a href="https://www.npmjs.com/package/ua-parser-js"><img src="https://img.shields.io/npm/dw/ua-parser-js.svg"></a>
|
|
||||||
<a href="https://www.jsdelivr.com/package/npm/ua-parser-js"><img src="https://data.jsdelivr.com/v1/package/npm/ua-parser-js/badge"></a>
|
|
||||||
<a href="https://cdnjs.com/libraries/UAParser.js"><img src="https://img.shields.io/cdnjs/v/UAParser.js.svg"></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
# UAParser.js
|
# UAParser.js
|
||||||
|
|
||||||
JavaScript library to detect Browser, Engine, OS, CPU, and Device type/model from User-Agent & Client-Hints data that can be used either in browser (client-side) or node.js (server-side).
|
Lightweight JavaScript-based User-Agent string parser. Supports browser & node.js environment. Also available as Component package, Bower package, jQuery.ua, & AMD module
|
||||||
|
|
||||||
* Author : Faisal Salman <<f@faisalman.com>>
|
[](https://travis-ci.org/faisalman/ua-parser-js)
|
||||||
* Demo : https://faisalman.github.io/ua-parser-js
|
|
||||||
|
* Author : Faisalman <<fyzlman@gmail.com>>
|
||||||
|
* Demo : http://faisalman.github.com/ua-parser-js
|
||||||
* Source : https://github.com/faisalman/ua-parser-js
|
* Source : https://github.com/faisalman/ua-parser-js
|
||||||
|
|
||||||
***
|
## Features
|
||||||
|
|
||||||
### From Our Sponsors:
|
Extract detailed type of web browser, layout engine, operating system, cpu architecture, and device purely from user-agent string with relatively lightweight footprint (~7KB minified / ~3KB gzipped). Written in vanilla js, which means it doesn't depends on any other library.
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td align="center" width="200px" rowspan="2"><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>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2">
|
|
||||||
<a href="https://opencollective.com/ua-parser-js">↗ Become a sponsor</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
---
|

|
||||||
|
|
||||||
# Version 2.0
|
|
||||||
What's new & breaking, please read [CHANGELOG](changelog.md) before upgrading.
|
|
||||||
|
|
||||||
# Documentation
|
|
||||||
### UAParser([user-agent:string][,extensions:object][,headers:object(since@2.0)])
|
|
||||||
|
|
||||||
In the browser environment you dont need to pass the user-agent string to the function, you can just call the funtion and it should automatically get the string from the `window.navigator.userAgent`, but that is not the case in nodejs. The user-agent string must be passed in' nodejs for the function to work. Usually you can find the user agent in: `request.headers["user-agent"]`.
|
|
||||||
|
|
||||||
|
|
||||||
## Constructor
|
|
||||||
When you call `UAParser` with the `new` keyword, `UAParser` will return a new instance with an empty result object, you have to call one of the available methods to get the information from the user-agent string.
|
|
||||||
Like so:
|
|
||||||
* `new UAParser([user-agent:string][,extensions:object][,headers:object(since@2.0)])`
|
|
||||||
```js
|
|
||||||
let parser = new UAParser("your user-agent here"); // you need to pass the user-agent for nodejs
|
|
||||||
console.log(parser); // {}
|
|
||||||
let parserResults = parser.getResult();
|
|
||||||
console.log(parserResults);
|
|
||||||
/** {
|
|
||||||
"ua" : "",
|
|
||||||
"browser" : {},
|
|
||||||
"engine" : {},
|
|
||||||
"os" : {},
|
|
||||||
"device" : {},
|
|
||||||
"cpu" : {}
|
|
||||||
} */
|
|
||||||
```
|
|
||||||
|
|
||||||
When you call UAParser without the `new` keyword, it will automatically call `getResult()` function and return the parsed results.
|
|
||||||
* `UAParser([user-agent:string][,extensions:object][,headers:object(since@2.0)])`
|
|
||||||
* returns result object `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`
|
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
#### Methods table
|
|
||||||
The methods are self explanatory, here's a small overview on all the available methods:
|
|
||||||
* `getResult()` - returns all function object calls, user-agent string, browser info, cpu, device, engine, os:
|
|
||||||
`{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`.
|
|
||||||
|
|
||||||
* `getBrowser()` - returns the browser name and version.
|
|
||||||
* `getDevice()` - returns the device model, type, vendor.
|
|
||||||
* `getEngine()` - returns the current browser engine name and version.
|
|
||||||
* `getOS()` - returns the running operating system name and version.
|
|
||||||
* `getCPU()` - returns CPU architectural design name.
|
|
||||||
* `getUA()` - returns the user-agent string.
|
|
||||||
* `setUA(user-agent)` - set a custom user-agent to be parsed.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
* `getResult()`
|
|
||||||
* returns `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`
|
|
||||||
|
|
||||||
* `getBrowser()`
|
* `getBrowser()`
|
||||||
* returns `{ name: '', version: '' }`
|
* returns `{ name: '', major: '', version: '' }`
|
||||||
|
|
||||||
```sh
|
```
|
||||||
# Possible 'browser.name':
|
# Possible 'browser.name':
|
||||||
2345Explorer, 360 Browser, Amaya, Android Browser, Arora, Avant, Avast, AVG,
|
Amaya, Arora, Avant, Baidu, Blazer, Bolt, Camino, Chimera, Chrome, Chromium,
|
||||||
BIDUBrowser, Baidu, Basilisk, Blazer, Bolt, Brave, Bowser, Camino, Chimera,
|
Comodo Dragon, Conkeror, Dillo, Dolphin, Doris, Epiphany, Fennec, Firebird,
|
||||||
[Mobile] Chrome [Headless/WebView], Chromium, Cobalt, Comodo Dragon, Dillo,
|
Firefox, Flock, GoBrowser, iCab, ICE Browser, IceApe, IceCat, IceDragon,
|
||||||
Dolphin, Doris, DuckDuckGo, Edge, Electron, Epiphany, Facebook, Falkon, Fennec,
|
Iceweasel, IE [Mobile], Iron, Jasmine, K-Meleon, Konqueror, Kindle, Links,
|
||||||
Firebird, [Mobile] Firefox [Focus/Reality], Flock, Flow, GSA, GoBrowser, HeyTap,
|
Lunascape, Lynx, Maemo, Maxthon, Midori, Minimo, [Mobile] Safari, Mosaic, Mozilla,
|
||||||
Huawei Browser, ICE Browser, IE, IEMobile, IceApe, IceCat, IceDragon, Iceweasel,
|
Netfront, Netscape, NetSurf, Nokia, OmniWeb, Opera [Mini/Mobi/Tablet], Phoenix,
|
||||||
Instagram, Iridium, Iron, Jasmine, Kakao[Story/Talk], K-Meleon, Kindle, Klar,
|
Polaris, QQBrowser, RockMelt, Silk, Skyfire, SeaMonkey, SlimBrowser, Swiftfox,
|
||||||
Konqueror, LBBROWSER, Line, LinkedIn, Links, Lunascape, Lynx, MIUI Browser,
|
Tizen, UCBrowser, w3m, Yandex
|
||||||
Maemo Browser, Maemo, Maxthon, MetaSr Midori, Minimo, Mosaic, Mozilla, NetFront,
|
|
||||||
NetSurf, Netfront, Netscape, NokiaBrowser, Obigo, Oculus Browser, OmniWeb,
|
|
||||||
Opera Coast, Opera [Mini/Mobi/Tablet], PaleMoon, PhantomJS, Phoenix, Polaris,
|
|
||||||
Puffin, QQ, QQBrowser, QQBrowserLite, Quark, QupZilla, RockMelt, [Mobile] Safari,
|
|
||||||
Sailfish Browser, Samsung Browser, SeaMonkey, Silk, Skyfire, Sleipnir, Slim,
|
|
||||||
SlimBrowser, Swiftfox, Tesla, TikTok, Tizen Browser, UCBrowser, UP.Browser, Viera,
|
|
||||||
Vivaldi, Waterfox, WeChat, Weibo, Yandex, baidu, iCab, w3m, Whale Browser, ...
|
|
||||||
|
|
||||||
# 'browser.version' determined dynamically
|
# 'browser.version' & 'browser.major' determined dynamically
|
||||||
```
|
```
|
||||||
|
|
||||||
* `getDevice()`
|
* `getDevice()`
|
||||||
* returns `{ model: '', type: '', vendor: '' }`
|
* returns `{ model: '', type: '', vendor: '' }`
|
||||||
|
|
||||||
```sh
|
```
|
||||||
# Possible 'device.type':
|
# Possible 'device.type':
|
||||||
console, mobile, tablet, smarttv, wearable, embedded
|
console, mobile, tablet
|
||||||
|
|
||||||
##########
|
|
||||||
# NOTE: 'desktop' is not a possible device type.
|
|
||||||
# UAParser only reports info directly available from the UA string, which is not the case for 'desktop' device type.
|
|
||||||
# If you wish to detect desktop devices, you must handle the needed logic yourself.
|
|
||||||
# You can read more about it in this issue: https://github.com/faisalman/ua-parser-js/issues/182
|
|
||||||
##########
|
|
||||||
|
|
||||||
# Possible 'device.vendor':
|
# Possible 'device.vendor':
|
||||||
Acer, Alcatel, Amazon, Apple, Archos, ASUS, AT&T, BenQ, BlackBerry, Dell,
|
Acer, Alcatel, Apple, Asus, BenQ, BlackBerry, Dell, GeeksPhone, HP, HTC, Huawei,
|
||||||
Essential, Facebook, Fairphone, GeeksPhone, Google, HP, HTC, Huawei, Jolla, Kobo,
|
Lenovo, LG, Meizu, Motorola, Nexian, Nintendo, Nokia, Palm, Panasonic,
|
||||||
Lenovo, LG, Meizu, Microsoft, Motorola, Nexian, Nintendo, Nokia, Nvidia, OnePlus,
|
RIM, Samsung, Siemens, Sony-Ericsson, Sprint, ZTE
|
||||||
OPPO, Ouya, Palm, Panasonic, Pebble, Polytron, Realme, RIM, Roku, Samsung, Sharp,
|
|
||||||
Siemens, Sony[Ericsson], Sprint, Tesla, Vivo, Vodafone, Xbox, Xiaomi, Zebra, ZTE, ...
|
|
||||||
|
|
||||||
# 'device.model' determined dynamically
|
# 'device.model' determined dynamically
|
||||||
```
|
```
|
||||||
@@ -146,10 +51,10 @@ Siemens, Sony[Ericsson], Sprint, Tesla, Vivo, Vodafone, Xbox, Xiaomi, Zebra, ZTE
|
|||||||
* `getEngine()`
|
* `getEngine()`
|
||||||
* returns `{ name: '', version: '' }`
|
* returns `{ name: '', version: '' }`
|
||||||
|
|
||||||
```sh
|
```
|
||||||
# Possible 'engine.name'
|
# Possible 'engine.name'
|
||||||
Amaya, Blink, EdgeHTML, Flow, Gecko, Goanna, iCab, KHTML, LibWeb, Links, Lynx,
|
Amaya, Gecko, iCab, KHTML, Links, Lynx, NetFront, NetSurf, Presto, Tasman,
|
||||||
NetFront, NetSurf, Presto, Tasman, Trident, w3m, WebKit
|
Trident, w3m, WebKit
|
||||||
|
|
||||||
# 'engine.version' determined dynamically
|
# 'engine.version' determined dynamically
|
||||||
```
|
```
|
||||||
@@ -157,17 +62,14 @@ NetFront, NetSurf, Presto, Tasman, Trident, w3m, WebKit
|
|||||||
* `getOS()`
|
* `getOS()`
|
||||||
* returns `{ name: '', version: '' }`
|
* returns `{ name: '', version: '' }`
|
||||||
|
|
||||||
```sh
|
```
|
||||||
# Possible 'os.name'
|
# Possible 'os.name'
|
||||||
AIX, Amiga OS, Android[-x86], Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS,
|
AIX, Amiga OS, Android, Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS,
|
||||||
Contiki, Fedora, Firefox OS, FreeBSD, Debian, Deepin, DragonFly, elementary OS,
|
Fedora, Firefox OS, FreeBSD, Debian, DragonFly, Gentoo, GNU, Haiku, Hurd, iOS,
|
||||||
Fuchsia, Gentoo, GhostBSD, GNU, Haiku, HarmonyOS, HP-UX, Hurd, iOS, Joli, KaiOS,
|
Joli, Linux, Mac OS, Mandriva, MeeGo, Minix, Mint, Morph OS, NetBSD, Nintendo,
|
||||||
Linpus, Linspire,Linux, Mac OS, Maemo, Mageia, Mandriva, Manjaro, MeeGo, Minix,
|
OpenBSD, OS/2, Palm, PCLinuxOS, Plan9, Playstation, QNX, RedHat, RIM Tablet OS,
|
||||||
Mint, Morph OS, NetBSD, NetRange, NetTV, Nintendo, OpenBSD, OpenVMS, OS/2, Palm,
|
RISC OS, Slackware, Solaris, SUSE, Symbian, Tizen, Ubuntu, UNIX, WebOS,
|
||||||
PC-BSD, PCLinuxOS, Plan9, PlayStation, QNX, Raspbian, RedHat, RIM Tablet OS,
|
Windows [Phone/Mobile], Zenwalk
|
||||||
RISC OS, Sabayon, Sailfish, SerenityOS, Series40, Slackware, Solaris, SUSE, Symbian,
|
|
||||||
Tizen, Ubuntu, Unix, VectorLinux, Viera, watchOS, WebOS, Windows [Phone/Mobile],
|
|
||||||
Zenwalk, ...
|
|
||||||
|
|
||||||
# 'os.version' determined dynamically
|
# 'os.version' determined dynamically
|
||||||
```
|
```
|
||||||
@@ -175,241 +77,33 @@ Zenwalk, ...
|
|||||||
* `getCPU()`
|
* `getCPU()`
|
||||||
* returns `{ architecture: '' }`
|
* returns `{ architecture: '' }`
|
||||||
|
|
||||||
```sh
|
```
|
||||||
# Possible 'cpu.architecture'
|
# Possible 'cpu.architecture'
|
||||||
68k, amd64, arm[64/hf], avr, ia[32/64], irix[64], mips[64], pa-risc, ppc, sparc[64]
|
68k, amd64, arm, ia32, ia64, irix, irix64, mips, mips64, pa-risc, ppc, sparc, sparc64
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* `getResult()`
|
||||||
|
* returns `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`
|
||||||
* `getUA()`
|
* `getUA()`
|
||||||
* returns UA string of current instance
|
* returns UA string of current instance
|
||||||
|
|
||||||
* `setUA(uastring)`
|
* `setUA(uastring)`
|
||||||
* set UA string to be parsed
|
* set & parse UA string
|
||||||
* returns current instance
|
|
||||||
|
|
||||||
#### * `is():boolean` utility `since@2.0`
|
## Example
|
||||||
|
|
||||||
```js
|
|
||||||
// Is just a shorthand comparison to check whether the value of specified item equals one of its properties (in a case-insensitive way)
|
|
||||||
// so that instead of write it using `==` operator like this:
|
|
||||||
|
|
||||||
let ua = UAParser();
|
|
||||||
let device = ua.device;
|
|
||||||
let os = ua.os;
|
|
||||||
|
|
||||||
if (device.type == "mobile" && os.name != "iOS") {}
|
|
||||||
if (device.type == "smarttv" || device.vendor == "Samsung") {}
|
|
||||||
|
|
||||||
// we can also write the comparison above into as follow:
|
|
||||||
|
|
||||||
if (device.is("mobile") && !os.is("iOS")) {}
|
|
||||||
if (device.is("SmartTV") || device.is("SaMsUnG")) {}
|
|
||||||
|
|
||||||
/*
|
|
||||||
For device, properties will be checked in this particular order: type, model, vendor
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Another examples:
|
|
||||||
|
|
||||||
let uap = new UAParser('Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 635) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537');
|
|
||||||
|
|
||||||
uap.getBrowser().name; // "IEMobile"
|
|
||||||
uap.getBrowser().is("IEMobile"); // true
|
|
||||||
uap.getCPU().is("ARM"); // true
|
|
||||||
|
|
||||||
uap.getOS().name; // "Windows Phone"
|
|
||||||
uap.getOS().is("Windows Phone"); // true
|
|
||||||
|
|
||||||
uap.getDevice(); // { vendor: "Nokia", model: "Lumia 635", type: "mobile" }
|
|
||||||
uap.getResult().device; // { vendor: "Nokia", model: "Lumia 635", type: "mobile" }
|
|
||||||
|
|
||||||
let device = uap.getDevice();
|
|
||||||
device.is("mobile"); // true
|
|
||||||
device.is("Lumia 635"); // true
|
|
||||||
device.is("Nokia"); // true
|
|
||||||
device.is("iPhone"); // false
|
|
||||||
uap.getResult().device.is("Nokia"); // true
|
|
||||||
uap.getResult().device.model; // "Lumia 635"
|
|
||||||
|
|
||||||
uap.setUA("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36");
|
|
||||||
|
|
||||||
let browser = uap.getBrowser();
|
|
||||||
browser.is("IEMobile"); // false
|
|
||||||
browser.is("Chrome"); // true
|
|
||||||
|
|
||||||
uap.getResult().browser.is("Edge"); // false
|
|
||||||
uap.getResult().os.name // "Mac OS"
|
|
||||||
uap.getResult().os.is("Mac OS"); // true
|
|
||||||
uap.getResult().os.version; // "10.6.8"
|
|
||||||
|
|
||||||
let engine = uap.getEngine();
|
|
||||||
engine.is("Blink"); // true
|
|
||||||
```
|
|
||||||
|
|
||||||
#### * `toString():string` utility `since@2.0`
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Retrieve full-name values as a string
|
|
||||||
|
|
||||||
/*
|
|
||||||
Values will be concatenated following this pattern:
|
|
||||||
* browser : name + version
|
|
||||||
* cpu : architecture
|
|
||||||
* device : vendor + model
|
|
||||||
* engine : name + version
|
|
||||||
* os : name + version
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Usage examples
|
|
||||||
|
|
||||||
let uap = new UAParser('Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 635) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537');
|
|
||||||
|
|
||||||
uap.getDevice(); // {
|
|
||||||
// vendor: "Nokia",
|
|
||||||
// model: "Lumia 635",
|
|
||||||
// type: "mobile"
|
|
||||||
// }
|
|
||||||
uap.getDevice().toString(); // "Nokia Lumia 635"
|
|
||||||
|
|
||||||
uap.getResult().os.name; // "Windows Phone"
|
|
||||||
uap.getResult().os.version; // "8.1"
|
|
||||||
uap.getResult().os.toString(); // "Windows Phone 8.1"
|
|
||||||
|
|
||||||
uap.setUA("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36");
|
|
||||||
uap.getBrowser().name; // "Chrome"
|
|
||||||
uap.getBrowser().version; // "28.0.1500.95"
|
|
||||||
uap.getBrowser().major; // "28"
|
|
||||||
uap.getBrowser().toString(); // "Chrome 28.0.1500.95"
|
|
||||||
|
|
||||||
let engine = uap.getEngine();
|
|
||||||
engine.name; // "Blink"
|
|
||||||
engine.version; // "28.0.1500.95"
|
|
||||||
engine.toString(); // "Blink 28.0.1500.95"
|
|
||||||
```
|
|
||||||
|
|
||||||
#### * `withClientHints():Promise<object>|Thenable<object>|object` `since@2.0`
|
|
||||||
|
|
||||||
Recently, Chrome limits the information exposed through user-agent and introduces a new experimental set of data called "client-hints". In browser-environment, obtaining the client-hints data via JavaScript must be done in an asynchronous way. In `UAParser` you can chain the result object from `get*` method with `withClientHints()` to also read the client-hints data from the browser and return the updated data as a `Promise`.
|
|
||||||
|
|
||||||
```js
|
|
||||||
// client-side example
|
|
||||||
(async function () {
|
|
||||||
let ua = new UAParser();
|
|
||||||
|
|
||||||
// get browser data from user-agent only :
|
|
||||||
let browser = ua.getBrowser();
|
|
||||||
console.log('Using User-Agent: ', browser);
|
|
||||||
|
|
||||||
// get browser data from client-hints (with user-agent as fallback) :
|
|
||||||
browser = await ua.getBrowser().withClientHints();
|
|
||||||
console.log('Using Client-Hints: ', browser);
|
|
||||||
|
|
||||||
// alternatively :
|
|
||||||
ua.getBrowser().withClientHints().then(function (browser) {
|
|
||||||
console.log('Using Client-Hints: ', browser);
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
```
|
|
||||||
|
|
||||||
Along with `User-Agent` HTTP header, Chrome also sends this client-hints data by default under `Sec-CH-UA-*` HTTP headers in each request. In server-side development, you can capture this extra information by passing the `req.headers` to `UAParser()` (see examples below). When using `withClientHints()` in nodejs environment and browser without client-hints support (basically anything that's not Chromium-based), it will returns a new object with updated data.
|
|
||||||
|
|
||||||
```js
|
|
||||||
// server-side example
|
|
||||||
|
|
||||||
// Suppose we got a request having these HTTP headers:
|
|
||||||
const request = {
|
|
||||||
headers : {
|
|
||||||
'user-agent' : 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36',
|
|
||||||
|
|
||||||
'sec-ch-ua-mobile' : '?1',
|
|
||||||
'sec-ch-ua-model' : 'Galaxy S3 Marketing',
|
|
||||||
'sec-ch-ua-platform' : 'Android'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const result1 = UAParser(request.headers); // parse only "user-agent" header
|
|
||||||
const result2 = UAParser(request.headers).withClientHints(); // update with "sec-ch-ua" headers
|
|
||||||
|
|
||||||
console.log(result1.os.name); // "Linux"
|
|
||||||
console.log(result1.device.type); // undefined
|
|
||||||
console.log(result1.device.model); // undefined
|
|
||||||
|
|
||||||
console.log(result2.os.name); // "Android"
|
|
||||||
console.log(result2.device.type); // "mobile"
|
|
||||||
console.log(result2.device.model); // "Galaxy S3 Marketing"
|
|
||||||
|
|
||||||
new UAParser(request.headers)
|
|
||||||
.getBrowser()
|
|
||||||
.withClientHints()
|
|
||||||
.then((browser) => {
|
|
||||||
console.log(browser.toString()); // Chrome 110.0.0.0
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## Extending Regex
|
|
||||||
|
|
||||||
If you want to detect something that's not currently provided by UAParser.js (eg: `bots`, specific apps, etc), you can pass a list of regexes to extend internal UAParser.js regexes with your own.
|
|
||||||
|
|
||||||
* `UAParser([uastring,] extensions [,headers:object(since@2.0)])`
|
|
||||||
|
|
||||||
```js
|
|
||||||
// Example:
|
|
||||||
const myOwnListOfBrowsers = [
|
|
||||||
[/(mybrowser)\/([\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION, ['type', 'bot']]
|
|
||||||
];
|
|
||||||
|
|
||||||
const myUA = 'Mozilla/5.0 MyBrowser/1.3';
|
|
||||||
|
|
||||||
let myParser = new UAParser({ browser: myOwnListOfBrowsers });
|
|
||||||
|
|
||||||
console.log(myParser.setUA(myUA).getBrowser()); // {name: "MyBrowser", version: "1.3", major: "1", type : "bot"}
|
|
||||||
console.log(myParser.getBrowser().is('bot')); // true
|
|
||||||
|
|
||||||
// Another example:
|
|
||||||
const myOwnListOfDevices = [
|
|
||||||
[/(mytab) ([\w ]+)/i], [UAParser.DEVICE.VENDOR, UAParser.DEVICE.MODEL, [UAParser.DEVICE.TYPE, UAParser.DEVICE.TABLET]],
|
|
||||||
[/(myphone)/i], [UAParser.DEVICE.VENDOR, [UAParser.DEVICE.TYPE, UAParser.DEVICE.MOBILE]]
|
|
||||||
];
|
|
||||||
|
|
||||||
const myUA2 = 'Mozilla/5.0 MyTab 14 Pro Max';
|
|
||||||
|
|
||||||
let myParser2 = new UAParser({
|
|
||||||
browser: myOwnListOfBrowsers,
|
|
||||||
device: myOwnListOfDevices
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(myParser2.setUA(myUA2).getDevice()); // {vendor: "MyTab", model: "14 Pro Max", type: "tablet"}
|
|
||||||
```
|
|
||||||
|
|
||||||
Some basic extensions (although not very complete at the moment) can also be found under `ua-parser-js/extensions` submodule.
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { UAParser } from 'ua-parser-js';
|
|
||||||
import { Emails } from 'ua-parser-js/extensions';
|
|
||||||
|
|
||||||
const browser = new UAParser(Emails)
|
|
||||||
.setUA('Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0')
|
|
||||||
.getBrowser();
|
|
||||||
|
|
||||||
console.log(browser.name); // Thunderbird
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
# Usage
|
|
||||||
|
|
||||||
## Using HTML
|
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script src="ua-parser.min.js"></script>
|
<script type="text/javascript" src="ua-parser.min.js"></script>
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
|
|
||||||
var uap = new UAParser();
|
var parser = new UAParser();
|
||||||
console.log(uap.getResult());
|
|
||||||
|
// by default it takes ua string from current browser's window.navigator.userAgent
|
||||||
|
console.log(parser.getResult());
|
||||||
/*
|
/*
|
||||||
/// This will print an object structured like this:
|
/// this will print an object structured like this:
|
||||||
{
|
{
|
||||||
ua: "",
|
ua: "",
|
||||||
browser: {
|
browser: {
|
||||||
@@ -435,32 +129,32 @@ console.log(browser.name); // Thunderbird
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// Default result depends on current window.navigator.userAgent value
|
|
||||||
|
|
||||||
// Now let's try a custom user-agent string as an example
|
// let's test a custom user-agent string as an example
|
||||||
var uastring1 = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/11.10 Chromium/15.0.874.106 Chrome/15.0.874.106 Safari/535.2";
|
var uastring = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/11.10 Chromium/15.0.874.106 Chrome/15.0.874.106 Safari/535.2";
|
||||||
uap.setUA(uastring1);
|
parser.setUA(uastring);
|
||||||
var result = uap.getResult();
|
|
||||||
// You can also use UAParser constructor directly without having to create an instance:
|
|
||||||
// var ua = UAParser(uastring1);
|
|
||||||
|
|
||||||
console.log(result.browser); // {name: "Chromium", version: "15.0.874.106"}
|
var result = parser.getResult();
|
||||||
|
// this will also produce the same result (without instantiation):
|
||||||
|
// var result = UAParser(uastring);
|
||||||
|
|
||||||
|
console.log(result.browser); // {name: "Chromium", major: "15", version: "15.0.874.106"}
|
||||||
console.log(result.device); // {model: undefined, type: undefined, vendor: undefined}
|
console.log(result.device); // {model: undefined, type: undefined, vendor: undefined}
|
||||||
console.log(result.os); // {name: "Ubuntu", version: "11.10"}
|
console.log(result.os); // {name: "Ubuntu", version: "11.10"}
|
||||||
console.log(result.os.version); // "11.10"
|
console.log(result.os.version); // "11.10"
|
||||||
console.log(result.engine.name); // "WebKit"
|
console.log(result.engine.name); // "WebKit"
|
||||||
console.log(result.cpu.architecture); // "amd64"
|
console.log(result.cpu.architecture); // "amd64"
|
||||||
|
|
||||||
// Do some other tests
|
// do some other tests
|
||||||
var uastring2 = "Mozilla/5.0 (compatible; Konqueror/4.1; OpenBSD) KHTML/4.1.4 (like Gecko)";
|
var uastring2 = "Mozilla/5.0 (compatible; Konqueror/4.1; OpenBSD) KHTML/4.1.4 (like Gecko)";
|
||||||
console.log(uap.setUA(uastring2).getBrowser().name); // "Konqueror"
|
console.log(parser.setUA(uastring2).getBrowser().name); // "Konqueror"
|
||||||
console.log(uap.getOS()); // {name: "OpenBSD", version: undefined}
|
console.log(parser.getOS()); // {name: "OpenBSD", version: undefined}
|
||||||
console.log(uap.getEngine()); // {name: "KHTML", version: "4.1.4"}
|
console.log(parser.getEngine()); // {name: "KHTML", version: "4.1.4"}
|
||||||
|
|
||||||
var uastring3 = 'Mozilla/5.0 (PlayBook; U; RIM Tablet OS 1.0.0; en-US) AppleWebKit/534.11 (KHTML, like Gecko) Version/7.1.0.7 Safari/534.11';
|
var uastring3 = 'Mozilla/5.0 (PlayBook; U; RIM Tablet OS 1.0.0; en-US) AppleWebKit/534.11 (KHTML, like Gecko) Version/7.1.0.7 Safari/534.11';
|
||||||
console.log(uap.setUA(uastring3).getDevice().model); // "PlayBook"
|
console.log(parser.setUA(uastring3).getDevice().model); // "PlayBook"
|
||||||
console.log(uap.getOS()) // {name: "RIM Tablet OS", version: "1.0.0"}
|
console.log(parser.getOS()) // {name: "RIM Tablet OS", version: "1.0.0"}
|
||||||
console.log(uap.getBrowser().name); // "Safari"
|
console.log(parser.getBrowser().name); // "Safari"
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
@@ -469,77 +163,60 @@ console.log(browser.name); // Thunderbird
|
|||||||
</html>
|
</html>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Using node.js
|
### Using node.js
|
||||||
|
|
||||||
Note: Device information is not available in the NodeJS environment.
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ npm install ua-parser-js
|
$ npm install ua-parser-js
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var http = require('http');
|
var UAParser = require('ua-parser-js');
|
||||||
var uap = require('ua-parser-js');
|
var parser = new UAParser();
|
||||||
|
var ua = request.headers['user-agent']; // user-agent header from an HTTP request
|
||||||
http.createServer(function (req, res) {
|
console.log(parser.setUA(ua).getResult());
|
||||||
// get user-agent header
|
|
||||||
var ua = uap(req.headers['user-agent']);
|
|
||||||
|
|
||||||
/* // BEGIN since@2.0 - you can also pass client-hints data to UAParser
|
|
||||||
|
|
||||||
// note: only works in secure context (https:// or localhost or file://)
|
|
||||||
|
|
||||||
var getHighEntropyValues = 'Sec-CH-UA-Full-Version-List, Sec-CH-UA-Mobile, Sec-CH-UA-Model, Sec-CH-UA-Platform, Sec-CH-UA-Platform-Version, Sec-CH-UA-Arch, Sec-CH-UA-Bitness';
|
|
||||||
res.setHeader('Accept-CH', getHighEntropyValues);
|
|
||||||
res.setHeader('Critical-CH', getHighEntropyValues);
|
|
||||||
|
|
||||||
var ua = uap(req.headers).withClientHints();
|
|
||||||
|
|
||||||
// END since@2.0 */
|
|
||||||
|
|
||||||
// write the result as response
|
|
||||||
res.end(JSON.stringify(ua, null, ' '));
|
|
||||||
})
|
|
||||||
.listen(1337, '127.0.0.1');
|
|
||||||
|
|
||||||
console.log('Server running at http://127.0.0.1:1337/');
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Using ES Modules
|
### Using requirejs
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { UAParser } from 'ua-parser-js';
|
require(['ua-parser'], function(UAParser) {
|
||||||
|
var parser = new UAParser();
|
||||||
const { browser, cpu, device } = UAParser('Mozilla/5.0 (X11; U; Linux armv7l; en-GB; rv:1.9.2a1pre) Gecko/20090928 Firefox/3.5 Maemo Browser 1.4.1.22 RX-51 N900');
|
console.log(parser.getResult());
|
||||||
|
});
|
||||||
console.log(browser.name); // Maemo Browser
|
|
||||||
console.log(cpu.is('arm')); // true
|
|
||||||
console.log(device.is('mobile')); // true
|
|
||||||
console.log(device.model); // N900
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Using TypeScript
|
### Using component
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ npm install --save @types/ua-parser-js
|
$ component install faisalman/ua-parser-js
|
||||||
# Download TS type definition from DefinitelyTyped repository:
|
|
||||||
# https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ua-parser-js
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Using jQuery/Zepto ($.ua)
|
```js
|
||||||
|
var UAParser = require('ua-parser-js');
|
||||||
|
var parser = new UAParser();
|
||||||
|
console.log(parser.getResult());
|
||||||
|
```
|
||||||
|
|
||||||
Although written in vanilla js, this library will automatically detect if jQuery/Zepto is present and create `$.ua` object (with values based on its User-Agent) along with `window.UAParser` constructor. To get/set user-agent you can use: `$.ua.get()` / `$.ua.set(uastring)`.
|
### Using bower
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ bower install ua-parser-js
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using jQuery.ua
|
||||||
|
|
||||||
|
Although written in vanilla js (which means it doesn't depends on jQuery), this library will automatically detect if jQuery is present and create `$.ua` object based on browser's user-agent (although in case you need, `window.UAParser` constructor is still present). To get/set user-agent you can use: `$.ua.get()` / `$.ua.set(uastring)`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// Say we are in a browser with default user-agent: 'Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Sprint APA7373KT Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0':
|
// In browser with default user-agent: 'Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Sprint APA7373KT Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0':
|
||||||
|
|
||||||
// Get the details
|
// Do some tests
|
||||||
console.log($.ua.device); // {vendor: "HTC", model: "Evo Shift 4G", type: "mobile"}
|
console.log($.ua.device); // {vendor: "HTC", model: "Evo Shift 4G", type: "mobile"}
|
||||||
console.log($.ua.os); // {name: "Android", version: "2.3.4"}
|
console.log($.ua.os); // {name: "Android", version: "2.3.4"}
|
||||||
console.log($.ua.os.name); // "Android"
|
console.log($.ua.os.name); // "Android"
|
||||||
console.log($.ua.get()); // "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Sprint APA7373KT Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0"
|
console.log($.ua.get()); // "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Sprint APA7373KT Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0"
|
||||||
|
|
||||||
// Now lets try to reset to another custom user-agent
|
// reset to custom user-agent
|
||||||
$.ua.set('Mozilla/5.0 (Linux; U; Android 3.0.1; en-us; Xoom Build/HWI69) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13');
|
$.ua.set('Mozilla/5.0 (Linux; U; Android 3.0.1; en-us; Xoom Build/HWI69) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13');
|
||||||
|
|
||||||
// Test again
|
// Test again
|
||||||
@@ -547,57 +224,36 @@ console.log($.ua.browser.name); // "Safari"
|
|||||||
console.log($.ua.engine.name); // "Webkit"
|
console.log($.ua.engine.name); // "Webkit"
|
||||||
console.log($.ua.device); // {vendor: "Motorola", model: "Xoom", type: "tablet"}
|
console.log($.ua.device); // {vendor: "Motorola", model: "Xoom", type: "tablet"}
|
||||||
console.log(parseInt($.ua.browser.version.split('.')[0], 10)); // 4
|
console.log(parseInt($.ua.browser.version.split('.')[0], 10)); // 4
|
||||||
|
|
||||||
// Add class to <body> tag
|
|
||||||
// <body class="ua-browser-safari ua-devicetype-tablet">
|
|
||||||
$('body').addClass('ua-browser-' + $.ua.browser.name + ' ua-devicetype-' + $.ua.device.type);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# Development
|
## Development
|
||||||
|
|
||||||
## Backers & Sponsors
|
Install dependencies
|
||||||
|
|
||||||
<a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/organizations.svg?avatarHeight=64"></a>
|
```sh
|
||||||
<a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/individuals.svg?avatarHeight=64"></a>
|
$ npm install jshint
|
||||||
|
$ npm install mocha
|
||||||
|
$ npm install uglify-js
|
||||||
|
```
|
||||||
|
|
||||||
<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>
|
Verify, test, & minify script
|
||||||
|
|
||||||
## Contributors
|
```sh
|
||||||
|
$ ./build/build.sh
|
||||||
|
```
|
||||||
|
|
||||||
<a href="https://github.com/faisalman/ua-parser-js/graphs/contributors">
|
## License
|
||||||
<img src="https://contrib.rocks/image?repo=faisalman/ua-parser-js" />
|
|
||||||
</a>
|
|
||||||
|
|
||||||
Made with [contributors-img](https://contrib.rocks).
|
Dual licensed under GPLv2 & MIT
|
||||||
|
|
||||||
## How To Contribute
|
Copyright © 2012-2013 Faisalman <<fyzlman@gmail.com>>
|
||||||
|
|
||||||
* Fork and clone this repository
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
* Make some changes as required
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
* Write unit test to showcase its functionality
|
the Software without restriction, including without limitation the rights to use,
|
||||||
* Run the test suites to make sure it's not breaking anything `$ npm test`
|
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||||
* Submit a pull request under `develop` branch
|
Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
# License
|
|
||||||
|
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2012-2023 Faisal Salman <<f@faisalman.com>>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
The above copyright notice and this permission notice shall be included in all
|
||||||
copies or substantial portions of the Software.
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
# Security Policy
|
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
|
||||||
|
|
||||||
Please report security issues to `f@faisalman.com`
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
///////////////////////////////////////////////
|
|
||||||
/* Enums for UAParser.js v2.0.0-alpha.2
|
|
||||||
https://github.com/faisalman/ua-parser-js
|
|
||||||
Author: Faisal Salman <f@faisalman.com>
|
|
||||||
MIT License */
|
|
||||||
//////////////////////////////////////////////
|
|
||||||
|
|
||||||
const BrowserName = Object.freeze({
|
|
||||||
CHROME : 'Chrome',
|
|
||||||
EDGE : 'Edge',
|
|
||||||
SAFARI : 'Safari',
|
|
||||||
FIREFOX : 'Firefox',
|
|
||||||
OPERA : 'Opera',
|
|
||||||
MOBILE_CHROME : 'Mobile Chrome',
|
|
||||||
MOBILE_SAFARI : 'Mobile Safari',
|
|
||||||
MOBILE_FIREFOX : 'Mobile Firefox',
|
|
||||||
ANDROID_BROWSER : 'Android Browser'
|
|
||||||
|
|
||||||
// TODO : test!
|
|
||||||
});
|
|
||||||
|
|
||||||
const CPUArch = Object.freeze({
|
|
||||||
IA32 : 'ia32',
|
|
||||||
AMD64 : 'amd64',
|
|
||||||
IA64 : 'ia64',
|
|
||||||
ARM : 'arm',
|
|
||||||
ARM64 : 'arm64',
|
|
||||||
ARMHF : 'armhf',
|
|
||||||
_68K : '68k',
|
|
||||||
AVR : 'avr',
|
|
||||||
IRIX : 'irix',
|
|
||||||
IRIX64 : 'irix64',
|
|
||||||
MIPS : 'mips',
|
|
||||||
MIPS64 : 'mips64',
|
|
||||||
PPC : 'ppc',
|
|
||||||
SPARC : 'sparc',
|
|
||||||
SPARC64 : 'sparc64'
|
|
||||||
});
|
|
||||||
|
|
||||||
const DeviceType = Object.freeze({
|
|
||||||
MOBILE : 'mobile',
|
|
||||||
TABLET : 'tablet',
|
|
||||||
SMARTTV : 'smarttv',
|
|
||||||
CONSOLE : 'console',
|
|
||||||
WEARABLE: 'wearable',
|
|
||||||
EMBEDDED: 'embedded'
|
|
||||||
});
|
|
||||||
|
|
||||||
const DeviceVendor = Object.freeze({
|
|
||||||
APPLE : 'Apple',
|
|
||||||
SAMSUNG : 'Samsung',
|
|
||||||
HUAWEI : 'Huawei',
|
|
||||||
XIAOMI : 'Xiaomi',
|
|
||||||
OPPO : 'OPPO',
|
|
||||||
VIVO : 'Vivo',
|
|
||||||
REALME : 'Realme',
|
|
||||||
LENOVO : 'Lenovo',
|
|
||||||
LG : 'LG'
|
|
||||||
|
|
||||||
// TODO : test!
|
|
||||||
});
|
|
||||||
|
|
||||||
const EngineName = Object.freeze({
|
|
||||||
AMAYA : 'Amaya',
|
|
||||||
BLINK : 'Blink',
|
|
||||||
EDGEHTML: 'EdgeHTML',
|
|
||||||
FLOW : 'Flow',
|
|
||||||
GECKO : 'Gecko',
|
|
||||||
GOANNA : 'Goanna',
|
|
||||||
ICAB : 'iCab',
|
|
||||||
LIBWEB : 'LibWeb',
|
|
||||||
KHTML : 'KHTML',
|
|
||||||
LINKS : 'Links',
|
|
||||||
LYNX : 'Lynx',
|
|
||||||
NETFRONT: 'NetFront',
|
|
||||||
NETSURF : 'NetSurf',
|
|
||||||
PRESTO : 'Presto',
|
|
||||||
TASMAN : 'Tasman',
|
|
||||||
TRIDENT : 'Trident',
|
|
||||||
W3M : 'w3m',
|
|
||||||
WEBKIT : 'WebKit'
|
|
||||||
});
|
|
||||||
|
|
||||||
const OSName = Object.freeze({
|
|
||||||
WINDOWS : 'Windows',
|
|
||||||
LINUX : 'Linux',
|
|
||||||
MACOS : 'macOS',
|
|
||||||
IOS : 'iOS',
|
|
||||||
ANDROID : 'Android'
|
|
||||||
|
|
||||||
// TODO : test!
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
BrowserName,
|
|
||||||
CPUArch,
|
|
||||||
DeviceType,
|
|
||||||
DeviceVendor,
|
|
||||||
EngineName,
|
|
||||||
OSName
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
// Generated ESM version of UAParser.js enums
|
|
||||||
// DO NOT EDIT THIS FILE!
|
|
||||||
// Source: /src/enum/ua-parser-enum.js
|
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
|
||||||
/* Enums for UAParser.js v2.0.0-alpha.2
|
|
||||||
https://github.com/faisalman/ua-parser-js
|
|
||||||
Author: Faisal Salman <f@faisalman.com>
|
|
||||||
MIT License */
|
|
||||||
//////////////////////////////////////////////
|
|
||||||
|
|
||||||
const BrowserName = Object.freeze({
|
|
||||||
CHROME : 'Chrome',
|
|
||||||
EDGE : 'Edge',
|
|
||||||
SAFARI : 'Safari',
|
|
||||||
FIREFOX : 'Firefox',
|
|
||||||
OPERA : 'Opera',
|
|
||||||
MOBILE_CHROME : 'Mobile Chrome',
|
|
||||||
MOBILE_SAFARI : 'Mobile Safari',
|
|
||||||
MOBILE_FIREFOX : 'Mobile Firefox',
|
|
||||||
ANDROID_BROWSER : 'Android Browser'
|
|
||||||
|
|
||||||
// TODO : test!
|
|
||||||
});
|
|
||||||
|
|
||||||
const CPUArch = Object.freeze({
|
|
||||||
IA32 : 'ia32',
|
|
||||||
AMD64 : 'amd64',
|
|
||||||
IA64 : 'ia64',
|
|
||||||
ARM : 'arm',
|
|
||||||
ARM64 : 'arm64',
|
|
||||||
ARMHF : 'armhf',
|
|
||||||
_68K : '68k',
|
|
||||||
AVR : 'avr',
|
|
||||||
IRIX : 'irix',
|
|
||||||
IRIX64 : 'irix64',
|
|
||||||
MIPS : 'mips',
|
|
||||||
MIPS64 : 'mips64',
|
|
||||||
PPC : 'ppc',
|
|
||||||
SPARC : 'sparc',
|
|
||||||
SPARC64 : 'sparc64'
|
|
||||||
});
|
|
||||||
|
|
||||||
const DeviceType = Object.freeze({
|
|
||||||
MOBILE : 'mobile',
|
|
||||||
TABLET : 'tablet',
|
|
||||||
SMARTTV : 'smarttv',
|
|
||||||
CONSOLE : 'console',
|
|
||||||
WEARABLE: 'wearable',
|
|
||||||
EMBEDDED: 'embedded'
|
|
||||||
});
|
|
||||||
|
|
||||||
const DeviceVendor = Object.freeze({
|
|
||||||
APPLE : 'Apple',
|
|
||||||
SAMSUNG : 'Samsung',
|
|
||||||
HUAWEI : 'Huawei',
|
|
||||||
XIAOMI : 'Xiaomi',
|
|
||||||
OPPO : 'OPPO',
|
|
||||||
VIVO : 'Vivo',
|
|
||||||
REALME : 'Realme',
|
|
||||||
LENOVO : 'Lenovo',
|
|
||||||
LG : 'LG'
|
|
||||||
|
|
||||||
// TODO : test!
|
|
||||||
});
|
|
||||||
|
|
||||||
const EngineName = Object.freeze({
|
|
||||||
AMAYA : 'Amaya',
|
|
||||||
BLINK : 'Blink',
|
|
||||||
EDGEHTML: 'EdgeHTML',
|
|
||||||
FLOW : 'Flow',
|
|
||||||
GECKO : 'Gecko',
|
|
||||||
GOANNA : 'Goanna',
|
|
||||||
ICAB : 'iCab',
|
|
||||||
LIBWEB : 'LibWeb',
|
|
||||||
KHTML : 'KHTML',
|
|
||||||
LINKS : 'Links',
|
|
||||||
LYNX : 'Lynx',
|
|
||||||
NETFRONT: 'NetFront',
|
|
||||||
NETSURF : 'NetSurf',
|
|
||||||
PRESTO : 'Presto',
|
|
||||||
TASMAN : 'Tasman',
|
|
||||||
TRIDENT : 'Trident',
|
|
||||||
W3M : 'w3m',
|
|
||||||
WEBKIT : 'WebKit'
|
|
||||||
});
|
|
||||||
|
|
||||||
const OSName = Object.freeze({
|
|
||||||
WINDOWS : 'Windows',
|
|
||||||
LINUX : 'Linux',
|
|
||||||
MACOS : 'macOS',
|
|
||||||
IOS : 'iOS',
|
|
||||||
ANDROID : 'Android'
|
|
||||||
|
|
||||||
// TODO : test!
|
|
||||||
});
|
|
||||||
|
|
||||||
export {
|
|
||||||
BrowserName,
|
|
||||||
CPUArch,
|
|
||||||
DeviceType,
|
|
||||||
DeviceVendor,
|
|
||||||
EngineName,
|
|
||||||
OSName
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
///////////////////////////////////////////////
|
|
||||||
/* Extensions for UAParser.js v2.0.0-alpha.2
|
|
||||||
https://github.com/faisalman/ua-parser-js
|
|
||||||
Author: Faisal Salman <f@faisalman.com>
|
|
||||||
MIT License */
|
|
||||||
//////////////////////////////////////////////
|
|
||||||
|
|
||||||
const MODEL = 'model';
|
|
||||||
const NAME = 'name';
|
|
||||||
const TYPE = 'type';
|
|
||||||
const VENDOR = 'vendor';
|
|
||||||
const VERSION = 'version';
|
|
||||||
const MOBILE = 'mobile';
|
|
||||||
const TABLET = 'tablet';
|
|
||||||
|
|
||||||
const Bots = Object.freeze({
|
|
||||||
browser : [
|
|
||||||
// Googlebot / BingBot / MSNBot / FacebookBot
|
|
||||||
[/((?:google|bing|msn|facebook)bot(?:\-[imagevdo]{5})?|bingpreview)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, 'bot']]
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const ExtraDevices = Object.freeze({
|
|
||||||
device : [
|
|
||||||
[
|
|
||||||
/(nook)[\w ]+build\/(\w+)/i, // Nook
|
|
||||||
/(dell) (strea[kpr\d ]*[\dko])/i, // Dell Streak
|
|
||||||
/(le[- ]+pan)[- ]+(\w{1,9}) bui/i, // Le Pan Tablets
|
|
||||||
/(trinity)[- ]*(t\d{3}) bui/i, // Trinity Tablets
|
|
||||||
/(gigaset)[- ]+(q\w{1,9}) bui/i, // Gigaset Tablets
|
|
||||||
/(vodafone) ([\w ]+)(?:\)| bui)/i // Vodafone
|
|
||||||
], [VENDOR, MODEL, [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/(u304aa)/i // AT&T
|
|
||||||
], [MODEL, [VENDOR, 'AT&T'], [TYPE, MOBILE]], [
|
|
||||||
|
|
||||||
/\bsie-(\w*)/i // Siemens
|
|
||||||
], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [
|
|
||||||
|
|
||||||
/\b(rct\w+) b/i // RCA Tablets
|
|
||||||
], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(venue[\d ]{2,7}) b/i // Dell Venue Tablets
|
|
||||||
], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(q(?:mv|ta)\w+) b/i // Verizon Tablet
|
|
||||||
], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i // Barnes & Noble Tablet
|
|
||||||
], [MODEL, [VENDOR, 'Barnes & Noble'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(tm\d{3}\w+) b/i
|
|
||||||
], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(k88) b/i // ZTE K Series Tablet
|
|
||||||
], [MODEL, [VENDOR, 'ZTE'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(nx\d{3}j) b/i // ZTE Nubia
|
|
||||||
], [MODEL, [VENDOR, 'ZTE'], [TYPE, MOBILE]], [
|
|
||||||
|
|
||||||
/\b(gen\d{3}) b.+49h/i // Swiss GEN Mobile
|
|
||||||
], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [
|
|
||||||
|
|
||||||
/\b(zur\d{3}) b/i // Swiss ZUR Tablet
|
|
||||||
], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b((zeki)?tb.*\b) b/i // Zeki Tablets
|
|
||||||
], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b([yr]\d{2}) b/i,
|
|
||||||
/\b(?:dragon[- ]+touch |dt)(\w{5}) b/i // Dragon Touch Tablet
|
|
||||||
], [MODEL, [VENDOR, 'Dragon Touch'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(ns-?\w{0,9}) b/i // Insignia Tablets
|
|
||||||
], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b((nxa|next)-?\w{0,9}) b/i // NextBook Tablets
|
|
||||||
], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i // Voice Xtreme Phones
|
|
||||||
], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [
|
|
||||||
|
|
||||||
/\b(lvtel\-)?(v1[12]) b/i // LvTel Phones
|
|
||||||
], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [
|
|
||||||
|
|
||||||
/\b(ph-1) /i // Essential PH-1
|
|
||||||
], [MODEL, [VENDOR, 'Essential'], [TYPE, MOBILE]], [
|
|
||||||
|
|
||||||
/\b(v(100md|700na|7011|917g).*\b) b/i // Envizen Tablets
|
|
||||||
], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(trio[-\w\. ]+) b/i // MachSpeed Tablets
|
|
||||||
], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\btu_(1491) b/i // Rotor Tablets
|
|
||||||
], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const Emails = Object.freeze({
|
|
||||||
browser : [
|
|
||||||
// Microsoft Outlook / Thunderbird
|
|
||||||
[/(microsoft outlook|thunderbird)[\s\/]([\w\.]+)/i], [NAME, VERSION, [TYPE, 'email']]
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const Tools = Object.freeze({
|
|
||||||
browser : [
|
|
||||||
// wget / curl / lynx
|
|
||||||
[/(wget|curl|lynx)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, 'tool']]
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
Bots,
|
|
||||||
ExtraDevices,
|
|
||||||
Emails,
|
|
||||||
Tools
|
|
||||||
}
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
// Generated ESM version of UAParser.js extensions
|
|
||||||
// DO NOT EDIT THIS FILE!
|
|
||||||
// Source: /src/extension/ua-parser-extension.js
|
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
|
||||||
/* Extensions for UAParser.js v2.0.0-alpha.2
|
|
||||||
https://github.com/faisalman/ua-parser-js
|
|
||||||
Author: Faisal Salman <f@faisalman.com>
|
|
||||||
MIT License */
|
|
||||||
//////////////////////////////////////////////
|
|
||||||
|
|
||||||
const MODEL = 'model';
|
|
||||||
const NAME = 'name';
|
|
||||||
const TYPE = 'type';
|
|
||||||
const VENDOR = 'vendor';
|
|
||||||
const VERSION = 'version';
|
|
||||||
const MOBILE = 'mobile';
|
|
||||||
const TABLET = 'tablet';
|
|
||||||
|
|
||||||
const Bots = Object.freeze({
|
|
||||||
browser : [
|
|
||||||
// Googlebot / BingBot / MSNBot / FacebookBot
|
|
||||||
[/((?:google|bing|msn|facebook)bot(?:\-[imagevdo]{5})?|bingpreview)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, 'bot']]
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const ExtraDevices = Object.freeze({
|
|
||||||
device : [
|
|
||||||
[
|
|
||||||
/(nook)[\w ]+build\/(\w+)/i, // Nook
|
|
||||||
/(dell) (strea[kpr\d ]*[\dko])/i, // Dell Streak
|
|
||||||
/(le[- ]+pan)[- ]+(\w{1,9}) bui/i, // Le Pan Tablets
|
|
||||||
/(trinity)[- ]*(t\d{3}) bui/i, // Trinity Tablets
|
|
||||||
/(gigaset)[- ]+(q\w{1,9}) bui/i, // Gigaset Tablets
|
|
||||||
/(vodafone) ([\w ]+)(?:\)| bui)/i // Vodafone
|
|
||||||
], [VENDOR, MODEL, [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/(u304aa)/i // AT&T
|
|
||||||
], [MODEL, [VENDOR, 'AT&T'], [TYPE, MOBILE]], [
|
|
||||||
|
|
||||||
/\bsie-(\w*)/i // Siemens
|
|
||||||
], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [
|
|
||||||
|
|
||||||
/\b(rct\w+) b/i // RCA Tablets
|
|
||||||
], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(venue[\d ]{2,7}) b/i // Dell Venue Tablets
|
|
||||||
], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(q(?:mv|ta)\w+) b/i // Verizon Tablet
|
|
||||||
], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i // Barnes & Noble Tablet
|
|
||||||
], [MODEL, [VENDOR, 'Barnes & Noble'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(tm\d{3}\w+) b/i
|
|
||||||
], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(k88) b/i // ZTE K Series Tablet
|
|
||||||
], [MODEL, [VENDOR, 'ZTE'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(nx\d{3}j) b/i // ZTE Nubia
|
|
||||||
], [MODEL, [VENDOR, 'ZTE'], [TYPE, MOBILE]], [
|
|
||||||
|
|
||||||
/\b(gen\d{3}) b.+49h/i // Swiss GEN Mobile
|
|
||||||
], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [
|
|
||||||
|
|
||||||
/\b(zur\d{3}) b/i // Swiss ZUR Tablet
|
|
||||||
], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b((zeki)?tb.*\b) b/i // Zeki Tablets
|
|
||||||
], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b([yr]\d{2}) b/i,
|
|
||||||
/\b(?:dragon[- ]+touch |dt)(\w{5}) b/i // Dragon Touch Tablet
|
|
||||||
], [MODEL, [VENDOR, 'Dragon Touch'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(ns-?\w{0,9}) b/i // Insignia Tablets
|
|
||||||
], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b((nxa|next)-?\w{0,9}) b/i // NextBook Tablets
|
|
||||||
], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i // Voice Xtreme Phones
|
|
||||||
], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [
|
|
||||||
|
|
||||||
/\b(lvtel\-)?(v1[12]) b/i // LvTel Phones
|
|
||||||
], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [
|
|
||||||
|
|
||||||
/\b(ph-1) /i // Essential PH-1
|
|
||||||
], [MODEL, [VENDOR, 'Essential'], [TYPE, MOBILE]], [
|
|
||||||
|
|
||||||
/\b(v(100md|700na|7011|917g).*\b) b/i // Envizen Tablets
|
|
||||||
], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\b(trio[-\w\. ]+) b/i // MachSpeed Tablets
|
|
||||||
], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [
|
|
||||||
|
|
||||||
/\btu_(1491) b/i // Rotor Tablets
|
|
||||||
], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const Emails = Object.freeze({
|
|
||||||
browser : [
|
|
||||||
// Microsoft Outlook / Thunderbird
|
|
||||||
[/(microsoft outlook|thunderbird)[\s\/]([\w\.]+)/i], [NAME, VERSION, [TYPE, 'email']]
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
const Tools = Object.freeze({
|
|
||||||
browser : [
|
|
||||||
// wget / curl / lynx
|
|
||||||
[/(wget|curl|lynx)\/([\w\.]+)/i], [NAME, VERSION, [TYPE, 'tool']]
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
export {
|
|
||||||
Bots,
|
|
||||||
ExtraDevices,
|
|
||||||
Emails,
|
|
||||||
Tools
|
|
||||||
}
|
|
||||||
1431
src/ua-parser.js
Executable file → Normal file
1431
src/ua-parser.js
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
1
src/ua-parser.min.js
vendored
Normal file
1
src/ua-parser.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1126
src/ua-parser.mjs
1126
src/ua-parser.mjs
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -40,93 +40,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desc" : "ARM",
|
"desc" : "ARMv6",
|
||||||
"ua" : "Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 635) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"architecture" : "arm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "ARMv61",
|
|
||||||
"ua" : "Mozilla/5.0 (X11; U; Linux armv61; en-US; rv:1.9.1b2pre) Gecko/20081015 Fennec/1.0a1",
|
"ua" : "Mozilla/5.0 (X11; U; Linux armv61; en-US; rv:1.9.1b2pre) Gecko/20081015 Fennec/1.0a1",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
"architecture" : "arm"
|
"architecture" : "arm"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"desc" : "ARMv7",
|
|
||||||
"ua" : "Mozilla/5.0 (Linux ARMv7) WebKitGTK+/3.4.9 vimprobable2",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"architecture" : "arm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "ARMv7l",
|
|
||||||
"ua" : "Mozilla/5.0 (SMART-TV; X11; Linux armv7l) AppleWebKit/537.42 (KHTML, like Gecko) Chromium/25.0.1349.2 Chrome/25.0.1349.2 Safari/537.42",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"architecture" : "arm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "ARMv7l",
|
|
||||||
"ua" : "Mozilla/5.0 (X11; CrOS armv7l 9765.85.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.123 Safari/537.36",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"architecture" : "arm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Nokia N900 Linux mobile",
|
|
||||||
"ua" : "Mozilla/5.0 (Maemo; Linux armv7l; rv:10.0) Gecko/20100101 Firefox/10.0 Fennec/10.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"architecture" : "arm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "ARMEABI",
|
|
||||||
"ua" : "[FBAN/FB4A;FBAV/237.0.0.44.120;FBBV/170693408;FBDM/{density=1.75,width=720,height=1280};FBLC/en_US;FBRV/172067074;FBCR/ ;FBMF/samsung;FBBD/samsung;FBPN/com.facebook.katana;FBDV/SM-S367VL;FBSV/9;FBBK/1;FBOP/19;FBCA/armeabi-v7a:armeabi;]",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"architecture" : "arm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "ARMv8",
|
|
||||||
"ua" : "Mozilla/5.0 (X11; Linux armv8l; rv:45.0) Gecko/20100101 Firefox/45.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"architecture" : "arm64"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "AARCH64",
|
|
||||||
"ua" : "Mozilla/5.0 (X11; CrOS aarch64 13310.93.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.133 Safari/537.36",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"architecture" : "arm64"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "ARM64",
|
|
||||||
"ua" : "Mozilla/5.0 (Windows NT 10.0; ARM64; RM-1096) AppleWebKit/537.36 (KHTML like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"architecture" : "arm64"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "ARM64",
|
|
||||||
"ua" : "Mozilla/5.0 (Linux; arm_64; Android 9; HRY-LX1T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 YaBrowser/19.12.1.121.00 Mobile Safari/537.36",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"architecture" : "arm64"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"desc" : "Pocket PC",
|
"desc" : "Pocket PC",
|
||||||
"ua" : "Opera/9.7 (Windows Mobile; PPC; Opera Mobi/35166; U; en) Presto/2.2.1",
|
"ua" : "Opera/9.7 (Windows Mobile; PPC; Opera Mobi/35166; U; en) Presto/2.2.1",
|
||||||
@@ -159,14 +79,6 @@
|
|||||||
"architecture" : "ppc"
|
"architecture" : "ppc"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"desc" : "Mac OS X on PowerPC using Firefox",
|
|
||||||
"ua" : "Mozilla/5.0 (Macintosh; PPC Mac OS X x.y; rv:10.0) Gecko/20100101 Firefox/10.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"architecture" : "ppc"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"desc" : "UltraSPARC",
|
"desc" : "UltraSPARC",
|
||||||
"ua" : "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5",
|
"ua" : "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5",
|
||||||
@@ -175,14 +87,6 @@
|
|||||||
"architecture" : "sparc"
|
"architecture" : "sparc"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"desc" : "sparc64",
|
|
||||||
"ua" : "ELinks (0.4.3; NetBSD 3.0.2PATCH sparc64; 141x19)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"architecture" : "sparc64"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"desc" : "QuickTime",
|
"desc" : "QuickTime",
|
||||||
"ua" : "QuickTime/7.5.6 (qtver=7.5.6;cpu=IA32;os=Mac 10.5.8)",
|
"ua" : "QuickTime/7.5.6 (qtver=7.5.6;cpu=IA32;os=Mac 10.5.8)",
|
||||||
@@ -200,19 +104,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desc" : "IRIX64",
|
"desc" : "KTB iPad",
|
||||||
"ua" : "Mozilla/4.8C-SGI [en] (X11; U; IRIX64 6.5 IP27",
|
"ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
"architecture" : "irix64"
|
"architecture" : "undefined"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desc" : "68k",
|
"desc" : "KTB-Nexus 5",
|
||||||
"ua" : "'Mozilla/1.1 (Macintosh; U; 68K)'",
|
"ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
"architecture" : "68k"
|
"architecture" : "undefined"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,31 +1,4 @@
|
|||||||
[
|
[
|
||||||
{
|
|
||||||
"desc" : "Blink",
|
|
||||||
"ua" : "Mozilla/5.0 (Linux; Android 7.0; SM-G920I Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/3.4.9 SamsungBrowser/4.0 Chrome/57.0.2987.146 Mobile VR Safari/537.36",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Blink",
|
|
||||||
"version" : "57.0.2987.146"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "EdgeHTML",
|
|
||||||
"ua" : "Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36 Edge/12.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "EdgeHTML",
|
|
||||||
"version" : "12.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Flow",
|
|
||||||
"ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) EkiohFlow/5.7.4.30559 Flow/5.7.4 (like Gecko Firefox/53.0 rv:53.0)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Flow",
|
|
||||||
"version" : "5.7.4.30559"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"desc" : "Gecko",
|
"desc" : "Gecko",
|
||||||
"ua" : "Mozilla/5.0 (X11; Linux x86_64; rv:2.0b9pre) Gecko/20110111 Firefox/4.0b9pre",
|
"ua" : "Mozilla/5.0 (X11; Linux x86_64; rv:2.0b9pre) Gecko/20110111 Firefox/4.0b9pre",
|
||||||
@@ -35,15 +8,6 @@
|
|||||||
"version" : "2.0b9pre"
|
"version" : "2.0b9pre"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"desc" : "Goanna",
|
|
||||||
"ua" : "Mozilla/5.0 (Windows NT 5.1; rv:38.9) Gecko/20100101 Goanna/2.2 Firefox/38.9 PaleMoon/26.5.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Goanna",
|
|
||||||
"version" : "2.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"desc" : "KHTML",
|
"desc" : "KHTML",
|
||||||
"ua" : "Mozilla/5.0 (compatible; Konqueror/4.5; FreeBSD) KHTML/4.5.4 (like Gecko)",
|
"ua" : "Mozilla/5.0 (compatible; Konqueror/4.5; FreeBSD) KHTML/4.5.4 (like Gecko)",
|
||||||
@@ -53,15 +17,6 @@
|
|||||||
"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",
|
||||||
@@ -108,57 +63,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desc" : "WebKit",
|
"desc" : "KTA Mobile App",
|
||||||
"ua" : "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/27.0.1453.110 Safari/537.36",
|
"ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
"name" : "WebKit",
|
"name" : "Mobile-App",
|
||||||
"version" : "537.36"
|
"version" : "1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desc" : "WebOS TV 5.x",
|
"desc" : "KTB-Nexus 5",
|
||||||
"ua" : "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36 WebAppManager",
|
"ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
"name" : "Blink",
|
"name" : "Mobile-App",
|
||||||
"version" : "68.0.3440.106"
|
"version" : "1.0"
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "WebOS TV 4.x",
|
|
||||||
"ua" : "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.34 Safari/537.36 WebAppManager",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Blink",
|
|
||||||
"version" : "53.0.2785.34"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "WebOS TV 3.x",
|
|
||||||
"ua" : "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.2.1 Chrome/38.0.2125.122 Safari/537.36 WebAppManager",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Blink",
|
|
||||||
"version" : "38.0.2125.122"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "WebOS TV 2.x",
|
|
||||||
"ua" : "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/538.2 (KHTML, like Gecko) Large Screen WebAppManager Safari/538.2",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "WebKit",
|
|
||||||
"version" : "538.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "WebOS TV 1.x",
|
|
||||||
"ua" : "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.41 (KHTML, like Gecko) Large Screen WebAppManager Safari/537.41",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "WebKit",
|
|
||||||
"version" : "537.41"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,582 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"desc" : "Coremedia",
|
|
||||||
"ua" : "Apple Mac OS X v10.6.4 CoreMedia v1.0.0.10F2108",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "CoreMedia",
|
|
||||||
"version" : "1.0.0.10F2108",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "AppleCoreMedia",
|
|
||||||
"ua" : "AppleCoreMedia/1.0.0.10A403 (iPad; U; CPU OS 6_0 like Mac OS X; it_it)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "AppleCoreMedia",
|
|
||||||
"version" : "1.0.0.10A403",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "AppleTv",
|
|
||||||
"ua" : "AppleTV/3.0.2 (Macintosh; Intel Mac OS X 10.4.7) AppleWebKit/528.18",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "WebKit",
|
|
||||||
"version" : "528.18",
|
|
||||||
"major" : "528"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Aqualung",
|
|
||||||
"ua" : "Aqualung/R-1114",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Aqualung",
|
|
||||||
"version" : "R-1114",
|
|
||||||
"major" : "undefined"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Ares",
|
|
||||||
"ua" : "Ares 2.2.4.3048",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Ares",
|
|
||||||
"version" : "2.2.4.3048",
|
|
||||||
"major" : "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Audacious",
|
|
||||||
"ua" : "Audacious/3.2.2 neon/0.29.3",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Audacious",
|
|
||||||
"version" : "3.2.2",
|
|
||||||
"major" : "3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "AudiMusicStream",
|
|
||||||
"ua" : "AudiMusicStream/3020.130826151911",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "AudiMusicStream",
|
|
||||||
"version" : "3020.130826151911",
|
|
||||||
"major" : "3020"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "BASS",
|
|
||||||
"ua" : "BASS/2.4",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "BASS",
|
|
||||||
"version" : "2.4",
|
|
||||||
"major" : "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "BSPlayer",
|
|
||||||
"ua" : "BSPlayer/2",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "BSPlayer",
|
|
||||||
"version" : "2",
|
|
||||||
"major" : "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Core",
|
|
||||||
"ua" : "CORE/6.506.4.1",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "CORE",
|
|
||||||
"version" : "6.506.4.1",
|
|
||||||
"major" : "6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Clementine",
|
|
||||||
"ua" : "Clementine 1.1",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Clementine",
|
|
||||||
"version" : "1.1",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Dalvik",
|
|
||||||
"ua" : "Dalvik/1.2.0 (Linux; U; Android 2.2.1; GT-S5830L Build/FROYO)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Dalvik",
|
|
||||||
"version" : "1.2.0",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "NexPlayer",
|
|
||||||
"ua" : "E97510d/ Player/NexPlayer 4.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "NexPlayer",
|
|
||||||
"version" : "4.0",
|
|
||||||
"major" : "4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "FLRP",
|
|
||||||
"ua" : "FLRP/2.5 CFNetwork/609.1.4 Darwin/13.0.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Flip Player",
|
|
||||||
"version" : "2.5",
|
|
||||||
"major" : "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "FStream",
|
|
||||||
"ua" : "FStream",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "FStream",
|
|
||||||
"version" : "undefined",
|
|
||||||
"major" : "undefined"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "GStreamer",
|
|
||||||
"ua" : "GStreamer souphttpsrc (compatible; LG NetCast.TV-2012) libsoup/2.34.2",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "GStreamer",
|
|
||||||
"version" : "2.34.2",
|
|
||||||
"major" : "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "GnomeMplayer",
|
|
||||||
"ua" : "GnomeMplayer/1.0.2",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "GnomeMplayer",
|
|
||||||
"version" : "1.0.2",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "HTC Streaming Player",
|
|
||||||
"ua" : "HTC Streaming Player htc_asia_wwe / 1.0 / endeavoru / 4.1.1",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "HTC Streaming Player",
|
|
||||||
"version" : "1.0",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "HTC One S",
|
|
||||||
"ua" : "HTC_One_S/3.16.111.10",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "HTC One S",
|
|
||||||
"version" : "3.16.111.10",
|
|
||||||
"major" : "3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Java",
|
|
||||||
"ua" : "Java/1.4.1_04",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Java",
|
|
||||||
"version" : "1.4.1_04",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "LG Player",
|
|
||||||
"ua" : "LG Player 1.0; Android",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "LG Player",
|
|
||||||
"version" : "1.0",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "NexPlayer",
|
|
||||||
"ua" : "LG-P700/V10k-DEC-12-2012 Player/NexPlayer 4.0 for Android",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "NexPlayer",
|
|
||||||
"version" : "4.0",
|
|
||||||
"major" : "4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "LG Player",
|
|
||||||
"ua" : "LGE400/V10b Player/LG Player 1.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "LG Player",
|
|
||||||
"version" : "1.0",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Lavf",
|
|
||||||
"ua" : "Lavf52.111.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Lavf",
|
|
||||||
"version" : "52.111.0",
|
|
||||||
"major" : "52"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Lyssna",
|
|
||||||
"ua" : "Lyssna/46 CFNetwork/609.1.4 Darwin/13.0.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Lyssna",
|
|
||||||
"version" : "46",
|
|
||||||
"major" : "46"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "MPlayer",
|
|
||||||
"ua" : "MPlayer 1.1-4.2.1",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "MPlayer",
|
|
||||||
"version" : "1.1-4.2.1",
|
|
||||||
"major" : ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "MPlayer SVN",
|
|
||||||
"ua" : "MPlayer SVN-r33713-4.6.1",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "MPlayer",
|
|
||||||
"version" : "r33713-4.6.1",
|
|
||||||
"major" : "undefined"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "MPlayer ubuntu",
|
|
||||||
"ua" : "MPlayer svn r34540 (Ubuntu), built with gcc-4.6",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "MPlayer",
|
|
||||||
"version" : "r34540",
|
|
||||||
"major" : "undefined"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "MoC",
|
|
||||||
"ua" : "Music On Console/2.5.0-beta1",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Music On Console",
|
|
||||||
"version" : "2.5.0-beta1",
|
|
||||||
"major" : "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "MPD",
|
|
||||||
"ua" : "Music Player Daemon 0.17.4",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Music Player Daemon",
|
|
||||||
"version" : "0.17.4",
|
|
||||||
"major" : "0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "NSPlayer",
|
|
||||||
"ua" : "NSPlayer/11.0.5358.4827 WMFSDK/11.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "NSPlayer",
|
|
||||||
"version" : "11.0.5358.4827",
|
|
||||||
"major" : "11"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Nero Home",
|
|
||||||
"ua" : "Nero Home/1.5.3.0 (compatible; Nero AG; Nero Home 1.5.3.0)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Nero Home",
|
|
||||||
"version" : "1.5.3.0",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "NexPlayer",
|
|
||||||
"ua" : "NexPlayer 4.0 for Android( stagefright alternative )",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "NexPlayer",
|
|
||||||
"version" : "4.0",
|
|
||||||
"major" : "4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Nokia3xx",
|
|
||||||
"ua" : "Nokia303/14.87 CLDC-1.1",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Nokia303",
|
|
||||||
"version" : "14.87",
|
|
||||||
"major" : "14"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "MPlayer SVN Sherpya",
|
|
||||||
"ua" : "MPlayer Sherpya-SVN-r33124-4.2.5",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "MPlayer",
|
|
||||||
"version" : "r33124-4.2.5",
|
|
||||||
"major" : "undefined"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Philips Songbird",
|
|
||||||
"ua" : "NotMoz/5.0 (Windows; U; Windows NT 5.1; it; rv:1.9.2.3) Gecko/20101207 Philips-Songbird/5.4.1980 Songbird/1.9.4 (20110302030555)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Songbird",
|
|
||||||
"version" : "1.9.4",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Ossproxy",
|
|
||||||
"ua" : "OSSProxy 1.3.336.320 (Build 336.320 Win32 en-us)(Aug 16 2013 17:38:43)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "OSSProxy",
|
|
||||||
"version" : "1.3.336.320",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Winamp3",
|
|
||||||
"ua" : "Nullsoft Winamp3 version 3.0 (compatible)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Winamp",
|
|
||||||
"version" : "3.0",
|
|
||||||
"major" : "3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "PSP",
|
|
||||||
"ua" : "PSP-InternetRadioPlayer/1.00",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "PSP-InternetRadioPlayer",
|
|
||||||
"version" : "1.00",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "urllib",
|
|
||||||
"ua" : "Python-urllib/2.7",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Python-urllib",
|
|
||||||
"version" : "2.7",
|
|
||||||
"major" : "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "QuickTime",
|
|
||||||
"ua" : "QuickTime/7.5.6 (qtver=7.5.6;cpu=IA32;os=Mac 10.5.8)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "QuickTime",
|
|
||||||
"version" : "7.5.6",
|
|
||||||
"major" : "7"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "RMA",
|
|
||||||
"ua" : "RMA/1.0 (compatible; RealMedia)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "RMA",
|
|
||||||
"version" : "1.0",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "RadioApp",
|
|
||||||
"ua" : "RadioApp/1.0 CFNetwork/609.1.4 Darwin/11.4.2",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "RadioApp",
|
|
||||||
"version" : "1.0",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "RadioClientApplication",
|
|
||||||
"ua" : "RadioClientApplication/20 CFNetwork/609.1.4 Darwin/13.0.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "RadioClientApplication",
|
|
||||||
"version" : "20",
|
|
||||||
"major" : "undefined"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "stagefright",
|
|
||||||
"ua" : "Samsung GT-I9070 stagefright/1.1 (Linux;Android 2.3.6)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "stagefright",
|
|
||||||
"version" : "1.1",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Soundtap",
|
|
||||||
"ua" : "Soundtap/1.2.4 CFNetwork/672.0.2 Darwin/14.0.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Soundtap",
|
|
||||||
"version" : "1.2.4",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Streamium",
|
|
||||||
"ua" : "Streamium/1.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Streamium",
|
|
||||||
"version" : "1.0",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Totem",
|
|
||||||
"ua" : "Totem/3.0.1",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Totem",
|
|
||||||
"version" : "3.0.1",
|
|
||||||
"major" : "3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "VLC",
|
|
||||||
"ua" : "VLC media player - version 0.8.6c Janus - (c) 1996-2007 the VideoLAN team",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "VLC",
|
|
||||||
"version" : "0.8.6c",
|
|
||||||
"major" : "0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "VLC",
|
|
||||||
"ua" : "VLC/2.0.0 LibVLC/2.0.0",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "VLC",
|
|
||||||
"version" : "2.0.0",
|
|
||||||
"major" : "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Videos",
|
|
||||||
"ua" : "Videos/3.8.2",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Video",
|
|
||||||
"version" : "3.8.2",
|
|
||||||
"major" : "3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Wget",
|
|
||||||
"ua" : "Wget/1.12 (darwin10.7.0)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Wget",
|
|
||||||
"version" : "1.12",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Winamp",
|
|
||||||
"ua" : "Winamp 2.81",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Winamp",
|
|
||||||
"version" : "2.81",
|
|
||||||
"major" : "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Winamp",
|
|
||||||
"ua" : "WinampMPEG/2.00",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Winamp",
|
|
||||||
"version" : "2.00",
|
|
||||||
"major" : "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "Windows Media Player",
|
|
||||||
"ua" : "Windows-Media-Player/10.00.00.4019",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "Windows Media Player",
|
|
||||||
"version" : "10.00.00.4019",
|
|
||||||
"major" : "10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "XBMC",
|
|
||||||
"ua" : "XBMC/12.0 Git:20130127-fb595f2 (Windows NT 6.1;WOW64;Win64;x64; http://www.xbmc.org)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "XBMC",
|
|
||||||
"version" : "12.0",
|
|
||||||
"major" : "12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "rad.io",
|
|
||||||
"ua" : "rad.io 1.18.1 rv:593 (iPhone 4S; iPhone OS 7.0.4; it_IT)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "rad.io",
|
|
||||||
"version" : "1.18.1",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc" : "BE-Test",
|
|
||||||
"ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)",
|
|
||||||
"expect" :
|
|
||||||
{
|
|
||||||
"name" : "BE Test",
|
|
||||||
"version" : "1.0",
|
|
||||||
"major" : "1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
1081
test/os-test.json
1081
test/os-test.json
File diff suppressed because it is too large
Load Diff
@@ -1,27 +0,0 @@
|
|||||||
import { UAParser } from 'ua-parser-js';
|
|
||||||
import { CPUArch, DeviceType, EngineName } from 'ua-parser-js/enums';
|
|
||||||
import * as assert from 'assert';
|
|
||||||
|
|
||||||
describe('Returns', () => {
|
|
||||||
it('getResult() should returns object', () => {
|
|
||||||
assert.deepEqual(new UAParser('').getResult(),
|
|
||||||
{
|
|
||||||
ua : '',
|
|
||||||
//ua_ch : { architecture: undefined, bitness: undefined, brands: undefined, fullVersionList: undefined, mobile: false, model: undefined, platform: undefined, platformVersion: undefined },
|
|
||||||
browser: { name: undefined, version: undefined, major: undefined },
|
|
||||||
cpu: { architecture: undefined },
|
|
||||||
device: { vendor: undefined, model: undefined, type: undefined },
|
|
||||||
engine: { name: undefined, version: undefined},
|
|
||||||
os: { name: undefined, version: undefined }
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Enums', () => {
|
|
||||||
it('Can use enum', () => {
|
|
||||||
const { cpu, device, engine } = UAParser('Mozilla/5.0 (X11; U; Linux armv7l; en-GB; rv:1.9.2a1pre) Gecko/20090928 Firefox/3.5 Maemo Browser 1.4.1.22 RX-51 N900');
|
|
||||||
assert.strictEqual(cpu.is(CPUArch.ARM), true);
|
|
||||||
assert.strictEqual(device.is(DeviceType.MOBILE), true);
|
|
||||||
assert.strictEqual(engine.is(EngineName.GECKO), true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
const assert = require('assert');
|
|
||||||
const safeRegex = require('safe-regex');
|
|
||||||
const UAParser = require('ua-parser-js');
|
|
||||||
const { Bots, Emails, Tools } = require('ua-parser-js/extensions');
|
|
||||||
|
|
||||||
describe('Bots', () => {
|
|
||||||
it('Can detect bots', () => {
|
|
||||||
const googleBot = 'Googlebot-Video/1.0';
|
|
||||||
const msnBot = 'msnbot-media/1.1 (+http://search.msn.com/msnbot.htm)';
|
|
||||||
const bingPreview = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534+ (KHTML, like Gecko) BingPreview/1.0b';
|
|
||||||
const opera = 'Opera/8.5 (Macintosh; PPC Mac OS X; U; en)';
|
|
||||||
const wget = 'Wget/1.21.1';
|
|
||||||
const facebookBot = 'Mozilla/5.0 (compatible; FacebookBot/1.0; +https://developers.facebook.com/docs/sharing/webmasters/facebookbot/)';
|
|
||||||
const outlook = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; Microsoft Outlook 16.0.9126; Microsoft Outlook 16.0.9126; ms-office; MSOffice 16)';
|
|
||||||
const thunderbird = 'Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0';
|
|
||||||
|
|
||||||
const botParser = new UAParser(Bots);
|
|
||||||
assert.deepEqual(botParser.setUA(googleBot).getBrowser(), {name: "Googlebot-Video", version: "1.0", major: "1", type: "bot"});
|
|
||||||
assert.deepEqual(botParser.setUA(msnBot).getBrowser(), {name: "msnbot-media", version: "1.1", major: "1", type: "bot"});
|
|
||||||
assert.deepEqual(botParser.setUA(bingPreview).getBrowser(), {name: "BingPreview", version: "1.0b", major: "1", type: "bot"});
|
|
||||||
assert.deepEqual(botParser.setUA(opera).getBrowser(), {name: "Opera", version: "8.5", major: "8"});
|
|
||||||
|
|
||||||
// try merging Bots & Tools
|
|
||||||
const botsAndTools = { browser : [...Bots.browser, ...Tools.browser]};
|
|
||||||
const botolParser = new UAParser(botsAndTools);
|
|
||||||
assert.deepEqual(botolParser.setUA(wget).getBrowser(), {name: "Wget", version: "1.21.1", major: "1", type:"tool"});
|
|
||||||
assert.deepEqual(botolParser.setUA(facebookBot).getBrowser(), {name: "FacebookBot", version: "1.0", major: "1", type:"bot"});
|
|
||||||
|
|
||||||
const emailParser = new UAParser(Emails);
|
|
||||||
assert.deepEqual(emailParser.setUA(outlook).getBrowser(), {name: "Microsoft Outlook", version: "16.0.9126", major: "16", type: "email"});
|
|
||||||
assert.deepEqual(emailParser.setUA(thunderbird).getBrowser(), {name: "Thunderbird", version: "78.13.0", major: "78", type: "email"});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO : move test spec to JSON file
|
|
||||||
// TODO : check for safe-regex
|
|
||||||
@@ -1,342 +0,0 @@
|
|||||||
[{
|
|
||||||
"desc": "Essential PH-1",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 9; PH-1 Build/PPR1.180905.036) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.86 Mobile Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Essential",
|
|
||||||
"model": "PH-1",
|
|
||||||
"type": "mobile"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Gigaset Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 4.2.2; Gigaset QV830 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Gigaset",
|
|
||||||
"model": "QV830",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "RCA Voyager III Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 6.0.1; RCT6973W43 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "RCA",
|
|
||||||
"model": "RCT6973W43",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "RCA Voyager II Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 5.0; RCT6773W22B Build/LRX21M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "RCA",
|
|
||||||
"model": "RCT6773W22B",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Verizon Quanta Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; QMV7B Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Verizon",
|
|
||||||
"model": "QMV7B",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Verizon Ellipsis 8 Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 5.1.1; QTAQZ3 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Verizon",
|
|
||||||
"model": "QTAQZ3",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Verizon Ellipsis 8HD Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 6.0.1; QTASUN1 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Verizon",
|
|
||||||
"model": "QTASUN1",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Dell Venue 8 Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; Venue 8 3830 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Dell",
|
|
||||||
"model": "Venue 8 3830",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Dell Venue 7 Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; Venue 7 3730 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Dell",
|
|
||||||
"model": "Venue 7 3730",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Barnes & Noble Nook HD+ Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; Barnes & Noble Nook HD+ Build/JZO54K; CyanogenMod-10) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Barnes & Noble",
|
|
||||||
"model": "Nook HD+",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Barnes & Noble V400 Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 4.0.4; BNTV400 Build/IMM76L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.111 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Barnes & Noble",
|
|
||||||
"model": "V400",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "NuVision TM101A540N Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 5.1; TM101A540N Build/LMY47I; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/50.0.2661.86 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "NuVision",
|
|
||||||
"model": "TM101A540N",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "ZTE-Z431",
|
|
||||||
"ua": "ZTE-Z431/1.4.0 NetFront/4.2 QTV5.1 Profile/MIDP-2.1 Configuration/CLDC-1.1",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "ZTE",
|
|
||||||
"model": "Z431",
|
|
||||||
"type": "mobile"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "ZTE",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; ZTE-Z740G Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "ZTE",
|
|
||||||
"model": "Z740G",
|
|
||||||
"type": "mobile"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "ZTE K Series Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 6.0.1; K88 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "ZTE",
|
|
||||||
"model": "K88",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "ZTE Nubia Red Magic 3",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 9; NX629J Build/PKQ1.190321.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/45016 Mobile Safari/537.36 MMWEBID/4064 MicroMessenger/7.0.10.1580(0x27000A34) Process/tools NetType/WIFI Language/zh_CN ABI/arm64",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "ZTE",
|
|
||||||
"model": "NX629J",
|
|
||||||
"type": "mobile"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "ZTE Blade A5",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 9; ZTE Blade A5 2019) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.116 Mobile Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "ZTE",
|
|
||||||
"model": "Blade A5 2019",
|
|
||||||
"type": "mobile"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "ZTE BLADE V0730",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 6.0; ZTE BLADE V0730) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.116 Mobile Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "ZTE",
|
|
||||||
"model": "BLADE V0730",
|
|
||||||
"type": "mobile"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "ZTE B2017G",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 7.1.1; ZTE B2017G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.93 Mobile Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "ZTE",
|
|
||||||
"model": "B2017G",
|
|
||||||
"type": "mobile"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Swizz GEN610",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; GEN610 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Swiss",
|
|
||||||
"model": "GEN610",
|
|
||||||
"type": "mobile"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Swizz ZUR700",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; ZUR700 Build/KVT49L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Swiss",
|
|
||||||
"model": "ZUR700",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Zeki TB782b Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; U; Android 4.0.4; en-US; TB782B Build/IMM76D) AppleWebKit/534.31 (KHTML, like Gecko) UCBrowser/9.0.2.299 U3/0.8.0 Mobile Safari/534.31",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Zeki",
|
|
||||||
"model": "TB782B",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Dragon Touch Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 4.0.4; DT9138B Build/IMM76D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.72 Mobile Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Dragon Touch",
|
|
||||||
"model": "9138B",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Insignia Tablet",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; U; Android 6.0.1; NS-P08A7100 Build/MMB29M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Insignia",
|
|
||||||
"model": "NS-P08A7100",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Voice Xtreme V75",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; U; Android 4.2.1; en-us; V75 Build/JOP40D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Voice",
|
|
||||||
"model": "V75",
|
|
||||||
"type": "mobile"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "LvTel V11",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 5.1.1; V11 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "LvTel",
|
|
||||||
"model": "V11",
|
|
||||||
"type": "mobile"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Envizen Tablet V100MD",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; V100MD Build/V100MD.20130816) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Envizen",
|
|
||||||
"model": "V100MD",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Rotor Tablet",
|
|
||||||
"ua": "mozilla/5.0 (linux; android 5.0.1; tu_1491 build/lrx22c) applewebkit/537.36 (khtml, like gecko) chrome/43.0.2357.93 safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Rotor",
|
|
||||||
"model": "1491",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "MachSpeed Tablets",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; Trio 7.85 vQ Build/Trio_7.85_vQ) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "MachSpeed",
|
|
||||||
"model": "Trio 7.85 vQ",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Trinity Tablets",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 5.0.1; Trinity T101 Build/LRX22C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Trinity",
|
|
||||||
"model": "T101",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "NextBook Next7",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; Next7P12 Build/IMM76I) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "NextBook",
|
|
||||||
"model": "Next7P12",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "NextBook Tablets",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 5.0; NXA8QC116 Build/LRX21V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "NextBook",
|
|
||||||
"model": "NXA8QC116",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Le Pan Tablets",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 4.2.2; Le Pan TC802A Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Le Pan",
|
|
||||||
"model": "TC802A",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Le Pan Tablets",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 4.2.2; Le Pan TC802A Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Le Pan",
|
|
||||||
"model": "TC802A",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "AT&T Radiant Core U304AA",
|
|
||||||
"ua": "Dalvik/2.1.0 (Linux; U; Android 9; U304AA Build/P00610)",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "AT&T",
|
|
||||||
"model": "U304AA",
|
|
||||||
"type": "mobile"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Vodafone Smart Tab 4G",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 4.4.4; Vodafone Smart Tab 4G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Vodafone",
|
|
||||||
"model": "Smart Tab 4G",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "Vodafone Smart ultra 6",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 5.0.2; Vodafone Smart ultra 6 Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.133 Mobile Safari/537.36",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "Vodafone",
|
|
||||||
"model": "Smart ultra 6",
|
|
||||||
"type": "tablet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"desc": "4ife 4K Smart TV Box",
|
|
||||||
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; 4ife 4K Smart TV Box Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Safari/537.36 Vinebre",
|
|
||||||
"expect": {
|
|
||||||
"vendor": "undefined",
|
|
||||||
"model": "undefined",
|
|
||||||
"type": "smarttv"
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
519
test/test.js
519
test/test.js
File diff suppressed because one or more lines are too long
32
ua-parser-js.jquery.json
Normal file
32
ua-parser-js.jquery.json
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"title": "UAParser.js",
|
||||||
|
"name": "ua-parser-js",
|
||||||
|
"version": "0.7.0",
|
||||||
|
"description": "Lightweight JavaScript-based user-agent string parser",
|
||||||
|
"keywords": [
|
||||||
|
"user-agent",
|
||||||
|
"parser",
|
||||||
|
"browser",
|
||||||
|
"engine",
|
||||||
|
"os",
|
||||||
|
"device",
|
||||||
|
"cpu"
|
||||||
|
],
|
||||||
|
"homepage": "https://faisalman.github.com/ua-parser-js",
|
||||||
|
"author": {
|
||||||
|
"name": "Faisal Salman",
|
||||||
|
"email": "fyzlman@gmail.com"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"jquery": ">=1.5"
|
||||||
|
},
|
||||||
|
"licenses": [
|
||||||
|
{
|
||||||
|
"type": "MIT",
|
||||||
|
"url": "http://www.opensource.org/licenses/mit-license.php"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"bugs": "https://github.com/faisalman/ua-parser-js/issues",
|
||||||
|
"docs": "https://github.com/faisalman/ua-parser-js",
|
||||||
|
"download": "https://raw.github.com/faisalman/ua-parser-js/master/src/ua-parser.min.js"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user