From eeaf198197215a5395dbe6f9a9c91150dc4de435 Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Sat, 9 Sep 2023 19:48:54 +0700 Subject: [PATCH] Backport - Add Snapchat user agent. (cherry picked from commit 153831d2edb73db1f066c5638da733d302027a1e) --- src/ua-parser.js | 2 +- test/browser-test.json | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index ab2d24402..e24bc25f6 100755 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -292,7 +292,7 @@ /(naver)\(.*?(\d+\.[\w\.]+).*\)/i, // Naver InApp /safari (line)\/([\w\.]+)/i, // Line App for iOS /\b(line)\/([\w\.]+)\/iab/i, // Line App for Android - /(chromium|instagram)[\/ ]([-\w\.]+)/i // Chromium/Instagram + /(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i // Chromium/Instagram/Snapchat ], [NAME, VERSION], [ /\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS ], [VERSION, [NAME, 'GSA']], [ diff --git a/test/browser-test.json b/test/browser-test.json index 6ddda5d0b..4db8631f0 100644 --- a/test/browser-test.json +++ b/test/browser-test.json @@ -1819,5 +1819,45 @@ "version": "28.3.4", "major" : "28" } + }, + { + "desc" : "Chrome Mobile", + "ua" : "Mozilla/5.0 (Linux; Android 7.1.2; Nexus 5X Build/N2G47W) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Mobile Safari/537.36", + "expect" : + { + "name" : "Mobile Chrome", + "version" : "58.0.3029.83", + "major" : "58" + } + }, + { + "desc" : "Firefox Mobile", + "ua" : "Mozilla/5.0 (Linux; Android 7.1.2; Nexus 5X Build/N2G47W) AppleWebKit/537.36 (KHTML, like Gecko) FxiOS/7.5b3349 Mobile/14F89 Safari/603.2.4", + "expect" : + { + "name" : "Mobile Firefox", + "version" : "7.5b3349", + "major" : "7" + } + }, + { + "desc" : "Firefox Mobile", + "ua" : "Mozilla/5.0 (Android 5.0; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0", + "expect" : + { + "name" : "Mobile Firefox", + "version" : "41.0", + "major" : "41" + } + }, + { + "desc" : "Snapchat", + "ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Snapchat/12.33.0.36 (like Safari/8614.1.25.0.31, panda)", + "expect" : + { + "name" : "Snapchat", + "version" : "12.33.0.36", + "major" : "12" + } } ]