mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Update BaseApiController
This commit is contained in:
parent
97ff17f71f
commit
aff20f62cd
1 changed files with 3 additions and 7 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue