Compare commits

...

10 Commits

Author SHA1 Message Date
Faisal Salman
67005e3494 Update patch version to 1.0.33 as a mirror of 0.7.33 2023-01-22 22:31:03 +07:00
Faisal Salman
f2d0db001d Bump version 0.7.33 2023-01-22 22:26:12 +07:00
Faisal Salman
a6140a17dd Remove unsafe regex in trim() function
`trim()` function contains a regular expression that is vulnerable to ReDoS but was uncaught by `safe-regex` module.
2023-01-22 22:19:45 +07:00
Faisal Salman
a886604935 Fix #605 - Identify Macintosh as Apple device 2022-12-06 09:53:54 +07:00
Faisal Salman
b814bcd791 Merge pull request #606 from rileyjshaw/patch-1
Fix documentation
2022-12-06 09:36:29 +07:00
Riley Shaw
7f71024161 Fix documentation
`readme.md` refers to a `parser.getResults` function, which does not exist. This PR corrects the function name to `getResult`.
2022-10-26 13:17:33 -04:00
Faisal Salman
c239ac5167 Merge pull request #604 from obecerra3/master
Add new browser: Cobalt
2022-10-23 17:36:19 +07:00
Oscar Becerra
8d3c2d327c Add new browser: Cobalt 2022-10-17 14:03:53 -07:00
Faisal Salman
a2b2e805fa Update patch version to 1.0.32 as a mirror of 0.7.32 2022-10-15 16:27:20 +07:00
Faisal Salman
1bf1c732c7 Bump version 1.0.2 2021-10-27 14:09:19 +07:00
9 changed files with 63 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "0.7.32", "version": "1.0.33",
"authors": [ "authors": [
"Faisal Salman <f@faisalman.com>" "Faisal Salman <f@faisalman.com>"
], ],

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
Package.describe({ Package.describe({
name: 'faisalman:ua-parser-js', name: 'faisalman:ua-parser-js',
version: '0.7.32', version: '1.0.33',
summary: 'Lightweight JavaScript-based user-agent string parser', summary: 'Lightweight JavaScript-based user-agent string parser',
git: 'https://github.com/faisalman/ua-parser-js.git', git: 'https://github.com/faisalman/ua-parser-js.git',
documentation: 'readme.md' documentation: 'readme.md'

View File

@@ -1,7 +1,7 @@
{ {
"title": "UAParser.js", "title": "UAParser.js",
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "0.7.32", "version": "1.0.33",
"author": "Faisal Salman <f@faisalman.com> (http://faisalman.com)", "author": "Faisal Salman <f@faisalman.com> (http://faisalman.com)",
"description": "Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data. Supports browser & node.js environment", "description": "Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data. Supports browser & node.js environment",
"keywords": [ "keywords": [

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

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
/* UAParser.js v0.7.32 /* UAParser.js v1.0.33
Copyright © 2012-2021 Faisal Salman <f@faisalman.com> Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
MIT License *//* MIT License *//*
Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data. Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
@@ -17,7 +17,7 @@
///////////// /////////////
var LIBVERSION = '0.7.32', var LIBVERSION = '1.0.33',
EMPTY = '', EMPTY = '',
UNKNOWN = '?', UNKNOWN = '?',
FUNC_TYPE = 'function', FUNC_TYPE = 'function',
@@ -93,7 +93,7 @@
}, },
trim = function (str, len) { trim = function (str, len) {
if (typeof(str) === STR_TYPE) { if (typeof(str) === STR_TYPE) {
str = str.replace(/^\s\s*/, EMPTY).replace(/\s\s*$/, EMPTY); str = str.replace(/^\s\s*/, EMPTY);
return typeof(len) === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH); return typeof(len) === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);
} }
}; };
@@ -330,7 +330,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 : [[
@@ -387,6 +390,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

@@ -1591,5 +1591,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",