1
0
mirror of https://github.com/lancedikson/bowser synced 2026-03-02 03:40:27 +00:00

Added support for Googlebot recognition

This commit is contained in:
Robert Sandell
2019-01-16 13:30:38 +02:00
parent 1085ae62ad
commit 1535c62b74
3 changed files with 58 additions and 18 deletions

View File

@@ -31,6 +31,23 @@ import {
const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i;
const browsersList = [
/* Googlebot */
{
test: [/googlebot/i],
describe(ua) {
const browser = {
name: 'Googlebot',
};
const version = getFirstMatch(/googlebot\/(\d+(\.\d+))/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* Opera < 13.0 */
{
test: [/opera/i],
@@ -555,23 +572,6 @@ const browsersList = [
},
},
/* Googlebot */
{
test: [/googlebot/i],
describe(ua) {
const browser = {
name: 'Googlebot',
};
const version = getFirstMatch(/googlebot\/(\d+(\.\d+))/i, ua) || getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
}
return browser;
},
},
/* Something else */
{
test: [/.*/i],

View File

@@ -12,6 +12,17 @@ const TYPES_LABELS = {
*/
export default [
/* Googlebot */
{
test: [/googlebot/i],
describe() {
return {
type: 'bot',
vendor: 'Google',
};
},
},
/* Huawei */
{
test: [/huawei/i],