Update: 2026-07-22 01:04:56

This commit is contained in:
Hamza-Ayed
2026-07-22 01:04:57 +03:00
parent be14b2716e
commit a4b5a2545c
+4
View File
@@ -56,6 +56,10 @@ class RateLimiter
// ── تطبيق الحد وإيقاف الطلب إن تجاوز ───────────────────── // ── تطبيق الحد وإيقاف الطلب إن تجاوز ─────────────────────
public function enforce(string $identifier, string $type = 'api'): void public function enforce(string $identifier, string $type = 'api'): void
{ {
if (getenv('DISABLE_RATE_LIMITER') === 'true' || ($_ENV['DISABLE_RATE_LIMITER'] ?? '') === 'true') {
return;
}
if (!$this->check($identifier, $type)) { if (!$this->check($identifier, $type)) {
$limit = self::LIMITS[$type] ?? self::LIMITS['api']; $limit = self::LIMITS[$type] ?? self::LIMITS['api'];
$window = $limit['window']; $window = $limit['window'];