From 95fcd3f672d7d533f02b753a57ca90f25b0eff64 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 13 Oct 2018 10:01:51 +0700 Subject: [PATCH 1/3] Fix #321: Add a LICENSE to be recognized by GitHub API --- license.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 license.md diff --git a/license.md b/license.md new file mode 100644 index 0000000..1f3ef51 --- /dev/null +++ b/license.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2012-2018 Faisal Salman <> + +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. From 4cc29dd88c75f5380968ab323806aac824da5ee6 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sun, 21 Oct 2018 15:21:03 +0700 Subject: [PATCH 2/3] Update readme: using TypeScript --- readme.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index a3abd64..7a0cf8c 100644 --- a/readme.md +++ b/readme.md @@ -25,7 +25,7 @@ * `getBrowser()` * returns `{ name: '', version: '' }` -``` +```sh # Possible 'browser.name': 2345Explorer, Amaya, Android Browser, Arora, Avant, BIDUBrowser, Baidu, Basilisk, Blazer, Bolt, Bowser, Camino, Chimera, Chrome Headless, @@ -47,7 +47,7 @@ Vivaldi, Waterfox, WeChat, Yandex, baidu, iCab, w3m * `getDevice()` * returns `{ model: '', type: '', vendor: '' }` -``` +```sh # Possible 'device.type': console, mobile, tablet, smarttv, wearable, embedded @@ -63,7 +63,7 @@ Samsung, Sharp, Siemens, Sony[Ericsson], Sprint, Xbox, Xiaomi, ZTE * `getEngine()` * returns `{ name: '', version: '' }` -``` +```sh # Possible 'engine.name' Amaya, EdgeHTML, Gecko, iCab, KHTML, Links, Lynx, NetFront, NetSurf, Presto, Tasman, Trident, w3m, WebKit @@ -74,7 +74,7 @@ Tasman, Trident, w3m, WebKit * `getOS()` * returns `{ name: '', version: '' }` -``` +```sh # Possible 'os.name' AIX, Amiga OS, Android, Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS, Contiki, Fedora, Firefox OS, FreeBSD, Debian, DragonFly, Gentoo, GNU, Haiku, Hurd, iOS, @@ -89,7 +89,7 @@ Ubuntu, Unix, VectorLinux, WebOS, Windows [Phone/Mobile], Zenwalk * `getCPU()` * returns `{ architecture: '' }` -``` +```sh # Possible 'cpu.architecture' 68k, amd64, arm[64], avr, ia[32/64], irix[64], mips[64], pa-risc, ppc, sparc[64] ``` @@ -233,6 +233,14 @@ $ bower install ua-parser-js $ meteor add faisalman:ua-parser-js ``` +## Using TypeScript + +```sh +$ npm install --save @types/ua-parser-js +# Download TS type definition from DefinitelyTyped repository: +# https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ua-parser-js +``` + ## Using CLI ```sh From 6c2a767e32fa7f00e976452a570a0d1e00786a54 Mon Sep 17 00:00:00 2001 From: Alvin Portillo Date: Mon, 22 Oct 2018 11:18:09 -0700 Subject: [PATCH 3/3] Add Pixel 2 XL, Pixel 3, Pixel 3 XL Device Models --- package.json | 1 + src/ua-parser.js | 2 +- test/device-test.json | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 119a0ae..6b25f3e 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "Aamir Poonawalla ", "Admas ", "algenon ", + "Alvin Portillo ", "Andrea Vaghi ", "Anton Zhiyanov ", "Arturo Mejia ", diff --git a/src/ua-parser.js b/src/ua-parser.js index 6ef423e..3d8bce8 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -677,7 +677,7 @@ /android.+;\s(pixel c)\s/i // Google Pixel C ], [MODEL, [VENDOR, 'Google'], [TYPE, TABLET]], [ - /android.+;\s(pixel [xl2]{1,2}|pixel)\s/i // Google Pixel + /android.+;\s(pixel( [23])?( xl)?)\s/i // Google Pixel ], [MODEL, [VENDOR, 'Google'], [TYPE, MOBILE]], [ /android.+;\s(\w+)\s+build\/hm\1/i, // Xiaomi Hongmi 'numeric' models diff --git a/test/device-test.json b/test/device-test.json index 340ddb9..42668ef 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -584,6 +584,33 @@ "type": "mobile" } }, + { + "desc": "Google Pixel 2 XL", + "ua": "Mozilla/5.0 (Linux; Android 8.1.0; Pixel 2 XL Build/OPM1.171019.013) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 Safari/537.36", + "expect": { + "vendor": "Google", + "model": "Pixel 2 XL", + "type": "mobile" + } + }, + { + "desc": "Google Pixel 3", + "ua": "Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PD1A.180720.030) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36", + "expect": { + "vendor": "Google", + "model": "Pixel 3", + "type": "mobile" + } + }, + { + "desc": "Google Pixel 3 XL", + "ua": "Mozilla/5.0 (Linux; Android 9; Pixel 3 XL Build/PD1A.180720.030) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Mobile Safari/537.36", + "expect": { + "vendor": "Google", + "model": "Pixel 3 XL", + "type": "mobile" + } + }, { "desc": "Generic Android Device", "ua": "Mozilla/5.0 (Linux; U; Android 6.0.1; i980 Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",