From a706b3105c26d22a1886af82d28404304376ab97 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 16 Feb 2022 01:38:33 +0200 Subject: [PATCH] fd --- files/helpers/const.py | 6 +++++- files/routes/admin.py | 6 ++---- files/routes/comments.py | 3 --- files/routes/posts.py | 4 ---- files/templates/userpage.html | 4 ++-- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 6194a178e..bae461b0f 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -621,4 +621,8 @@ discounts = { 71: 0.06, 72: 0.08, 73: 0.10, -} \ No newline at end of file +} + +CF_KEY = environ.get("CF_KEY", "").strip() +CF_ZONE = environ.get("CF_ZONE", "").strip() +CF_HEADERS = {"Authorization": f"Bearer {CF_KEY}", "Content-Type": "application/json"} \ No newline at end of file diff --git a/files/routes/admin.py b/files/routes/admin.py index e1602661f..8730f0f05 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -20,10 +20,6 @@ import requests GUMROAD_ID = environ.get("GUMROAD_ID", "tfcvri").strip() GUMROAD_TOKEN = environ.get("GUMROAD_TOKEN", "").strip() -CF_KEY = environ.get("CF_KEY", "").strip() -CF_ZONE = environ.get("CF_ZONE", "").strip() -CF_HEADERS = {"Authorization": f"Bearer {CF_KEY}", "Content-Type": "application/json"} - month = datetime.now().strftime('%B') @@ -1099,6 +1095,8 @@ def ban_post(post_id, v): v.coins += 1 g.db.add(v) + requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, json={'files': [f"{SITE_FULL}/logged_out/"]}) + g.db.commit() return {"message": "Post removed!"} diff --git a/files/routes/comments.py b/files/routes/comments.py index 41466d654..46840bef6 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -21,9 +21,6 @@ IMGUR_KEY = environ.get("IMGUR_KEY").strip() if PUSHER_ID: beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY) -CF_KEY = environ.get("CF_KEY", "").strip() -CF_ZONE = environ.get("CF_ZONE", "").strip() -CF_HEADERS = {"Authorization": f"Bearer {CF_KEY}", "Content-Type": "application/json"} WORD_LIST = tuple(set(environ.get("WORDLE").split(" "))) @app.get("/comment/") diff --git a/files/routes/posts.py b/files/routes/posts.py index 7ffaea2f4..805db2886 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -32,10 +32,6 @@ else: snappyquotes = marseys IMGUR_KEY = environ.get("IMGUR_KEY").strip() -CF_KEY = environ.get("CF_KEY", "").strip() -CF_ZONE = environ.get("CF_ZONE", "").strip() -CF_HEADERS = {"Authorization": f"Bearer {CF_KEY}", "Content-Type": "application/json"} - discounts = { 69: 0.02, 70: 0.04, diff --git a/files/templates/userpage.html b/files/templates/userpage.html index be79642dc..ac09e8f16 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -58,7 +58,7 @@ {% endif %} {% if SITE_NAME=='Drama' and u.house %} - House {{u.house}} + House {{u.house}} {% endif %} {% if u.verified %}{% endif %} @@ -374,7 +374,7 @@ {% endif %} {% if SITE_NAME=='Drama' and u.house %} - House {{u.house}} + House {{u.house}} {% endif %} {% if u.admin_level > 1 or (u.admin_level == 1 and not(v and v.admin_level > 1)) %}