1
0
Fork 0

Update nodeinfo

This commit is contained in:
Daniel Supernault 2022-04-05 22:12:13 -06:00
parent b424691110
commit 3ef850fe59
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
2 changed files with 10 additions and 5 deletions

View File

@ -7,10 +7,10 @@ use Illuminate\Support\Str;
class Config { class Config {
const CACHE_KEY = 'api:site:configuration:_v0.5'; const CACHE_KEY = 'api:site:configuration:_v0.6';
public static function get() { public static function get() {
return Cache::remember(self::CACHE_KEY, 86400, function() { return Cache::remember(self::CACHE_KEY, 900, function() {
return [ return [
'open_registration' => (bool) config_cache('pixelfed.open_registration'), 'open_registration' => (bool) config_cache('pixelfed.open_registration'),
'uploader' => [ 'uploader' => [
@ -51,12 +51,15 @@ class Config {
], ],
'features' => [ 'features' => [
'timelines' => [
'local' => true,
'network' => (bool) config('federation.network_timeline'),
],
'mobile_apis' => (bool) config_cache('pixelfed.oauth_enabled'), 'mobile_apis' => (bool) config_cache('pixelfed.oauth_enabled'),
'circles' => false,
'stories' => (bool) config_cache('instance.stories.enabled'), 'stories' => (bool) config_cache('instance.stories.enabled'),
'video' => Str::contains(config_cache('pixelfed.media_types'), 'video/mp4'), 'video' => Str::contains(config_cache('pixelfed.media_types'), 'video/mp4'),
'import' => [ 'import' => [
'instagram' => config_cache('pixelfed.import.instagram.enabled'), 'instagram' => (bool) config_cache('pixelfed.import.instagram.enabled'),
'mastodon' => false, 'mastodon' => false,
'pixelfed' => false 'pixelfed' => false
], ],

View File

@ -33,6 +33,8 @@ class Nodeinfo {
return Status::whereLocal(true)->count(); return Status::whereLocal(true)->count();
}); });
$features = [ 'features' => \App\Util\Site\Config::get()['features'] ];
return [ return [
'metadata' => [ 'metadata' => [
'nodeName' => config_cache('app.name'), 'nodeName' => config_cache('app.name'),
@ -40,7 +42,7 @@ class Nodeinfo {
'homepage' => 'https://pixelfed.org', 'homepage' => 'https://pixelfed.org',
'repo' => 'https://github.com/pixelfed/pixelfed', 'repo' => 'https://github.com/pixelfed/pixelfed',
], ],
'config' => \App\Util\Site\Config::get() 'config' => $features
], ],
'protocols' => [ 'protocols' => [
'activitypub', 'activitypub',