mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-17 20:11:27 +00:00
Check for oauth keys from the config, as well as from disk
This commit is contained in:
parent
520dd93ca2
commit
9db038e4bb
3 changed files with 8 additions and 3 deletions
|
@ -67,7 +67,9 @@ trait AdminDirectoryController
|
||||||
$res['community_guidelines'] = config_cache('app.rules') ? json_decode(config_cache('app.rules'), true) : [];
|
$res['community_guidelines'] = config_cache('app.rules') ? json_decode(config_cache('app.rules'), true) : [];
|
||||||
$res['curated_onboarding'] = (bool) config_cache('instance.curated_registration.enabled');
|
$res['curated_onboarding'] = (bool) config_cache('instance.curated_registration.enabled');
|
||||||
$res['open_registration'] = (bool) config_cache('pixelfed.open_registration');
|
$res['open_registration'] = (bool) config_cache('pixelfed.open_registration');
|
||||||
$res['oauth_enabled'] = (bool) config_cache('pixelfed.oauth_enabled') && file_exists(storage_path('oauth-public.key')) && file_exists(storage_path('oauth-private.key'));
|
$res['oauth_enabled'] = (bool) config_cache('pixelfed.oauth_enabled') &&
|
||||||
|
(file_exists(storage_path('oauth-public.key')) || config_cache('passport.public_key')) &&
|
||||||
|
(file_exists(storage_path('oauth-private.key')) || config_cache('passport.private_key'));
|
||||||
|
|
||||||
$res['activitypub_enabled'] = (bool) config_cache('federation.activitypub.enabled');
|
$res['activitypub_enabled'] = (bool) config_cache('federation.activitypub.enabled');
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,9 @@ trait AdminSettingsController
|
||||||
if ($key == 'mobile_apis' &&
|
if ($key == 'mobile_apis' &&
|
||||||
$active &&
|
$active &&
|
||||||
! file_exists(storage_path('oauth-public.key')) &&
|
! file_exists(storage_path('oauth-public.key')) &&
|
||||||
! file_exists(storage_path('oauth-private.key'))
|
! config_cache('passport.public_key') &&
|
||||||
|
! file_exists(storage_path('oauth-private.key')) &&
|
||||||
|
! config_cache('passport.private_key')
|
||||||
) {
|
) {
|
||||||
Artisan::call('passport:keys');
|
Artisan::call('passport:keys');
|
||||||
Artisan::call('route:cache');
|
Artisan::call('route:cache');
|
||||||
|
|
|
@ -90,7 +90,8 @@ class PixelfedDirectoryController extends Controller
|
||||||
|
|
||||||
$oauthEnabled = ConfigCache::whereK('pixelfed.oauth_enabled')->first();
|
$oauthEnabled = ConfigCache::whereK('pixelfed.oauth_enabled')->first();
|
||||||
if ($oauthEnabled) {
|
if ($oauthEnabled) {
|
||||||
$keys = file_exists(storage_path('oauth-public.key')) && file_exists(storage_path('oauth-private.key'));
|
$keys = (file_exists(storage_path('oauth-public.key')) || config_cache('passport.public_key')) &&
|
||||||
|
(file_exists(storage_path('oauth-private.key')) || config_cache('passport.private_key'));
|
||||||
$res['oauth_enabled'] = (bool) $oauthEnabled && $keys;
|
$res['oauth_enabled'] = (bool) $oauthEnabled && $keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue