From fbc10c177f9ec3f8bda56761a7179646d2630447 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Sat, 18 Jan 2020 15:41:18 +0100 Subject: [PATCH 1/4] CleanUp Cache namespace - Introduce enum "Duration" - Introduce enum "Type" - Move "Cache\Cache" to "BaseCache" --- openstreetmap/openstreetmap.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 6192b93f..5e608ed3 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -9,8 +9,8 @@ * */ +use Friendica\Core\Cache\Duration; use Friendica\DI; -use Friendica\Core\Cache\Cache; use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; @@ -137,7 +137,7 @@ function openstreetmap_get_coordinates($a, &$b) $curlResult = Network::curl($nomserver . $args); if ($curlResult->isSuccess()) { $j = json_decode($curlResult->getBody(), true); - DI::cache()->set($cachekey, $j, Cache::MONTH); + DI::cache()->set($cachekey, $j, Duration::MONTH); } } -- 2.45.3 From 665948b37e5d1844b95f5e365cedc43e4be445b2 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Sat, 18 Jan 2020 15:47:19 +0100 Subject: [PATCH 2/4] sort use --- openstreetmap/openstreetmap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 5e608ed3..e0287a81 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -9,8 +9,8 @@ * */ -use Friendica\Core\Cache\Duration; use Friendica\DI; +use Friendica\Core\Cache\Duration; use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; -- 2.45.3 From c3919e52d29345eedf5d18babd00da230f64ecdc Mon Sep 17 00:00:00 2001 From: valvin Date: Sat, 18 Jan 2020 13:47:20 +0100 Subject: [PATCH 3/4] feat(blockbot): ensure good agent are whitelisted and add uptimerobot --- blockbot/blockbot.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/blockbot/blockbot.php b/blockbot/blockbot.php index 2714e494..5f6d0cb0 100644 --- a/blockbot/blockbot.php +++ b/blockbot/blockbot.php @@ -55,7 +55,7 @@ function blockbot_init_1(App $a) { // List of "good" crawlers $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. $agents = ['SemrushBot', 's~feedly-nikon3', 'Qwantify/Bleriot/', 'ltx71', 'Sogou web spider/', @@ -80,6 +80,13 @@ function blockbot_init_1(App $a) { if (!Config::get('blockbot', 'good_crawlers')) { $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')) { $agents[] = 'GabSocial/'; -- 2.45.3 From e7f7868c88c48617b53d4bd70dc009684e4a264b Mon Sep 17 00:00:00 2001 From: valvin Date: Sat, 18 Jan 2020 23:28:14 +0100 Subject: [PATCH 4/4] fix(blockbot): indent code using psr12 --- blockbot/blockbot.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/blockbot/blockbot.php b/blockbot/blockbot.php index 5f6d0cb0..8a27f402 100644 --- a/blockbot/blockbot.php +++ b/blockbot/blockbot.php @@ -79,9 +79,8 @@ function blockbot_init_1(App $a) { if (!Config::get('blockbot', 'good_crawlers')) { $agents = array_merge($agents, $good_agents); - } - else{ - foreach($good_agents as $good_agent){ + } else { + foreach ($good_agents as $good_agent) { if (stristr($_SERVER['HTTP_USER_AGENT'], $good_agent)) { return; } -- 2.45.3