From de4ce3c83f9691219eb72a91fb407db282c0c25e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 5 Oct 2024 23:09:33 -0600 Subject: [PATCH] Update config, allow Beagle discover service to be disabled --- app/Services/Internal/BeagleService.php | 8 ++++++++ config/instance.php | 1 + 2 files changed, 9 insertions(+) diff --git a/app/Services/Internal/BeagleService.php b/app/Services/Internal/BeagleService.php index 2dcc32a4c..0f284e93c 100644 --- a/app/Services/Internal/BeagleService.php +++ b/app/Services/Internal/BeagleService.php @@ -55,6 +55,10 @@ class BeagleService return []; } + if ((bool) config('instance.discover.beagle_api') == false) { + return []; + } + return Cache::remember(self::DISCOVER_CACHE_KEY, now()->addHours(6), function () { try { $res = Http::withOptions(['allow_redirects' => false]) @@ -92,6 +96,10 @@ class BeagleService return []; } + if ((bool) config('instance.discover.beagle_api') == false) { + return []; + } + return Cache::remember(self::DISCOVER_POSTS_CACHE_KEY, now()->addHours(1), function () { $posts = collect(self::getDiscover()) ->filter(function ($post) { diff --git a/config/instance.php b/config/instance.php index 3538fbf6d..18d887873 100644 --- a/config/instance.php +++ b/config/instance.php @@ -18,6 +18,7 @@ return [ 'tags' => [ 'is_public' => env('INSTANCE_PUBLIC_HASHTAGS', false), ], + 'beagle_api' => env('PF_INSTANCE_USE_BEAGLE_API', true), ], 'email' => env('INSTANCE_CONTACT_EMAIL'),