Update config() to config_cache()

This commit is contained in:
Daniel Supernault 2021-05-11 18:26:52 -06:00
parent 53134208fe
commit 3e52458889
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
6 changed files with 9 additions and 9 deletions

View file

@ -66,7 +66,7 @@ class ApiV1Controller extends Controller
public function apps(Request $request) public function apps(Request $request)
{ {
abort_if(!config('pixelfed.oauth_enabled'), 404); abort_if(!config_cache('pixelfed.oauth_enabled'), 404);
$this->validate($request, [ $this->validate($request, [
'client_name' => 'required', 'client_name' => 'required',
@ -984,7 +984,7 @@ class ApiV1Controller extends Controller
'max_caption_length' => (int) config('pixelfed.max_caption_length'), 'max_caption_length' => (int) config('pixelfed.max_caption_length'),
'max_bio_length' => (int) config('pixelfed.max_bio_length'), 'max_bio_length' => (int) config('pixelfed.max_bio_length'),
'max_album_length' => (int) config_cache('pixelfed.max_album_length'), 'max_album_length' => (int) config_cache('pixelfed.max_album_length'),
'mobile_apis' => config('pixelfed.oauth_enabled') 'mobile_apis' => config_cache('pixelfed.oauth_enabled')
] ]
]; ];

View file

@ -26,7 +26,7 @@ class AuthServiceProvider extends ServiceProvider
{ {
$this->registerPolicies(); $this->registerPolicies();
if(config('pixelfed.oauth_enabled')) { if(config_cache('pixelfed.oauth_enabled')) {
Passport::routes(null, ['middleware' => ['twofactor', \Fruitcake\Cors\HandleCors::class]]); Passport::routes(null, ['middleware' => ['twofactor', \Fruitcake\Cors\HandleCors::class]]);
Passport::tokensExpireIn(now()->addDays(config('instance.oauth.token_expiration', 15))); Passport::tokensExpireIn(now()->addDays(config('instance.oauth.token_expiration', 15)));
Passport::refreshTokensExpireIn(now()->addDays(config('instance.oauth.refresh_expiration', 30))); Passport::refreshTokensExpireIn(now()->addDays(config('instance.oauth.refresh_expiration', 30)));

View file

@ -54,7 +54,7 @@ class Config {
], ],
'features' => [ 'features' => [
'mobile_apis' => config('pixelfed.oauth_enabled'), 'mobile_apis' => config_cache('pixelfed.oauth_enabled'),
'circles' => false, 'circles' => false,
'stories' => config('instance.stories.enabled'), 'stories' => config('instance.stories.enabled'),
'video' => Str::contains(config_cache('pixelfed.media_types'), 'video/mp4'), 'video' => Str::contains(config_cache('pixelfed.media_types'), 'video/mp4'),

View file

@ -6,7 +6,7 @@
<h3 class="font-weight-bold">Applications</h3> <h3 class="font-weight-bold">Applications</h3>
</div> </div>
<hr> <hr>
@if(config('pixelfed.oauth_enabled') == true) @if(config_cache('pixelfed.oauth_enabled') == true)
<passport-authorized-clients></passport-authorized-clients> <passport-authorized-clients></passport-authorized-clients>
<passport-personal-access-tokens></passport-personal-access-tokens> <passport-personal-access-tokens></passport-personal-access-tokens>
@else @else
@ -16,4 +16,4 @@
@push('scripts') @push('scripts')
<script type="text/javascript" src="{{mix('js/developers.js')}}"></script> <script type="text/javascript" src="{{mix('js/developers.js')}}"></script>
@endpush @endpush

View file

@ -6,7 +6,7 @@
<h3 class="font-weight-bold">Developers</h3> <h3 class="font-weight-bold">Developers</h3>
</div> </div>
<hr> <hr>
@if(config('pixelfed.oauth_enabled') == true) @if(config_cache('pixelfed.oauth_enabled') == true)
<passport-clients></passport-clients> <passport-clients></passport-clients>
@else @else
<p class="lead">OAuth has not been enabled on this instance.</p> <p class="lead">OAuth has not been enabled on this instance.</p>
@ -16,4 +16,4 @@
@push('scripts') @push('scripts')
<script type="text/javascript" src="{{mix('js/developers.js')}}"></script> <script type="text/javascript" src="{{mix('js/developers.js')}}"></script>
@endpush @endpush

View file

@ -41,7 +41,7 @@
<a class="nav-link font-weight-light text-muted" href="{{route('settings.dataexport')}}">Data Export</a> <a class="nav-link font-weight-light text-muted" href="{{route('settings.dataexport')}}">Data Export</a>
</li> </li>
@if(config('pixelfed.oauth_enabled') == true) @if(config_cache('pixelfed.oauth_enabled') == true)
<li class="nav-item"> <li class="nav-item">
<hr> <hr>
</li> </li>