From 18a4e5ade240ffa1c1b41a513d2826aa5438658c Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Thu, 24 Mar 2022 08:07:30 +0200 Subject: [PATCH 1/5] package.json: specify the folders to include --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index d442c5765..9c673849d 100644 --- a/package.json +++ b/package.json @@ -141,6 +141,10 @@ "Zach Bjornson " ], "main": "src/ua-parser.js", + "files": [ + "dist", + "src" + ], "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", "test": "jshint src/ua-parser.js && mocha -R nyan test/test.js", From dea39e1693e44b90b7c485dca0f2c9dda9377ff5 Mon Sep 17 00:00:00 2001 From: Varun Sharma Date: Mon, 11 Jul 2022 07:45:10 -0700 Subject: [PATCH 2/5] ci: add GitHub token permissions for workflow Signed-off-by: Varun Sharma --- .github/workflows/run-test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index ab126d2a6..203184294 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -2,6 +2,9 @@ name: ua-parser-js-run-test on: [push, pull_request] +permissions: + contents: read + jobs: run-test: runs-on: ubuntu-latest From ebb32d1ad96954cc2f255990df4e9f628cafc221 Mon Sep 17 00:00:00 2001 From: Jacky Choo Date: Wed, 27 Jul 2022 17:41:35 +0800 Subject: [PATCH 3/5] fixed sony bravia smart tv, added sharp AQUOS TV --- src/ua-parser.js | 9 ++++++--- test/device-test.json | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 1cfded873..39410a4da 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -54,6 +54,7 @@ MOTOROLA = 'Motorola', OPERA = 'Opera', SAMSUNG = 'Samsung', + SHARP = 'Sharp', SONY = 'Sony', XIAOMI = 'Xiaomi', ZEBRA = 'Zebra', @@ -504,7 +505,7 @@ // Sharp /\b(sh-?[altvz]?\d\d[a-ekm]?)/i - ], [MODEL, [VENDOR, 'Sharp'], [TYPE, MOBILE]], [ + ], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [ // MIXED /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i, @@ -617,8 +618,10 @@ /droid.+aft(\w)( bui|\))/i // Fire TV ], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [ /\(dtv[\);].+(aquos)/i // Sharp - ], [MODEL, [VENDOR, 'Sharp'], [TYPE, SMARTTV]], [ - /(bravia[\w- ]+) bui/i // Sony + ], [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]], [ + /(aquos-tv[\w ]+)\)/i // Sharp + ], [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],[ + /(bravia[\w ]+)( bui|\))/i // Sony ], [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]], [ /(mitv-\w{5}) bui/i // Xiaomi ], [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]], [ diff --git a/test/device-test.json b/test/device-test.json index 381ace8cb..dcc0498fa 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -1710,6 +1710,15 @@ "type": "smarttv" } }, + { + "desc": "Sharp AQUOS-TVX19B", + "ua": "Mozilla/5.0 (Linux; Android 9; AQUOS-TVX19B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Mobile Safari/537.36", + "expect": { + "vendor": "Sharp", + "model": "AQUOS-TVX19B", + "type": "smarttv" + } + }, { "desc": "Sharp Aquos B10", "ua": "Mozilla/5.0 (Linux; Android 7.0; SH-A01) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Mobile Safari/537.36", @@ -1890,6 +1899,24 @@ "type": "smarttv" } }, + { + "desc": "Sony BRAVIA 4K GB ATV3", + "ua": "Mozilla/5.0 (Linux; Android 9; BRAVIA 4K GB ATV3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Mobile Safari/537.36", + "expect": { + "vendor": "Sony", + "model": "BRAVIA 4K GB ATV3", + "type": "smarttv" + } + }, + { + "desc": "Sony Bravia 4k UR2", + "ua": "Mozilla/5.0 (Linux: Andr0id 9: BRAVIA 4K UR2 Build/PTT1.190515.001.S104) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36 OPR/46.0.2207.0 OMI/4.13.5.431.DIA5HBBTV.250 Model/Sony-BRAVIA-4K-UR2", + "expect": { + "vendor": "Sony", + "model": "BRAVIA 4K UR2", + "type": "smarttv" + } + }, { "desc" : "Tesla", "ua" : "Mozilla/5.0 (X11; GNU/Linux) AppleWebKit/601.1 (KHTML, like Gecko) Tesla QtCarBrowser Safari/601.1", From 75e58525fe5bda8bef1b284c2c89ebf781da578f Mon Sep 17 00:00:00 2001 From: nabetama Date: Thu, 15 Sep 2022 23:10:12 +0900 Subject: [PATCH 4/5] Safari and Mobile Safari began to include commas in the minor version numbers. --- src/ua-parser.js | 4 ++-- test/browser-test.json | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 1cfded873..5294de38d 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -301,9 +301,9 @@ /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia ], [NAME, VERSION], [ - /version\/([\w\.]+) .*mobile\/\w+ (safari)/i // Mobile Safari + /version\/([\w(\.|\,)]+) .*mobile\/\w+ (safari)/i // Mobile Safari ], [VERSION, [NAME, 'Mobile Safari']], [ - /version\/([\w\.]+) .*(mobile ?safari|safari)/i // Safari & Safari Mobile + /version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i // Safari & Safari Mobile ], [VERSION, NAME], [ /webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i // Safari < 3.0 ], [NAME, [VERSION, strMapper, oldSafariMap]], [ diff --git a/test/browser-test.json b/test/browser-test.json index 4895ba4d2..bf8163a1f 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -1571,5 +1571,25 @@ { "name" : "LinkedIn" } + }, + { + "desc" : "Safari including comma in minor version number", + "ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6,2 Safari/605.1.15", + "expect" : + { + "name" : "Safari", + "version" : "15.6,2", + "major" : "15" + } + }, + { + "desc" : "Mobile Safari including comma in minor version number", + "ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 15_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6,2 Mobile/15E148 Safari/604.1", + "expect" : + { + "name" : "Mobile Safari", + "version" : "15.6,2", + "major" : "15" + } } ] From 8483ac09b3076e5395e1e3bf64b34a62bf7a7b28 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sun, 18 Sep 2022 16:37:13 +0700 Subject: [PATCH 5/5] Refine small redundancy --- src/ua-parser.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index e9121229a..67e4db862 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -302,7 +302,7 @@ /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia ], [NAME, VERSION], [ - /version\/([\w(\.|\,)]+) .*mobile\/\w+ (safari)/i // Mobile Safari + /version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i // Mobile Safari ], [VERSION, [NAME, 'Mobile Safari']], [ /version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i // Safari & Safari Mobile ], [VERSION, NAME], [ @@ -617,8 +617,7 @@ ], [[MODEL, CHROME+'cast'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [ /droid.+aft(\w)( bui|\))/i // Fire TV ], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [ - /\(dtv[\);].+(aquos)/i // Sharp - ], [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]], [ + /\(dtv[\);].+(aquos)/i, /(aquos-tv[\w ]+)\)/i // Sharp ], [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],[ /(bravia[\w ]+)( bui|\))/i // Sony