-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
63 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
export const DEFAULT_BLOCKED_UA_STRS = [ | ||
'ahrefsbot', | ||
'applebot', | ||
'baiduspider', | ||
'bingbot', | ||
'bingpreview', | ||
'bot.htm', | ||
'bot.php', | ||
'crawler', | ||
'duckduckbot', | ||
'facebookexternal', | ||
'facebookcatalog', | ||
'gptbot', | ||
'hubspot', | ||
'linkedinbot', | ||
'mj12bot', | ||
'petalbot', | ||
'pinterest', | ||
'prerender', | ||
'rogerbot', | ||
'screaming frog', | ||
'semrushbot', | ||
'sitebulb', | ||
'twitterbot', | ||
'yahoo! slurp', | ||
'yandexbot', | ||
|
||
// a whole bunch of goog-specific crawlers | ||
// https://developers.google.com/search/docs/advanced/crawling/overview-google-crawlers | ||
'adsbot-google', | ||
'apis-google', | ||
'duplexweb-google', | ||
'feedfetcher-google', | ||
'google favicon', | ||
'google web preview', | ||
'google-read-aloud', | ||
'googlebot', | ||
'googleweblight', | ||
'mediapartners-google', | ||
'storebot-google', | ||
] | ||
|
||
// _.isBlockedUA() | ||
// This is to block various web spiders from executing our JS and | ||
// sending false capturing data | ||
export const _isBlockedUA = function (ua: string, customBlockedUserAgents: string[]): boolean { | ||
if (!ua) { | ||
return false | ||
} | ||
const uaLower = ua.toLowerCase() | ||
return DEFAULT_BLOCKED_UA_STRS.concat(customBlockedUserAgents || []).some((blockedUA) => { | ||
const blockedUaLower = blockedUA.toLowerCase() | ||
if (uaLower.includes) { | ||
return uaLower.includes(blockedUaLower) | ||
} else { | ||
// IE 11 :/ | ||
return uaLower.indexOf(blockedUaLower) !== -1 | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -363,67 +363,6 @@ export const _utf8Encode = function (string: string): string { | |
return utftext | ||
} | ||
|
||
export const DEFAULT_BLOCKED_UA_STRS = [ | ||
'ahrefsbot', | ||
'applebot', | ||
'baiduspider', | ||
'bingbot', | ||
'bingpreview', | ||
'bot.htm', | ||
'bot.php', | ||
'crawler', | ||
'duckduckbot', | ||
'facebookexternal', | ||
'facebookcatalog', | ||
'gptbot', | ||
'hubspot', | ||
'linkedinbot', | ||
'mj12bot', | ||
'petalbot', | ||
'pinterest', | ||
'prerender', | ||
'rogerbot', | ||
'screaming frog', | ||
'semrushbot', | ||
'sitebulb', | ||
'twitterbot', | ||
'yahoo! slurp', | ||
'yandexbot', | ||
|
||
// a whole bunch of goog-specific crawlers | ||
// https://developers.google.com/search/docs/advanced/crawling/overview-google-crawlers | ||
'adsbot-google', | ||
'apis-google', | ||
'duplexweb-google', | ||
'feedfetcher-google', | ||
'google favicon', | ||
'google web preview', | ||
'google-read-aloud', | ||
'googlebot', | ||
'googleweblight', | ||
'mediapartners-google', | ||
'storebot-google', | ||
] | ||
|
||
// _.isBlockedUA() | ||
// This is to block various web spiders from executing our JS and | ||
// sending false capturing data | ||
export const _isBlockedUA = function (ua: string, customBlockedUserAgents: string[]): boolean { | ||
if (!ua) { | ||
return false | ||
} | ||
const uaLower = ua.toLowerCase() | ||
return DEFAULT_BLOCKED_UA_STRS.concat(customBlockedUserAgents || []).some((blockedUA) => { | ||
const blockedUaLower = blockedUA.toLowerCase() | ||
if (uaLower.includes) { | ||
return uaLower.includes(blockedUaLower) | ||
} else { | ||
// IE 11 :/ | ||
return uaLower.indexOf(blockedUaLower) !== -1 | ||
} | ||
}) | ||
} | ||
|
||
export const _register_event = (function () { | ||
// written by Dean Edwards, 2005 | ||
// with input from Tino Zijdel - [email protected] | ||
|