Browse Source

Update BeagleService, disable discovery if AP is disabled

Daniel Supernault 10 months ago
parent
commit
6cd1cbb41a
1 changed files with 8 additions and 0 deletions
  1. 8 0
      app/Services/Internal/BeagleService.php

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