Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update and expand Chromecast device families #724

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions src/main/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
PREFIX_MOBILE = 'Mobile ',
SUFFIX_BROWSER = ' Browser',
CHROME = 'Chrome',
CHROMECAST = 'Chromecast',
EDGE = 'Edge',
FIREFOX = 'Firefox',
OPERA = 'Opera',
Expand Down Expand Up @@ -670,8 +671,14 @@
], [[VENDOR, LG], [TYPE, SMARTTV]], [
/(apple) ?tv/i // Apple TV
], [VENDOR, [MODEL, APPLE+' TV'], [TYPE, SMARTTV]], [
/crkey/i // Google Chromecast
], [[MODEL, CHROME+'cast'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
/crkey.*devicetype\/chromecast/i // Google Chromecast Third Generation
], [[MODEL, CHROMECAST+' Third Generation'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
/crkey.*devicetype\/([^/]*)/i // Google Chromecast with specific device type
], [[MODEL, /^/, 'Chromecast '], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
/fuchsia.*crkey/i // Google Chromecast Nest Hub
], [[MODEL, CHROMECAST+' Nest Hub'], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
/crkey/i // Google Chromecast, Linux-based or unknown
], [[MODEL, CHROMECAST], [VENDOR, GOOGLE], [TYPE, SMARTTV]], [
/droid.+aft(\w+)( bui|\))/i // Fire TV
], [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]], [
/\(dtv[\);].+(aquos)/i,
Expand Down Expand Up @@ -784,6 +791,18 @@
/(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS
], [[NAME, 'macOS'], [VERSION, /_/g, '.']], [

// Google Chromecast
/android ([\d\.]+).*crkey/i // Google Chromecast, Android-based
], [VERSION, [NAME, CHROMECAST + ' Android']], [
/fuchsia.*crkey\/([\d\.]+)/i // Google Chromecast, Fuchsia-based
], [VERSION, [NAME, CHROMECAST + ' Fuchsia']], [
/crkey\/([\d\.]+).*devicetype\/smartspeaker/i // Google Chromecast, Linux-based Smart Speaker
], [VERSION, [NAME, CHROMECAST + ' SmartSpeaker']], [
/linux.*crkey\/([\d\.]+)/i // Google Chromecast, Legacy Linux-based
], [VERSION, [NAME, CHROMECAST + ' Linux']], [
/crkey\/([\d\.]+)/i // Google Chromecast, unknown
], [VERSION, [NAME, CHROMECAST]], [

// Mobile OSes
/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS
], [VERSION, NAME], [ // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS
Expand All @@ -804,9 +823,7 @@
/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i // watchOS
], [VERSION, [NAME, 'watchOS']], [

// Google Chromecast
/crkey\/([\d\.]+)/i // Google Chromecast
], [VERSION, [NAME, CHROME+'cast']], [
// Google ChromeOS
/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i // Chromium OS
], [[NAME, "Chrome OS"], VERSION],[

Expand Down
36 changes: 36 additions & 0 deletions test/specs/device-all.json
Original file line number Diff line number Diff line change
Expand Up @@ -3023,6 +3023,42 @@
"type": "mobile"
}
},
{
"desc": "Google Chromecast with Google TV",
"ua": "Mozilla/5.0 (Linux; Android 12.0; Build/STTL.240206.002) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.0 Safari/537.36 CrKey/1.56.500000 DeviceType/AndroidTV",
"expect": {
"vendor": "Google",
"model": "Chromecast AndroidTV",
"type": "smarttv"
}
},
{
"desc": "Google Chromecast Mini Smart Speaker",
"ua": "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/SmartSpeaker",
"expect": {
"vendor": "Google",
"model": "Chromecast SmartSpeaker",
"type": "smarttv"
}
},
{
"desc": "Google Chromecast Third Generation",
"ua": "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/Chromecast",
"expect": {
"vendor": "Google",
"model": "Chromecast Third Generation",
"type": "smarttv"
}
},
{
"desc": "Google Chromecast Nest Hub",
"ua": "Mozilla/5.0 (Fuchsia) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 CrKey/1.56.500000",
"expect": {
"vendor": "Google",
"model": "Chromecast Nest Hub",
"type": "smarttv"
}
},
{
"desc": "Google Chromecast",
"ua": "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.84 Safari/537.36 CrKey/1.22.79313",
Expand Down
31 changes: 29 additions & 2 deletions test/specs/os-all.json
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,38 @@
}
},
{
"desc" : "Google Chromecast",
"desc" : "Google Chromecast with Google TV",
"ua" : "Mozilla/5.0 (Linux; Android 12.0; Build/STTL.240206.002) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.0 Safari/537.36 CrKey/1.56.500000 DeviceType/AndroidTV",
"expect" :
{
"name" : "Chromecast Android",
"version" : "12.0"
}
},
{
"desc" : "Google Chromecast Nest Hub",
"ua" : "Mozilla/5.0 (Fuchsia) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 CrKey/1.56.500000",
"expect" :
{
"name" : "Chromecast Fuchsia",
"version" : "1.56.500000"
}
},
{
"desc" : "Google Chromecast Mini Smart Speaker",
"ua" : "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/SmartSpeaker",
"expect" :
{
"name" : "Chromecast SmartSpeaker",
"version" : "1.56.500000"
}
},
{
"desc" : "Google Chromecast Legacy Linux-Based",
"ua" : "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.81 Safari/537.36 CrKey/1.42.183786",
"expect" :
{
"name" : "Chromecast",
"name" : "Chromecast Linux",
"version" : "1.42.183786"
}
},
Expand Down
Loading