1
0
Fork 0

Update BaseApiController

This commit is contained in:
Daniel Supernault 2019-09-05 23:09:17 -06:00
parent 97ff17f71f
commit aff20f62cd
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 3 additions and 7 deletions

View File

@ -213,19 +213,15 @@ class BaseApiController extends Controller
$profile = $user->profile;
if(config('pixelfed.enforce_account_limit') == true) {
$size = Media::whereUserId($user->id)->sum('size') / 1000;
$size = Cache::remember($user->storageUsedKey(), now()->addDays(3), function() use($user) {
return Media::whereUserId($user->id)->sum('size') / 1000;
});
$limit = (int) config('pixelfed.max_account_size');
if ($size >= $limit) {
abort(403, 'Account size limit reached.');
}
}
$recent = Media::whereProfileId($profile->id)->whereNull('status_id')->count();
if($recent > 50) {
abort(403);
}
$monthHash = hash('sha1', date('Y').date('m'));
$userHash = hash('sha1', $user->id . (string) $user->created_at);