From 6cd1cbb41a92b2f387c16f3f5844cf308857f4ab Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 18 Aug 2024 01:59:24 -0600 Subject: [PATCH] Update BeagleService, disable discovery if AP is disabled --- app/Services/Internal/BeagleService.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Services/Internal/BeagleService.php b/app/Services/Internal/BeagleService.php index 3c8fcf104..2dcc32a4c 100644 --- a/app/Services/Internal/BeagleService.php +++ b/app/Services/Internal/BeagleService.php @@ -51,6 +51,10 @@ class BeagleService public static function getDiscover() { + if ((bool) config_cache('federation.activitypub.enabled') == false) { + return []; + } + return Cache::remember(self::DISCOVER_CACHE_KEY, now()->addHours(6), function () { try { $res = Http::withOptions(['allow_redirects' => false]) @@ -84,6 +88,10 @@ class BeagleService public static function getDiscoverPosts() { + if ((bool) config_cache('federation.activitypub.enabled') == false) { + return []; + } + return Cache::remember(self::DISCOVER_POSTS_CACHE_KEY, now()->addHours(1), function () { $posts = collect(self::getDiscover()) ->filter(function ($post) {