From 3a3157def3f5820a8d89ba128e7a68b3c9ab68ff Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 29 Mar 2022 19:32:36 +0200 Subject: [PATCH] df --- files/helpers/sanitize.py | 6 +++--- files/routes/static.py | 2 +- files/templates/comments.html | 2 +- files/templates/submit.html | 2 +- files/templates/userpage.html | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 9e13b39fb..7c999a1ee 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -248,7 +248,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): elif remoji.endswith('pat') and path.isfile(f"files/assets/images/emojis/{remoji.replace('pat','')}.webp"): pat(remoji.replace('pat','')) new = re.sub(f'(?', new, flags=re.I|re.A) - requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/e/{emoji}", f"https://{request.host}/e/{emoji}.webp"]}, timeout=5) + requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/e/{emoji}.webp"]}, timeout=5) sanitized = sanitized.replace(old, new) @@ -285,7 +285,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): elif emoji.endswith('pat') and path.isfile(f"files/assets/images/emojis/{emoji.replace('pat','')}.webp"): pat(emoji.replace('pat','')) sanitized = re.sub(f'(?', sanitized, flags=re.I|re.A) - requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/e/{emoji}", f"https://{request.host}/e/{emoji}.webp"]}, timeout=5) + requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/e/{emoji}.webp"]}, timeout=5) for rd in ["://reddit.com", "://new.reddit.com", "://www.reddit.com", "://redd.it", "://libredd.it"]: @@ -384,7 +384,7 @@ def filter_emojis_only(title, edit=False, graceful=False): elif emoji.endswith('pat') and path.isfile(f"files/assets/images/emojis/{emoji.replace('pat','')}.webp"): pat(emoji.replace('pat','')) title = re.sub(f'(?', title, flags=re.I|re.A) - requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/e/{emoji}", f"https://{request.host}/e/{emoji}.webp"]}, timeout=5) + requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/e/{emoji}.webp"]}, timeout=5) title = strikethrough_regex.sub(r'\1', title) diff --git a/files/routes/static.py b/files/routes/static.py index 85f60abda..922cc8d47 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -351,7 +351,7 @@ def archives(path): @app.get('/e/') @limiter.exempt def emoji(emoji): - if not emoji.endswith('.webp'): emoji += '.webp' + if not emoji.endswith('.webp'): abort(404) resp = make_response(send_from_directory('assets/images/emojis', emoji)) resp.headers.remove("Cache-Control") resp.headers.add("Cache-Control", "public, max-age=3153600") diff --git a/files/templates/comments.html b/files/templates/comments.html index 7eebbac05..6a3b78716 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -842,7 +842,7 @@ {% endif %} {% if v %} - + {% endif %} diff --git a/files/templates/submit.html b/files/templates/submit.html index d2d286364..a89525212 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -266,7 +266,7 @@ checkForRequired() - + {% include "emoji_modal.html" %} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index a42a84291..7243be130 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -767,7 +767,7 @@ {% endif %} - + {% if v and v.id != u.id and '/comments' not in request.path %}