Explorar el Código

Update config, allow Beagle discover service to be disabled

Daniel Supernault hace 9 meses
padre
commit
de4ce3c83f
Se han modificado 2 ficheros con 9 adiciones y 0 borrados
  1. 8 0
      app/Services/Internal/BeagleService.php
  2. 1 0
      config/instance.php

+ 8 - 0
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) {

+ 1 - 0
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'),