From b5a561a343df3fa51c80bdadc13e3a71538f1fe9 Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 19 Oct 2023 00:12:17 +0300 Subject: [PATCH] improvements --- files/helpers/cloudflare.py | 5 +---- files/routes/wrappers.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/files/helpers/cloudflare.py b/files/helpers/cloudflare.py index 777a9d12f..735a446f0 100644 --- a/files/helpers/cloudflare.py +++ b/files/helpers/cloudflare.py @@ -11,10 +11,7 @@ CLOUDFLARE_AVAILABLE = CF_ZONE and CF_ZONE != DEFAULT_CONFIG_VALUE def _request_from_cloudflare(url, method, post_data_str): if not CLOUDFLARE_AVAILABLE: return False - try: - res = str(requests.request(method, f"{CLOUDFLARE_API_URL}/zones/{CF_ZONE}/{url}", headers=CF_HEADERS, data=post_data_str, timeout=CLOUDFLARE_REQUEST_TIMEOUT_SECS)) - except: - return False + res = str(requests.request(method, f"{CLOUDFLARE_API_URL}/zones/{CF_ZONE}/{url}", headers=CF_HEADERS, data=post_data_str, timeout=CLOUDFLARE_REQUEST_TIMEOUT_SECS)) return res == "" def set_security_level(under_attack="high"): diff --git a/files/routes/wrappers.py b/files/routes/wrappers.py index d203d2262..13395a23e 100644 --- a/files/routes/wrappers.py +++ b/files/routes/wrappers.py @@ -61,7 +61,7 @@ def calc_users(): else: ddos_threshold = 1000 - if g.loggedout_counter > ddos_threshold: + if g.loggedin_counter + g.loggedout_counter > ddos_threshold: if not get_setting('under_attack'): set_setting('under_attack', True) set_security_level('under_attack')