mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
Add more rate limits
This commit is contained in:
parent
a94a3ee06a
commit
1f1df2d1c4
2 changed files with 28 additions and 3 deletions
|
@ -4,6 +4,11 @@ namespace App\Util\RateLimit;
|
||||||
|
|
||||||
trait User {
|
trait User {
|
||||||
|
|
||||||
|
public function isTrustedAccount()
|
||||||
|
{
|
||||||
|
return $this->created_at->lt(now()->subDays(20));
|
||||||
|
}
|
||||||
|
|
||||||
public function getMaxPostsPerHourAttribute()
|
public function getMaxPostsPerHourAttribute()
|
||||||
{
|
{
|
||||||
return 20;
|
return 20;
|
||||||
|
@ -23,4 +28,24 @@ trait User {
|
||||||
{
|
{
|
||||||
return 500;
|
return 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMaxLikesPerHourAttribute()
|
||||||
|
{
|
||||||
|
return 120;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMaxLikesPerDayAttribute()
|
||||||
|
{
|
||||||
|
return 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMaxSharesPerHourAttribute()
|
||||||
|
{
|
||||||
|
return 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMaxSharesPerDayAttribute()
|
||||||
|
{
|
||||||
|
return 500;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -105,7 +105,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
||||||
});
|
});
|
||||||
Route::group(['prefix' => 'local'], function () {
|
Route::group(['prefix' => 'local'], function () {
|
||||||
Route::get('i/follow-suggestions', 'ApiController@followSuggestions');
|
Route::get('i/follow-suggestions', 'ApiController@followSuggestions');
|
||||||
Route::post('status/compose', 'InternalApiController@compose');
|
Route::post('status/compose', 'InternalApiController@compose')->middleware('throttle:maxPostsPerHour,60')->middleware('throttle:maxPostsPerDay,1440');
|
||||||
Route::get('exp/rec', 'ApiController@userRecommendations');
|
Route::get('exp/rec', 'ApiController@userRecommendations');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -121,8 +121,8 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
||||||
Route::post('unmute', 'AccountController@unmute');
|
Route::post('unmute', 'AccountController@unmute');
|
||||||
Route::post('block', 'AccountController@block');
|
Route::post('block', 'AccountController@block');
|
||||||
Route::post('unblock', 'AccountController@unblock');
|
Route::post('unblock', 'AccountController@unblock');
|
||||||
Route::post('like', 'LikeController@store');
|
Route::post('like', 'LikeController@store')->middleware('throttle:maxLikesPerHour,60')->middleware('throttle:maxLikesPerDay,1440');
|
||||||
Route::post('share', 'StatusController@storeShare');
|
Route::post('share', 'StatusController@storeShare')->middleware('throttle:maxSharesPerHour,60')->middleware('throttle:maxSharesPerDay,1440');
|
||||||
Route::post('follow', 'FollowerController@store');
|
Route::post('follow', 'FollowerController@store');
|
||||||
Route::post('bookmark', 'BookmarkController@store');
|
Route::post('bookmark', 'BookmarkController@store');
|
||||||
Route::get('lang/{locale}', 'SiteController@changeLocale');
|
Route::get('lang/{locale}', 'SiteController@changeLocale');
|
||||||
|
|
Loading…
Add table
Reference in a new issue