From f6b57233088893fbe517af12921f5ab43cb0e33b Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 19 Oct 2023 00:02:35 +0300 Subject: [PATCH] try fixing the issue with the under attack toggle --- files/helpers/settings.py | 4 ++++ files/routes/wrappers.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/files/helpers/settings.py b/files/helpers/settings.py index d37141914..4cba057b8 100644 --- a/files/helpers/settings.py +++ b/files/helpers/settings.py @@ -31,6 +31,10 @@ def toggle_setting(setting): _save_settings() return val +def set_setting(setting, val): + _SETTINGS[setting] = val + _save_settings() + def reload_settings(): global _SETTINGS if not os.path.isfile(SETTINGS_FILENAME): diff --git a/files/routes/wrappers.py b/files/routes/wrappers.py index 4e951310f..d203d2262 100644 --- a/files/routes/wrappers.py +++ b/files/routes/wrappers.py @@ -63,11 +63,11 @@ def calc_users(): if g.loggedout_counter > ddos_threshold: if not get_setting('under_attack'): - toggle_setting('under_attack') + set_setting('under_attack', True) set_security_level('under_attack') else: if get_setting('under_attack'): - toggle_setting('under_attack') + set_setting('under_attack', False) set_security_level('high') return ''