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:
commit
e1a37ef4fa
@ -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),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -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)"
|
||||||
|
Loading…
Reference in New Issue
Block a user