Skip to content

Commit

Permalink
Improve detection for Nokia device & Symbian OS
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Dec 23, 2024
1 parent e8a3012 commit 10ab810
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 12 deletions.
13 changes: 5 additions & 8 deletions src/main/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,8 @@
// Nokia
/(nokia) (t[12][01])/i
], [VENDOR, MODEL, [TYPE, TABLET]], [
/(?:maemo|nokia).*(n900|lumia \d+)/i,
/nokia[-_ ]?(([-\w\.]*))/i
/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,
/nokia[-_ ]?(([-\w\. ]*))/i
], [[MODEL, /_/g, ' '], [TYPE, MOBILE], [VENDOR, 'Nokia']], [

// Google
Expand Down Expand Up @@ -930,15 +930,12 @@
], [VERSION, NAME], [
/(ubuntu) ([\w\.]+) like android/i // Ubuntu Touch
], [[NAME, /(.+)/, '$1 Touch'], VERSION], [
// Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS/OpenHarmony
/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,
/(blackberry)\w*\/([\w\.]*)/i, // Blackberry
/(tizen|kaios)[\/ ]([\w\.]+)/i, // Tizen/KaiOS
/\((series40);/i // Series 40
// Android/Blackberry/WebOS/QNX/Bada/RIM/KaiOS/Maemo/MeeGo/S40/Sailfish OS/OpenHarmony/Tizen
/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i
], [NAME, VERSION], [
/\(bb(10);/i // BlackBerry 10
], [VERSION, [NAME, BLACKBERRY]], [
/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i // Symbian
/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i // Symbian
], [VERSION, [NAME, 'Symbian']], [
/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i // Firefox OS
], [VERSION, [NAME, FIREFOX+' OS']], [
Expand Down
45 changes: 45 additions & 0 deletions test/data/ua/device/nokia.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
"type": "mobile"
}
},
{
"desc": "Nokia 5800 XpressMusic",
"ua": "Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0 Nokia5800d-1/10.4.016; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413",
"expect": {
"vendor": "Nokia",
"model": "5800d-1",
"type": "mobile"
}
},
{
"desc": "Nokia 7",
"ua": "Mozilla/5.0 (Linux; Android 11; Nokia 7.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Mobile Safari/537.36",
Expand All @@ -26,6 +35,33 @@
"type": "mobile"
}
},
{
"desc": "Nokia 808 PureView",
"ua": "Mozilla/5.0 (Symbian; U; Nokia808 PureView; en-GB) AppleWebKit/534.3 (KHTML, like Gecko) Version/3.0 Mobile/1A543a Mobile Safari/534.3",
"expect": {
"vendor": "Nokia",
"model": "808 PureView",
"type": "mobile"
}
},
{
"desc": "Nokia 808 PureView",
"ua": "Mozilla/5.0 (Symbian/3; Series60/5.5 Nokia808PureView/113.010.1508; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/535.1 (KHTML, like Gecko) NokiaBrowser/8.3.2.21 Mobile Safari/535.1 3gpp-gba",
"expect": {
"vendor": "Nokia",
"model": "808PureView",
"type": "mobile"
}
},
{
"desc": "Nokia Lumia 630",
"ua": "UCWEB/2.0 (Windows; U; wds 8.10; en-IN; NOKIA; RM-978_1046) U2/1.0.0 UCBrowser/4.2.0.524 U2/1.0.0 Mobile",
"expect": {
"vendor": "Nokia",
"model": "RM-978",
"type": "mobile"
}
},
{
"desc": "Nokia N9",
"ua": "Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",
Expand All @@ -35,6 +71,15 @@
"type": "mobile"
}
},
{
"desc": "Nokia N900",
"ua": "Mozilla/5.0 (Linux; Maemo 5.0; Nokia N900; Build/4.0.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0 Mobile Safari/537.36",
"expect": {
"vendor": "Nokia",
"model": "N900",
"type": "mobile"
}
},
{
"desc": "Nokia T20",
"ua": "Mozilla/5.0 (Linux; Android 12; Nokia T20) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",
Expand Down
18 changes: 18 additions & 0 deletions test/data/ua/os/maemo.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,23 @@
"name" : "Maemo",
"version" : "undefined"
}
},
{
"desc" : "Nokia N900 Linux mobile, on the Maemo browser",
"ua" : "Mozilla/5.0(X11; U; Linux armv7l; fr-FR; rv:1.9.2a1pre) Gecko/20091127 Firefox/3.5 Maemo Browser 1.5.6 RX-51 N900",
"expect" :
{
"name" : "Maemo",
"version" : "undefined"
}
},
{
"desc" : "Nokia N900 Linux mobile, on the Maemo browser",
"ua" : "Mozilla/5.0 (Linux; Maemo 5.0; Nokia N900; Build/4.0.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0 Mobile Safari/537.36",
"expect" :
{
"name" : "Maemo",
"version" : "5.0"
}
}
]
2 changes: 1 addition & 1 deletion test/data/ua/os/qnx.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"expect" :
{
"name" : "QNX",
"version" : "x86pc"
"version" : "undefined"
}
}
]
51 changes: 48 additions & 3 deletions test/data/ua/os/symbian.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"desc" : "Symbian",
"desc" : "Nokia 5250",
"ua" : "Nokia5250/10.0.011 (SymbianOS/9.4; U; Series60/5.0 Mozilla/5.0; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Safari/525 3gpp-gba",
"expect" :
{
Expand All @@ -9,12 +9,57 @@
}
},
{
"desc" : "Symbian",
"desc" : "Nokia N79",
"ua" : "Mozilla/5.0 (SymbianOS/9.3; U; Series60/3.2 NokiaN79-1/32.001; Profile/MIDP-2.1 Configuration/CLDC-1",
"expect" :
{
"name" : "Symbian",
"version" : "9.3"
}
},
{
"desc" : "Nokia E71",
"ua" : "Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE71-1/110.07.127; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413",
"expect" :
{
"name" : "Symbian",
"version" : "9.2"
}
},
{
"desc" : "Opera Mini on S60",
"ua" : "Opera/9.80 (Series 60; Opera Mini/7.1.32444/191.361; U; de) Presto/2.12.423 Version/12.16",
"expect" :
{
"name" : "Symbian",
"version" : "undefined"
}
},
{
"desc" : "NokiaBrowser on Nokia C7",
"ua" : "Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaC7-00/024.001; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/533.4 (KHTML, like Gecko) NokiaBrowser/7.3.1.37 Mobile Safari/533.4 3gpp-gba",
"expect" :
{
"name" : "Symbian",
"version" : "5.2"
"version" : "3"
}
},
{
"desc" : "Nokia 808 PureView",
"ua" : "Mozilla/5.0 (Symbian/3; Series60/5.5 Nokia808PureView/113.010.1508; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/535.1 (KHTML, like Gecko) NokiaBrowser/8.3.2.21 Mobile Safari/535.1 3gpp-gba",
"expect" :
{
"name" : "Symbian",
"version" : "3"
}
},
{
"desc" : "Nokia 808 PureView",
"ua" : "Mozilla/5.0 (Symbian; U; Nokia808 PureView; en-GB) AppleWebKit/534.3 (KHTML, like Gecko) Version/3.0 Mobile/1A543a Mobile Safari/534.3",
"expect" :
{
"name" : "Symbian",
"version" : "undefined"
}
}
]

0 comments on commit 10ab810

Please sign in to comment.