From ae837e50a3537950e236f12119da8f6c1db308cf Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 1 Jul 2022 13:27:37 +0200 Subject: [PATCH] try fixing insane inbound bandwidth --- files/routes/admin.py | 9 +++++---- files/routes/posts.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 5536c30cb..675333c2f 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -470,14 +470,15 @@ def reported_comments(v): @app.get("/admin") @admin_level_required(2) def admin_home(v): - 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'] - under_attack = response == 'under_attack' + if v.admin_level > 2: + 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'] + under_attack = response == 'under_attack' gitref = admin_git_head() return render_template("admin/admin_home.html", v=v, - under_attack=under_attack, + under_attack=under_attack or False, site_settings=app.config['SETTINGS'], gitref=gitref) diff --git a/files/routes/posts.py b/files/routes/posts.py index 522c4c609..ac5b0010d 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -170,7 +170,7 @@ def post_id(pid, anything=None, v=None, sub=None): blocked, blocked.c.user_id == Comment.author_id, isouter=True - ).options(joinedload(Comment.flags), joinedload(Comment.awards), joinedload(Comment.author), joinedload(Comment.author, User.badges)) + ) output = [] for c in comments.all():