]> git.mxchange.org Git - friendica-addons.git/blobdiff - blockbot/blockbot.php
Split and delete `ModuleController`
[friendica-addons.git] / blockbot / blockbot.php
index 0feb8d5cc43c881de922377055ab845d59e093ec..0ff372c502862a3b8f1a4093f5f99cf9acaf2f40 100644 (file)
@@ -15,6 +15,7 @@ use Friendica\DI;
 use Jaybizzle\CrawlerDetect\CrawlerDetect;
 use Friendica\Core\Logger;
 use Friendica\Core\Renderer;
+use Friendica\Network\HTTPException\ForbiddenException;
 
 require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
 
@@ -73,7 +74,8 @@ function blockbot_init_1(App $a) {
                'SummalyBot/', 'DNSResearchBot/', 'PetalBot;', 'Nmap Scripting Engine;',
                'Google-Apps-Script; beanserver;', 'woorankreview/', 'Seekport Crawler;', 'AHC/',
                'SkypeUriPreview Preview/', 'Semanticbot/', 'Embed PHP library', 'XoviOnpageCrawler;',
-               'GetHPinfo.com-Bot/', 'BoardReader Favicon Fetcher'];
+               'GetHPinfo.com-Bot/', 'BoardReader Favicon Fetcher', 'Google-Adwords-Instant', 'newspaper/',
+               'YurichevBot/', 'Crawling at Home Project'];
 
        if (!DI::config()->get('blockbot', 'good_crawlers')) {
                $agents = array_merge($agents, $good_agents);
@@ -91,7 +93,7 @@ function blockbot_init_1(App $a) {
 
        foreach ($agents as $agent) {
                if (stristr($_SERVER['HTTP_USER_AGENT'], $agent)) {
-                       System::httpExit(403, 'Bots are not allowed');
+                       throw new ForbiddenException('Bots are not allowed');
                }
        }
 
@@ -114,7 +116,8 @@ function blockbot_init_1(App $a) {
                'WordPress/', 'http.rb/', 'Apache-HttpClient/', 'WordPress.com;', 'Pleroma',
                'Dispatch/', 'Ruby', 'Java/', 'libwww-perl/', 'Mastodon/', 'FeedlyApp/',
                'lua-resty-http/', 'Tiny Tiny RSS/', 'Wget/', 'PostmanRuntime/',
-               'W3C_Validator/', 'NetNewsWire', 'FeedValidator/', 'theoldreader.com', 'axios/'];
+               'W3C_Validator/', 'NetNewsWire', 'FeedValidator/', 'theoldreader.com', 'axios/',
+               'Paw/', 'PeerTube/', 'fedi.inex.dev', 'FediDB/', 'index.community crawler'];
 
        if (DI::config()->get('blockbot', 'good_crawlers')) {
                $agents = array_merge($agents, $good_agents);
@@ -128,5 +131,5 @@ function blockbot_init_1(App $a) {
        }
 
        logger::info('Blocked bot', $logdata);
-       System::httpExit(403, 'Bots are not allowed');
+       throw new ForbiddenException('Bots are not allowed');
 }