Skip to content

Commit

Permalink
Add new OS: Windows IoT
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Dec 11, 2024
1 parent f854f26 commit 84b41f5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
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 @@ -356,6 +356,7 @@ export const OS: Readonly<{
WATCHOS: "watchOS";
WEBOS: "WebOS";
WINDOWS: "Windows";
WINDOWS_IOT: "Windows IoT";
WINDOWS_MOBILE: "Windows Mobile";
WINDOWS_PHONE: "Windows Phone";
XBOX: "Xbox";
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 @@ -371,6 +371,7 @@ const OS = Object.freeze({
WATCHOS: 'watchOS',
WEBOS: 'WebOS',
WINDOWS: 'Windows',
WINDOWS_IOT: 'Windows IoT',
WINDOWS_MOBILE: 'Windows Mobile',
WINDOWS_PHONE: 'Windows Phone',
XBOX: 'Xbox',
Expand Down
8 changes: 5 additions & 3 deletions src/main/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,8 @@
], [VENDOR, [TYPE, EMBEDDED]], [
/(aeobc)\b/i // Echo Dot
], [MODEL, [VENDOR, AMAZON], [TYPE, EMBEDDED]], [
/windows iot/i
], [[TYPE, EMBEDDED]], [

////////////////////
// MIXED (GENERIC)
Expand Down Expand Up @@ -888,10 +890,10 @@
// Windows
/microsoft (windows) (vista|xp)/i // Windows (iTunes)
], [NAME, VERSION], [
/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i // Windows Phone
/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i // Windows Phone
], [NAME, [VERSION, strMapper, windowsVersionMap]], [
/windows nt 6\.2; (arm)/i, // Windows RT
/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,
/windows nt 6\.2; (arm)/i, // Windows RT
/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,
/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i
], [[VERSION, strMapper, windowsVersionMap], [NAME, WINDOWS]], [

Expand Down
9 changes: 9 additions & 0 deletions test/data/ua/device/_others.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,14 @@
"model": "undefined",
"type": "mobile"
}
},
{
"desc" : "Windows IoT",
"ua" : "Mozilla/5.0 (Windows IoT 10.0; Android 6.0.1; WebView/3.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Mobile Safari/537.36 Edge/18.17763",
"expect": {
"vendor": "undefined",
"model": "undefined",
"type": "embedded"
}
}
]
9 changes: 9 additions & 0 deletions test/data/ua/os/windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@
"version" : "CE"
}
},
{
"desc" : "Windows IoT",
"ua" : "Mozilla/5.0 (Windows IoT 10.0; Android 6.0.1; WebView/3.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Mobile Safari/537.36 Edge/18.17763",
"expect" :
{
"name" : "Windows IoT",
"version" : "10.0"
}
},
{
"desc" : "Windows NT on x86 or aarch64 CPU using Firefox",
"ua" : "Mozilla/5.0 (Windows NT x.y; rv:10.0) Gecko/20100101 Firefox/10.0",
Expand Down

0 comments on commit 84b41f5

Please sign in to comment.