Merge pull request #945 from valvin1/feat/blockbot_uptimerobot

feat(blockbot): ensure good agent are whitelisted and add uptimerobot
This commit is contained in:
Hypolite Petovan 2020-01-18 23:53:24 -05:00 committed by GitHub
commit 1eb23e3667
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,7 +55,7 @@ function blockbot_init_1(App $a) {
// List of "good" crawlers // List of "good" crawlers
$good_agents = ['fediverse.space crawler', 'fediverse.network crawler', 'Active_Pods_CheckBot_3.0', $good_agents = ['fediverse.space crawler', 'fediverse.network crawler', 'Active_Pods_CheckBot_3.0',
'Social-Relay/', 'Test Certificate Info', 'Uptimebot/', 'GNUSocialBot']; 'Social-Relay/', 'Test Certificate Info', 'Uptimebot/', 'GNUSocialBot', 'UptimeRobot/'];
// List of known crawlers. // List of known crawlers.
$agents = ['SemrushBot', 's~feedly-nikon3', 'Qwantify/Bleriot/', 'ltx71', 'Sogou web spider/', $agents = ['SemrushBot', 's~feedly-nikon3', 'Qwantify/Bleriot/', 'ltx71', 'Sogou web spider/',
@ -79,6 +79,12 @@ function blockbot_init_1(App $a) {
if (!Config::get('blockbot', 'good_crawlers')) { if (!Config::get('blockbot', 'good_crawlers')) {
$agents = array_merge($agents, $good_agents); $agents = array_merge($agents, $good_agents);
} else {
foreach ($good_agents as $good_agent) {
if (stristr($_SERVER['HTTP_USER_AGENT'], $good_agent)) {
return;
}
}
} }
if (Config::get('blockbot', 'block_gab')) { if (Config::get('blockbot', 'block_gab')) {