try fixing insane inbound bandwidth

master
Aevann1 2022-07-01 13:27:37 +02:00
parent c2b892af04
commit ae837e50a3
2 changed files with 6 additions and 5 deletions

View File

@ -470,6 +470,7 @@ def reported_comments(v):
@app.get("/admin")
@admin_level_required(2)
def admin_home(v):
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'
@ -477,7 +478,7 @@ def admin_home(v):
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)

View File

@ -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():