Skip to content

Commit

Permalink
Fix #754: Add new Engine: ArkWeb & new OS: OpenHarmony
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Oct 22, 2024
1 parent 7201755 commit fe15f11
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/enums/ua-parser-enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ const Vendor = Object.freeze({

const Engine = Object.freeze({
AMAYA: 'Amaya',
ARKWEB: 'ArkWeb',
BLINK: 'Blink',
EDGEHTML: 'EdgeHTML',
FLOW: 'Flow',
Expand Down Expand Up @@ -321,6 +322,7 @@ const OS = Object.freeze({
NETRANGE: 'NetRange',
NETTV: 'NetTV',
NINTENDO: 'Nintendo',
OPENHARMONY: 'OpenHarmony',
OPENBSD: 'OpenBSD',
OPENVMS: 'OpenVMS',
OS2: 'OS/2',
Expand Down
7 changes: 5 additions & 2 deletions src/main/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,9 @@
/windows.+ edge\/([\w\.]+)/i // EdgeHTML
], [VERSION, [NAME, EDGE+'HTML']], [

/(arkweb)\/([\w\.]+)/i // ArkWeb
], [NAME, VERSION], [

/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink
], [VERSION, [NAME, 'Blink']], [

Expand Down Expand Up @@ -844,8 +847,8 @@

// Mobile OSes
/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS
], [VERSION, NAME], [ // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS
/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,
], [VERSION, NAME], [ // 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
Expand Down
9 changes: 9 additions & 0 deletions test/specs/engine-all.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"desc" : "ArkWeb",
"ua" : "Mozilla/5.0 (Phone; OpenHarmony 4.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 ArkWeb/4.1.6.1 Mobile",
"expect" :
{
"name" : "ArkWeb",
"version" : "4.1.6.1"
}
},
{
"desc" : "Blink",
"ua" : "Mozilla/5.0 (Linux; Android 7.0; SM-G920I Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/3.4.9 SamsungBrowser/4.0 Chrome/57.0.2987.146 Mobile VR Safari/537.36",
Expand Down
9 changes: 9 additions & 0 deletions test/specs/os-all.json
Original file line number Diff line number Diff line change
Expand Up @@ -1309,5 +1309,14 @@
"name" : "SerenityOS",
"version" : "undefined"
}
},
{
"desc" : "OpenHarmony",
"ua" : "Mozilla/5.0 (Phone; OpenHarmony 4.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 ArkWeb/4.1.6.1 Mobile",
"expect" :
{
"name" : "OpenHarmony",
"version" : "4.1"
}
}
]

0 comments on commit fe15f11

Please sign in to comment.