mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-02-23 06:30:49 +00:00
Update config() to config_cache()
This commit is contained in:
parent
c0e693cc73
commit
27b722e7a7
5 changed files with 158 additions and 158 deletions
|
@ -967,7 +967,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('pixelfed.open_registration'),
|
||||
'registrations' => config_cache('pixelfed.open_registration'),
|
||||
'stats' => [
|
||||
'user_count' => 0,
|
||||
'status_count' => 0,
|
||||
|
|
|
@ -154,7 +154,7 @@ class RegisterController extends Controller
|
|||
*/
|
||||
public function showRegistrationForm()
|
||||
{
|
||||
if(config('pixelfed.open_registration')) {
|
||||
if(config_cache('pixelfed.open_registration')) {
|
||||
$limit = config('pixelfed.max_users');
|
||||
if($limit) {
|
||||
abort_if($limit <= User::count(), 404);
|
||||
|
@ -175,12 +175,12 @@ class RegisterController extends Controller
|
|||
*/
|
||||
public function register(Request $request)
|
||||
{
|
||||
abort_if(config('pixelfed.open_registration') == false, 400);
|
||||
abort_if(config_cache('pixelfed.open_registration') == false, 400);
|
||||
|
||||
$count = User::count();
|
||||
$limit = config('pixelfed.max_users');
|
||||
|
||||
if(false == config('pixelfed.open_registration') || $limit && $limit <= $count) {
|
||||
if(false == config_cache('pixelfed.open_registration') || $limit && $limit <= $count) {
|
||||
return abort(403);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class Config {
|
|||
public static function get() {
|
||||
return Cache::remember('api:site:configuration:_v0.2', now()->addMinutes(5), function() {
|
||||
return [
|
||||
'open_registration' => config('pixelfed.open_registration'),
|
||||
'open_registration' => (bool) config_cache('pixelfed.open_registration'),
|
||||
'uploader' => [
|
||||
'max_photo_size' => config('pixelfed.max_photo_size'),
|
||||
'max_caption_length' => config('pixelfed.max_caption_length'),
|
||||
|
|
|
@ -70,7 +70,7 @@ class Nodeinfo {
|
|||
'version' => '2.0',
|
||||
];
|
||||
});
|
||||
$res['openRegistrations'] = config('pixelfed.open_registration');
|
||||
$res['openRegistrations'] = (bool) config_cache('pixelfed.open_registration');
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
{{ __('Login') }}
|
||||
</a>
|
||||
</li>
|
||||
@if(config('pixelfed.open_registration') && config('instance.restricted.enabled') == false)
|
||||
@if(config_cache('pixelfed.open_registration') && config('instance.restricted.enabled') == false)
|
||||
<li>
|
||||
<a class="ml-3 nav-link font-weight-bold text-dark" href="{{ route('register') }}" title="Register">
|
||||
{{ __('Register') }}
|
||||
|
|
Loading…
Reference in a new issue