diff --git a/lib/Froxlor/Http/RateLimiter.php b/lib/Froxlor/Http/RateLimiter.php index 116feb49..0c78c38e 100644 --- a/lib/Froxlor/Http/RateLimiter.php +++ b/lib/Froxlor/Http/RateLimiter.php @@ -2,7 +2,9 @@ namespace Froxlor\Http; +use Froxlor\Froxlor; use Froxlor\Settings; +use Froxlor\UI\Panel\UI; class RateLimiter { @@ -33,7 +35,12 @@ class RateLimiter if ($remaining <= 0) { header('HTTP/1.1 429 Too Many Requests'); header("Retry-After: $reset"); - exit(); + UI::twig()->addGlobal('install_mode', '1'); + echo UI::twig()->render('Froxlor/misc/ratelimithint.html.twig', [ + 'retry' => $reset, + 'installdir' => Froxlor::getInstallDir() + ]); + die(); } // Decrement the remaining requests and update the headers diff --git a/templates/Froxlor/misc/ratelimithint.html.twig b/templates/Froxlor/misc/ratelimithint.html.twig new file mode 100644 index 00000000..997d969d --- /dev/null +++ b/templates/Froxlor/misc/ratelimithint.html.twig @@ -0,0 +1,17 @@ +{% extends "Froxlor/base.html.twig" %} + +{% block content %} +
It seems like you've hit the rate limit.
+Please slow down your requests and retry after {{ retry|date('d.m.Y H:i:s') }}
++ Reload +
+