Skip to content

Commit

Permalink
Add new OS: Ubuntu Touch
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Dec 12, 2024
1 parent 5d603da commit 594b6b1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/enums/ua-parser-enums.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ export const OS: Readonly<{
SYMBIAN: "Symbian";
TIZEN: "Tizen";
UBUNTU: "Ubuntu";
UBUNTU_TOUCH: "Ubuntu Touch",
UNIX: "Unix";
VECTORLINUX: "VectorLinux";
WATCHOS: "watchOS";
Expand Down
1 change: 1 addition & 0 deletions src/enums/ua-parser-enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ const OS = Object.freeze({
SYMBIAN: 'Symbian',
TIZEN: 'Tizen',
UBUNTU: 'Ubuntu',
UBUNTU_TOUCH: 'Ubuntu Touch',
UNIX: 'Unix',
VECTORLINUX: 'VectorLinux',
WATCHOS: 'watchOS',
Expand Down
5 changes: 4 additions & 1 deletion src/main/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,10 @@

// Mobile OSes
/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS
], [VERSION, NAME], [ // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS/OpenHarmony
], [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
Expand Down
11 changes: 11 additions & 0 deletions test/data/ua/os/ubuntu-touch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"desc" : "Ubuntu Touch",
"ua" : "Mozilla/5.0 (Linux; Ubuntu 16.04 like Android 4.4) AppleWebKit/537.36 Chromium/65.0.3325.151 Mobile Safari/537.36",
"expect" :
{
"name" : "Ubuntu Touch",
"version" : "16.04"
}
}
]

0 comments on commit 594b6b1

Please sign in to comment.