mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 09:43:16 +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;
|
$profile = $user->profile;
|
||||||
|
|
||||||
if(config('pixelfed.enforce_account_limit') == true) {
|
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');
|
$limit = (int) config('pixelfed.max_account_size');
|
||||||
if ($size >= $limit) {
|
if ($size >= $limit) {
|
||||||
abort(403, 'Account size limit reached.');
|
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'));
|
$monthHash = hash('sha1', date('Y').date('m'));
|
||||||
$userHash = hash('sha1', $user->id . (string) $user->created_at);
|
$userHash = hash('sha1', $user->id . (string) $user->created_at);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue