mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-18 04:21:27 +00:00
Update BeagleService, disable discovery if AP is disabled
This commit is contained in:
parent
0f751fc1eb
commit
6cd1cbb41a
1 changed files with 8 additions and 0 deletions
|
@ -51,6 +51,10 @@ class BeagleService
|
||||||
|
|
||||||
public static function getDiscover()
|
public static function getDiscover()
|
||||||
{
|
{
|
||||||
|
if ((bool) config_cache('federation.activitypub.enabled') == false) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
return Cache::remember(self::DISCOVER_CACHE_KEY, now()->addHours(6), function () {
|
return Cache::remember(self::DISCOVER_CACHE_KEY, now()->addHours(6), function () {
|
||||||
try {
|
try {
|
||||||
$res = Http::withOptions(['allow_redirects' => false])
|
$res = Http::withOptions(['allow_redirects' => false])
|
||||||
|
@ -84,6 +88,10 @@ class BeagleService
|
||||||
|
|
||||||
public static function getDiscoverPosts()
|
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 () {
|
return Cache::remember(self::DISCOVER_POSTS_CACHE_KEY, now()->addHours(1), function () {
|
||||||
$posts = collect(self::getDiscover())
|
$posts = collect(self::getDiscover())
|
||||||
->filter(function ($post) {
|
->filter(function ($post) {
|
||||||
|
|
Loading…
Reference in a new issue