fix 500 error

master
Aevann 2024-04-11 17:56:57 +02:00
parent 8e0d9efa93
commit c1155898c4
1 changed files with 2 additions and 1 deletions

View File

@ -390,7 +390,8 @@ def reported_comments(v):
@admin_level_required(PERMS['ADMIN_HOME_VISIBLE'])
def admin_home(v):
if CLOUDFLARE_AVAILABLE:
under_attack = (requests.get(f"{CLOUDFLARE_API_URL}/zones/{CF_ZONE}/settings/security_level", headers=CF_HEADERS, timeout=CLOUDFLARE_REQUEST_TIMEOUT_SECS).json()['result']['value'] == "under_attack")
try: under_attack = (requests.get(f"{CLOUDFLARE_API_URL}/zones/{CF_ZONE}/settings/security_level", headers=CF_HEADERS, timeout=CLOUDFLARE_REQUEST_TIMEOUT_SECS).json()['result']['value'] == "under_attack")
except: return render_template("admin/admin_home.html", v=v)
set_setting('under_attack', under_attack)
return render_template("admin/admin_home.html", v=v)