Update AdminSettings, add max_account_size support

This commit is contained in:
Daniel Supernault 2024-03-18 06:09:36 -06:00
parent ec2fdd61f7
commit 2dcbc1d5ef
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1
2 changed files with 6 additions and 3 deletions

View file

@ -739,6 +739,7 @@ trait AdminSettingsController
$this->validate($request, [
'require_email_verification' => 'required',
'enforce_account_limit' => 'required',
'max_account_size' => 'required|integer|min:50000',
'admin_autofollow' => 'required',
'admin_autofollow_accounts' => 'sometimes',
'max_user_blocks' => 'required',
@ -779,6 +780,7 @@ trait AdminSettingsController
ConfigCacheService::put('pixelfed.enforce_email_verification', $request->boolean('require_email_verification'));
ConfigCacheService::put('pixelfed.enforce_account_limit', $request->boolean('enforce_account_limit'));
ConfigCacheService::put('pixelfed.max_account_size', $request->input('max_account_size'));
ConfigCacheService::put('account.autofollow', $request->boolean('admin_autofollow'));
ConfigCacheService::put('instance.user_filters.max_user_blocks', (int) $request->input('max_user_blocks'));
ConfigCacheService::put('instance.user_filters.max_user_mutes', (int) $request->input('max_user_mutes'));

View file

@ -928,16 +928,16 @@
return '0.00 MB';
}
const mb = (this.users.max_account_size / 1000);
const mb = (this.users.max_account_size / 1024);
if(mb > 1000000) {
return (mb / 1000000).toFixed(1) + 'TB';
}
if(mb > 1000) {
return (mb / 1000).toFixed(2) + 'GB';
return (mb / 1024).toFixed(2) + 'GB';
}
return (this.users.max_account_size / 1000).toFixed(2) + ' MB';
return (this.users.max_account_size / 1024).toFixed(2) + ' MB';
}
},
@ -1388,6 +1388,7 @@
axios.post('/i/admin/api/settings/update/users', {
require_email_verification: this.users.require_email_verification,
enforce_account_limit: this.users.enforce_account_limit,
max_account_size: this.users.max_account_size,
admin_autofollow: this.users.admin_autofollow,
admin_autofollow_accounts: this.users.admin_autofollow_accounts,
max_user_blocks: this.users.max_user_blocks,