Update BeagleService, disable discovery if AP is disabled

This commit is contained in:
Daniel Supernault 2024-08-18 01:59:24 -06:00
parent 0f751fc1eb
commit 6cd1cbb41a
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -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) {