Skip to content

Commit e8306c7

Browse files
committed
update: increase web rate limit for staff
Staff often use the site more frequently so are prone to rate limits, but are also fairly well trusted, so double their rate limits.
1 parent 3097949 commit e8306c7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/Providers/RouteServiceProvider.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,16 @@ public function boot(): void
6969
protected function configureRateLimiting(): void
7070
{
7171
RateLimiter::for('web', fn (Request $request): Limit => $request->user()
72-
? Limit::perMinute(30)->by('web'.$request->user()->id)
72+
? Limit::perMinute(
73+
cache()->remember(
74+
'group:'.$request->user()->group_id.':is_modo',
75+
5,
76+
fn () => $request->user()->group()->value('is_modo')
77+
)
78+
? 60
79+
: 30
80+
)
81+
->by('web'.$request->user()->id)
7382
: Limit::perMinute(8)->by('web'.$request->ip()));
7483
RateLimiter::for('api', fn (Request $request) => Limit::perMinute(30)->by('api'.$request->ip()));
7584
RateLimiter::for('announce', fn (Request $request) => Limit::perMinute(500)->by('announce'.$request->ip()));

0 commit comments

Comments
 (0)