fix 500 error

master
Aevann1 2022-07-01 20:19:21 +02:00
parent 9ffc3015e2
commit 7a682d95c6
1 changed files with 3 additions and 1 deletions

View File

@ -470,6 +470,8 @@ def reported_comments(v):
@app.get("/admin") @app.get("/admin")
@admin_level_required(2) @admin_level_required(2)
def admin_home(v): def admin_home(v):
under_attack = False
if v.admin_level > 2: if v.admin_level > 2:
if CF_ZONE == 'blahblahblah': response = 'high' if CF_ZONE == 'blahblahblah': response = 'high'
else: response = requests.get(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/settings/security_level', headers=CF_HEADERS, timeout=5).json()['result']['value'] else: response = requests.get(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/settings/security_level', headers=CF_HEADERS, timeout=5).json()['result']['value']
@ -478,7 +480,7 @@ def admin_home(v):
gitref = admin_git_head() gitref = admin_git_head()
return render_template("admin/admin_home.html", v=v, return render_template("admin/admin_home.html", v=v,
under_attack=under_attack or False, under_attack=under_attack,
site_settings=app.config['SETTINGS'], site_settings=app.config['SETTINGS'],
gitref=gitref) gitref=gitref)