1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

Merge pull request #310 from ricardorauber/master

Update the regexp for generic browsers
This commit is contained in:
Denis Demchenko 2019-04-24 21:28:27 +03:00 committed by GitHub
commit e1a37ef4fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View File

@ -606,9 +606,17 @@ const browsersList = [
{ {
test: [/.*/i], test: [/.*/i],
describe(ua) { describe(ua) {
/* Here we try to make sure that there are explicit details about the device
* in order to decide what regexp exactly we want to apply
* (as there is a specific decision based on that conclusion)
*/
const regexpWithoutDeviceSpec = /^(.*)\/(.*) /;
const regexpWithDeviceSpec = /^(.*)\/(.*)[ \t]\((.*)/;
const hasDeviceSpec = ua.search('\\(') !== -1;
const regexp = hasDeviceSpec ? regexpWithDeviceSpec : regexpWithoutDeviceSpec;
return { return {
name: Utils.getFirstMatch(/^(.*)\/(.*) /, ua), name: Utils.getFirstMatch(regexp, ua),
version: Utils.getSecondMatch(/^(.*)\/(.*) /, ua), version: Utils.getSecondMatch(regexp, ua),
}; };
}, },
}, },

View File

@ -2269,6 +2269,19 @@
os: {} os: {}
platform: {} platform: {}
engine: {} engine: {}
-
ua: "Generic/2.15 (Macintosh; Intel Mac OS X 10_6_8)"
spec:
browser:
name: "Generic"
version: "2.15"
os:
name: "macOS"
version: "10.6.8"
platform:
type: "desktop"
vendor: "Apple"
engine: {}
Googlebot: Googlebot:
- -
ua: "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" ua: "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"