From 2803861083b52ce795dbd757fa4b3a1f02b9db0b Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 29 Jul 2024 01:36:18 -0600 Subject: [PATCH] Update ApiV1Dot1Controller.php --- app/Http/Controllers/Api/ApiV1Dot1Controller.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/app/Http/Controllers/Api/ApiV1Dot1Controller.php b/app/Http/Controllers/Api/ApiV1Dot1Controller.php index a087ada9c..6533b78e1 100644 --- a/app/Http/Controllers/Api/ApiV1Dot1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Dot1Controller.php @@ -1128,15 +1128,6 @@ class ApiV1Dot1Controller extends Controller } $user = $request->user(); - $limitKey = 'compose:rate-limit:media-upload:'.$user->id; - $limitTtl = now()->addMinutes(15); - $limitReached = Cache::remember($limitKey, $limitTtl, function () use ($user) { - $dailyLimit = Media::whereUserId($user->id)->where('created_at', '>', now()->subDays(1))->count(); - - return $dailyLimit >= 1250; - }); - abort_if($limitReached == true, 429); - if ($user->has_roles) { abort_if(! UserRoleService::can('can-post', $user->id), 403, 'Invalid permissions for this action'); } @@ -1152,9 +1143,7 @@ class ApiV1Dot1Controller extends Controller abort(403, 'Account size limit reached.'); } } - - abort_if($limitReached == true, 429); - + $limitKey = 'compose:rate-limit:media-upload:'.$user->id; $photo = $request->file('file'); $mimes = explode(',', config_cache('pixelfed.media_types'));