Merge branch 'faisalman:master' into smarttv

This commit is contained in:
Garrit Franke 2022-12-09 13:39:49 +01:00 committed by GitHub
commit 2033eb4aba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 3 deletions

View File

@ -36,7 +36,7 @@ Like so:
```js ```js
let parser = new UAParser("user-agent"); // you need to pass the user-agent for nodejs let parser = new UAParser("user-agent"); // you need to pass the user-agent for nodejs
console.log(parser); // {} console.log(parser); // {}
let parserResults = parser.getResults(); let parserResults = parser.getResult();
console.log(parserResults); console.log(parserResults);
/** { /** {
"ua": "", "ua": "",
@ -48,7 +48,7 @@ console.log(parserResults);
} */ } */
``` ```
When you call UAParser without the `new` keyword, it will automatically call `getResults()` function and return the parsed results. When you call UAParser without the `new` keyword, it will automatically call `getResult()` function and return the parsed results.
* `UAParser([uastring][,extensions])` * `UAParser([uastring][,extensions])`
* returns result object `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }` * returns result object `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`

View File

@ -336,7 +336,10 @@
/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i, /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,
// Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser
/(links) \(([\w\.]+)/i // Links /(links) \(([\w\.]+)/i // Links
], [NAME, VERSION] ], [NAME, VERSION], [
/(cobalt)\/([\w\.]+)/i // Cobalt
], [NAME, [VERSION, /master.|lts./, ""]]
], ],
cpu : [[ cpu : [[
@ -424,6 +427,8 @@
/applecoremedia\/[\w\.]+ \((ipad)/i, /applecoremedia\/[\w\.]+ \((ipad)/i,
/\b(ipad)\d\d?,\d\d?[;\]].+ios/i /\b(ipad)\d\d?,\d\d?[;\]].+ios/i
], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [ ], [MODEL, [VENDOR, APPLE], [TYPE, TABLET]], [
/(macintosh);/i
], [MODEL, [VENDOR, APPLE]], [
// Huawei // Huawei
/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i /\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i

View File

@ -1601,5 +1601,41 @@
"version" : "15.6,2", "version" : "15.6,2",
"major" : "15" "major" : "15"
} }
},
{
"desc" : "Cobalt 23 Master",
"ua" : "Mozilla/5.0 (X11; Linux x86_64) Cobalt/23.master.0.0-devel (unlike Gecko) v8/8.8.278.8-jit gles Starboard/15",
"expect" : {
"name" : "Cobalt",
"version": "23.0.0",
"major" : "23"
}
},
{
"desc" : "Cobalt 23 LTS",
"ua" : "Mozilla/5.0 (X11; Linux x86_64) Cobalt/23.lts.1.0-qa (unlike Gecko) v8/8.8.278.8-jit gles Starboard/15",
"expect" : {
"name" : "Cobalt",
"version": "23.1.0",
"major" : "23"
}
},
{
"desc" : "Cobalt 11",
"ua" : "Mozilla/5.0 (X11; Linux x86_64) Cobalt/11.0-qa (unlike Gecko) Starboard/6",
"expect" : {
"name" : "Cobalt",
"version": "11.0",
"major" : "11"
}
},
{
"desc" : "Cobalt 9",
"ua" : "Mozilla/5.0 (X11; Linux x86_64) Cobalt/9.0-qa (unlike Gecko) Starboard/4",
"expect" : {
"name" : "Cobalt",
"version": "9.0",
"major" : "9"
}
} }
] ]

View File

@ -754,6 +754,15 @@
"type": "mobile" "type": "mobile"
} }
}, },
{
"desc": "Apple Desktop",
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15",
"expect": {
"vendor": "Apple",
"model": "Macintosh",
"type": "undefined"
}
},
{ {
"desc": "iPad using UCBrowser", "desc": "iPad using UCBrowser",
"ua": "Mozilla/5.0 (iPad; U; CPU OS 11_2 like Mac OS X; zh-CN; iPad5,3) AppleWebKit/534.46 (KHTML, like Gecko) UCBrowser/3.0.1.776 U3/ Mobile/10A403 Safari/7543.48.3", "ua": "Mozilla/5.0 (iPad; U; CPU OS 11_2 like Mac OS X; zh-CN; iPad5,3) AppleWebKit/534.46 (KHTML, like Gecko) UCBrowser/3.0.1.776 U3/ Mobile/10A403 Safari/7543.48.3",