4 * Description: Blocking bots based on detecting bots/crawlers/spiders via the user agent and http_from header.
6 * Author: Philipp Holzer <admin@philipp.info>
11 use Friendica\Core\Hook;
12 use Friendica\Core\System;
13 use Jaybizzle\CrawlerDetect\CrawlerDetect;
15 function botdetection_install() {
16 Hook::register('init_1', 'addon/botdetection/botdetection.php', 'botdetection_init_1');
20 function botdetection_uninstall() {
21 Hook::unregister('init_1', 'addon/botdetection/botdetection.php', 'botdetection_init_1');
24 function botdetection_init_1(App $a) {
25 $crawlerDetect = new CrawlerDetect();
27 if ($crawlerDetect->isCrawler()) {
28 System::httpExit(404, 'Bots are not allowed');