Skip to content

Commit

Permalink
Add new device & browser: Tesla
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Apr 4, 2021
1 parent 557cc21 commit 09aa910
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 6 deletions.
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ Mozilla, NetFront, NetSurf, Netfront, Netscape, NokiaBrowser, Oculus Browser,
OmniWeb, Opera Coast, Opera [Mini/Mobi/Tablet], PaleMoon, PhantomJS, Phoenix,
Polaris, Puffin, QQ, QQBrowser, QQBrowserLite, Quark, QupZilla, RockMelt, Safari,
Sailfish Browser, Samsung Browser, SeaMonkey, Silk, Skyfire, Sleipnir, Slim,
SlimBrowser, Swiftfox, Tizen Browser, UCBrowser, Vivaldi, Waterfox, WeChat, Weibo,
Yandex, baidu, iCab, w3m, Whale Browser...
SlimBrowser, Swiftfox, Tesla, Tizen Browser, UCBrowser, Vivaldi, Waterfox, WeChat,
Weibo, Yandex, baidu, iCab, w3m, Whale Browser...

# 'browser.version' determined dynamically
```
Expand All @@ -65,7 +65,7 @@ Acer, Alcatel, Amazon, Apple, Archos, ASUS, AT&T, BenQ, BlackBerry, Dell,
Essential, GeeksPhone, Google, HP, HTC, Huawei, Jolla, Lenovo, LG, Meizu,
Microsoft, Motorola, Nexian, Nintendo, Nokia, Nvidia, OnePlus, OPPO, Ouya,
Palm, Panasonic, Pebble, Polytron, Realme, RIM, Samsung, Sharp, Siemens,
Sony[Ericsson], Sprint, Vivo, Vodafone, Xbox, Xiaomi, Zebra, ZTE, ...
Sony[Ericsson], Sprint, Tesla, Vivo, Vodafone, Xbox, Xiaomi, Zebra, ZTE, ...

# 'device.model' determined dynamically
```
Expand Down
16 changes: 13 additions & 3 deletions src/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@
/(?:ms|\()(ie)\s([\w\.]+)/i, // Internet Explorer

// Webkit/KHTML based
/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon)\/([\w\.-]+)/i,
// Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon)\/([\w\.-]+)/i,
// Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon
/(rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([\w\.]+)/i, // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ
/(weibo)__([\d\.]+)/i // Weibo
], [NAME, VERSION], [
Expand Down Expand Up @@ -291,7 +291,10 @@
], [[NAME, 'Facebook']], [
/\s(electron)\/([\w\.]+)\ssafari/i, // Electron-based App
/safari\s(line)\/([\w\.]+)/i, // Line App for iOS
/\b(line)\/([\w\.]+)\/iab/i // Line App for Android
/\b(line)\/([\w\.]+)\/iab/i, // Line App for Android
/(tesla)(?:\sqtcarbrowser|\/(20[12]\d\.[\w\.-]+))/i, // Tesla

/(chromium)\/([\w\.-]+)/i // Chromium
], [NAME, VERSION], [
/\bgsa\/([\w\.]+)\s.*safari\//i // Google Search Appliance on iOS
], [VERSION, [NAME, 'GSA']], [
Expand Down Expand Up @@ -641,6 +644,13 @@
/droid\s[\d\.]+;\s(wt63?0{2,3})\)/i
], [MODEL, [VENDOR, 'Zebra'], [TYPE, WEARABLE]], [

///////////////////
// EMBEDDED
///////////////////

/(tesla)(?:\sqtcarbrowser|\/20[12]\d\.[\w\.-]+)/i // Tesla
], [VENDOR, [TYPE, EMBEDDED]], [

////////////////////
// MIXED (GENERIC)
///////////////////
Expand Down
20 changes: 20 additions & 0 deletions test/browser-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,26 @@
"major" : "undefined"
}
},
{
"desc" : "Tesla",
"ua" : "Mozilla/5.0 (X11; GNU/Linux) AppleWebKit/601.1 (KHTML, like Gecko) Tesla QtCarBrowser Safari/601.1",
"expect" :
{
"name" : "Tesla",
"version" : "undefined",
"major" : "undefined"
}
},
{
"desc" : "Tesla",
"ua" : "Mozilla/5.0 (X11; GNU/Linux) AppleWebKit/537.36 (KHTML, like Gecko) Chromium/79.0.3945.130 Chrome/79.0.3945.130 Safari/537.36 Tesla/2020.16.2.1-e99c70fff409",
"expect" :
{
"name" : "Tesla",
"version" : "2020.16.2.1-e99c70fff409",
"major" : "2020"
}
},
{
"desc" : "Tizen Browser",
"ua" : "Mozilla/5.0 (Linux; U; Tizen/1.0 like Android; en-us; AppleWebKit/534.46 (KHTML, like Gecko) Tizen Browser/1.0 Mobile",
Expand Down
20 changes: 20 additions & 0 deletions test/device-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,26 @@
"type": "tablet"
}
},
{
"desc" : "Tesla",
"ua" : "Mozilla/5.0 (X11; GNU/Linux) AppleWebKit/601.1 (KHTML, like Gecko) Tesla QtCarBrowser Safari/601.1",
"expect" :
{
"vendor": "Tesla",
"model": "undefined",
"type": "embedded"
}
},
{
"desc" : "Tesla",
"ua" : "Mozilla/5.0 (X11; GNU/Linux) AppleWebKit/537.36 (KHTML, like Gecko) Chromium/79.0.3945.130 Chrome/79.0.3945.130 Safari/537.36 Tesla/2020.16.2.1-e99c70fff409",
"expect" :
{
"vendor": "Tesla",
"model": "undefined",
"type": "embedded"
}
},
{
"desc": "Xiaomi 2013023",
"ua": "Mozilla/5.0 (Linux; U; Android 4.2.2; en-US; 2013023 Build/HM2013023) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 UCBrowser/10.0.1.512 U3/0.8.0 Mobile Safari/533.1",
Expand Down

0 comments on commit 09aa910

Please sign in to comment.