From 66296cac7352e8c05283993e006bdb7f4eb323a0 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 1 Feb 2022 07:35:05 +0200 Subject: [PATCH] fds --- files/routes/comments.py | 8 +------- files/routes/posts.py | 5 +++-- files/templates/admin/banned_domains.html | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index 43e0bc566..55a5f0431 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -700,13 +700,7 @@ def edit_comment(cid, v): if ban.reason: reason += f" {ban.reason}" - if request.headers.get("Authorization"): return {'error': 'A blacklisted domain was used.'}, 400 - return render_template("comment_failed.html", - action=f"/edit_comment/{c.id}", - badlinks=[x.domain for x in bans], - body=body, - v=v - ) + return {'error': reason}, 400 if AGENDAPOSTER_PHRASE not in body.lower(): now = int(time.time()) cutoff = now - 60 * 60 * 24 diff --git a/files/routes/posts.py b/files/routes/posts.py index f1438d504..509afa61c 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -823,8 +823,9 @@ def submit_post(v): domain_obj = get_domain(domain) if domain_obj: - if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error":domain_obj.reason}, 400 - return render_template("submit.html", v=v, error=domain_obj.reason, title=title, url=url, body=request.values.get("body", "")), 400 + reason = f"Remove the {domain_obj.domain} link from your post and try again. {domain_obj.reason}" + if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error":reason}, 400 + return render_template("submit.html", v=v, error=reason, title=title, url=url, body=request.values.get("body", "")), 400 elif "twitter.com" == domain: try: embed = requests.get("https://publish.twitter.com/oembed", timeout=5, params={"url":url, "omit_script":"t"}).json()["html"] except: embed = None diff --git a/files/templates/admin/banned_domains.html b/files/templates/admin/banned_domains.html index bac049522..64c354b3f 100644 --- a/files/templates/admin/banned_domains.html +++ b/files/templates/admin/banned_domains.html @@ -30,7 +30,7 @@
- +