Update ApiV1Dot1Controller.php

This commit is contained in:
Daniel Supernault 2024-07-29 01:36:18 -06:00
parent b03f5cec8b
commit 2803861083
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -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'));