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

Support Sogou Browser and Some Search Bots

This commit is contained in:
Cattttttttt 2021-01-21 21:03:00 +08:00
parent f2c3d789f1
commit 107c9c7411
2 changed files with 16 additions and 16 deletions

View File

@ -66,7 +66,7 @@ const browsersList = [
const hash = { const hash = {
bingbot: 'Bingbot', bingbot: 'Bingbot',
bingpreview: 'BingPreviewbot', bingpreview: 'BingPreviewbot',
adidxbot: 'BingAdsbot' adidxbot: 'BingAdsbot',
}; };
const browser = { const browser = {
name: hash[ua.match(/bingbot|bingpreview|adidxbot/i)[0].toLowerCase()], name: hash[ua.match(/bingbot|bingpreview|adidxbot/i)[0].toLowerCase()],
@ -150,21 +150,21 @@ const browsersList = [
const browser = { const browser = {
name: (/SogouMobileBrowser/i).test(ua) ? 'Sogou Mobile Browser' : 'Sogou Browser', name: (/SogouMobileBrowser/i).test(ua) ? 'Sogou Mobile Browser' : 'Sogou Browser',
}; };
const version = browser.name === 'Sogou Browser' ? const version = browser.name === 'Sogou Browser'
Utils.getFirstMatch(/Chrome[\s/](\d+)/i, ua) : ? Utils.getFirstMatch(/Chrome[\s/](\d+)/i, ua)
Utils.getFirstMatch(/SogouMobileBrowser[\s/](\d+(?:\.\d+)+)/i, ua); : Utils.getFirstMatch(/SogouMobileBrowser[\s/](\d+(?:\.\d+)+)/i, ua);
const hash = { const hash = {
'35': '5.1', 35: '5.1',
'38': '5.3', 38: '5.3',
'49': '6.3', 49: '6.3',
'58': '7.5', 58: '7.5',
'65': '8.6', 65: '8.6',
'72': '10.0', 72: '10.0',
'80': '11.0', 80: '11.0',
}; };
if (version) { if (version) {
browser.version = hash[version] || version; browser.version = hash[version] || (browser.name !== 'Sogou Browser' && version);
} }
return browser; return browser;