Skip to content

Commit

Permalink
Backport - Fix misidentified WebView token as device model - found in #…
Browse files Browse the repository at this point in the history
…681 (cherry picked from commit b51ae9e)
  • Loading branch information
faisalman committed Oct 27, 2023
1 parent 3b896d5 commit ea2c829
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@
/fxios\/([-\w\.]+)/i // Firefox for iOS
], [VERSION, [NAME, FIREFOX]], [
/\bqihu|(qi?ho?o?|360)browser/i // 360
], [[NAME, '360' + SUFFIX_BROWSER]], [
], [[NAME, '360 ' + BROWSER]], [
/(oculus|samsung|sailfish|huawei|vivo)browser\/([\w\.]+)/i
], [[NAME, /(.+)/, '$1' + SUFFIX_BROWSER], VERSION], [ // Oculus/Samsung/Sailfish/HuaweiBrowser/VivoBrowser
], [[NAME, /(.+)/, '$1 ' + BROWSER], VERSION], [ // Oculus/Samsung/Sailfish/HuaweiBrowser/VivoBrowser
/(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
], [[NAME, /_/g, ' '], VERSION], [
/(electron)\/([\w\.]+) safari/i, // Electron-based App
Expand Down Expand Up @@ -419,7 +419,7 @@
/\b; (\w+) build\/hm\1/i, // Xiaomi Hongmi 'numeric' models
/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, // Xiaomi Hongmi
/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, // Xiaomi Redmi
/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|\))/i, // Xiaomi Redmi 'numeric' models
/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i, // Xiaomi Redmi 'numeric' models
/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i // Xiaomi Mi
], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [
/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i, // Redmi Pad
Expand Down Expand Up @@ -682,7 +682,7 @@
// MIXED (GENERIC)
///////////////////

/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i // Android Phones from Unidentified Vendors
/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i // Android Phones from Unidentified Vendors
], [MODEL, [TYPE, MOBILE]], [
/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i // Android Tablets from Unidentified Vendors
], [MODEL, [TYPE, TABLET]], [
Expand Down
18 changes: 18 additions & 0 deletions test/device-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -2807,6 +2807,24 @@
"type": "mobile"
}
},
{
"desc": "XiaoMi Redmi Note 12 Turbo",
"ua": "Mozilla/5.0 (Linux; Android 13; 23049RAD8C; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/87.0.4280.141 Mobile Safari/537.36 VivoBrowser/16.7.1.1",
"expect": {
"vendor": "Xiaomi",
"model": "23049RAD8C",
"type": "mobile"
}
},
{
"desc": "ZTE Blade A6",
"ua": "Mozilla/5.0 (Linux; Android 7.1.1; ZTE BLADE A0620 Build/NMF26F; ru-ru) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.136 Mobile Safari/537.36 Puffin/9.2.0.50586AP",
"expect": {
"vendor": "ZTE",
"model": "BLADE A0620",
"type": "mobile"
}
},
{
"desc": "PlayStation 4",
"ua": "Mozilla/5.0 (PlayStation 4 3.00) AppleWebKit/537.73 (KHTML, like Gecko)",
Expand Down

0 comments on commit ea2c829

Please sign in to comment.