mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Added configurable API throttling, Handled API errors standardly
This commit is contained in:
18
app/Http/Middleware/ThrottleApiRequests.php
Normal file
18
app/Http/Middleware/ThrottleApiRequests.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace BookStack\Http\Middleware;
|
||||
|
||||
use Illuminate\Routing\Middleware\ThrottleRequests as Middleware;
|
||||
|
||||
class ThrottleApiRequests extends Middleware
|
||||
{
|
||||
|
||||
/**
|
||||
* Resolve the number of attempts if the user is authenticated or not.
|
||||
*/
|
||||
protected function resolveMaxAttempts($request, $maxAttempts)
|
||||
{
|
||||
return (int) config('api.requests_per_minute');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user