From 955696b8a0f1867c748da72f9b4b7afd1f9c64ed Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 18 May 2021 17:53:59 -0600 Subject: [PATCH] Update site config, fix boolean casting --- app/Http/Controllers/Api/ApiV1Controller.php | 4 ++-- app/Util/Site/Config.php | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 8837e4f56..973f14d3e 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -977,7 +977,7 @@ class ApiV1Controller extends Controller 'short_description' => 'Pixelfed - Photo sharing for everyone', 'languages' => ['en'], 'max_toot_chars' => (int) config('pixelfed.max_caption_length'), - 'registrations' => config_cache('pixelfed.open_registration'), + 'registrations' => (bool) config_cache('pixelfed.open_registration'), 'stats' => [ 'user_count' => 0, 'status_count' => 0, @@ -994,7 +994,7 @@ class ApiV1Controller extends Controller 'max_caption_length' => (int) config('pixelfed.max_caption_length'), 'max_bio_length' => (int) config('pixelfed.max_bio_length'), 'max_album_length' => (int) config_cache('pixelfed.max_album_length'), - 'mobile_apis' => config_cache('pixelfed.oauth_enabled') + 'mobile_apis' => (bool) config_cache('pixelfed.oauth_enabled') ] ]; diff --git a/app/Util/Site/Config.php b/app/Util/Site/Config.php index d9836ca70..117696c59 100644 --- a/app/Util/Site/Config.php +++ b/app/Util/Site/Config.php @@ -8,7 +8,7 @@ use Illuminate\Support\Str; class Config { public static function get() { - return Cache::remember('api:site:configuration:_v0.2', now()->addMinutes(5), function() { + return Cache::remember('api:site:configuration:_v0.3', now()->addMinutes(5), function() { return [ 'open_registration' => (bool) config_cache('pixelfed.open_registration'), 'uploader' => [ @@ -19,15 +19,15 @@ class Config { 'max_collection_length' => config('pixelfed.max_collection_length', 18), - 'optimize_image' => config('pixelfed.optimize_image'), - 'optimize_video' => config('pixelfed.optimize_video'), + 'optimize_image' => (bool) config('pixelfed.optimize_image'), + 'optimize_video' => (bool) config('pixelfed.optimize_video'), 'media_types' => config_cache('pixelfed.media_types'), - 'enforce_account_limit' => config_cache('pixelfed.enforce_account_limit') + 'enforce_account_limit' => (bool) config_cache('pixelfed.enforce_account_limit') ], 'activitypub' => [ - 'enabled' => config_cache('federation.activitypub.enabled'), + 'enabled' => (bool) config_cache('federation.activitypub.enabled'), 'remote_follow' => config('federation.activitypub.remoteFollow') ], @@ -54,9 +54,9 @@ class Config { ], 'features' => [ - 'mobile_apis' => config_cache('pixelfed.oauth_enabled'), + 'mobile_apis' => (bool) config_cache('pixelfed.oauth_enabled'), 'circles' => false, - 'stories' => config_cache('instance.stories.enabled'), + 'stories' => (bool) config_cache('instance.stories.enabled'), 'video' => Str::contains(config_cache('pixelfed.media_types'), 'video/mp4'), 'import' => [ 'instagram' => config_cache('pixelfed.import.instagram.enabled'), @@ -65,7 +65,7 @@ class Config { ], 'label' => [ 'covid' => [ - 'enabled' => config('instance.label.covid.enabled'), + 'enabled' => (bool) config('instance.label.covid.enabled'), 'org' => config('instance.label.covid.org'), 'url' => config('instance.label.covid.url'), ]