Skip to content

Commit

Permalink
Backport - Fix #722 - Add new browser name: Twitter
Browse files Browse the repository at this point in the history
(cherry picked from commit d0db40c)
  • Loading branch information
faisalman committed May 28, 2024
1 parent fecff02 commit 775de4e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
/safari (line)\/([\w\.]+)/i, // Line App for iOS
/\b(line)\/([\w\.]+)\/iab/i, // Line App for Android
/(alipay)client\/([\w\.]+)/i, // Alipay
/(twitter)(?:and| f.+e\/([\w\.]+))/i, // Twitter
/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i // Chromium/Instagram/Snapchat
], [NAME, VERSION], [
/\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS
Expand Down Expand Up @@ -439,7 +440,7 @@
/; (\w+) bui.+ oppo/i,
/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i
], [MODEL, [VENDOR, 'OPPO'], [TYPE, MOBILE]], [
/\b(opd2\d{3}a?) bui\//i
/\b(opd2\d{3}a?) bui/i
], [MODEL, [VENDOR, 'OPPO'], [TYPE, TABLET]], [

// Vivo
Expand Down
20 changes: 20 additions & 0 deletions test/browser-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -2031,5 +2031,25 @@
"version" : "12.33.0.36",
"major" : "12"
}
},
{
"desc" : "Twitter",
"ua" : "Mozilla/5.0 (Linux; Android 13; CPH2531 Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/123.0.6312.120 Mobile Safari/537.36 TwitterAndroid",
"expect" :
{
"name" : "Twitter",
"version" : "undefined",
"major" : "undefined"
}
},
{
"desc" : "Twitter",
"ua" : "Mozilla/5.0 (iPad; CPU OS 15_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/19H12 Twitter for iPhone/10.34",
"expect" :
{
"name" : "Twitter",
"version" : "10.34",
"major" : "10"
}
}
]

0 comments on commit 775de4e

Please sign in to comment.