From 7ec680f735cbf5b5630e113523ffdab818222b38 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 22 Jul 2021 21:29:19 +0200 Subject: [PATCH] sneed --- drama/routes/posts.py | 15 ++++----------- drama/routes/users.py | 3 ++- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/drama/routes/posts.py b/drama/routes/posts.py index 5d5432314..8810b47e4 100644 --- a/drama/routes/posts.py +++ b/drama/routes/posts.py @@ -20,14 +20,6 @@ from io import BytesIO from drama.__main__ import app, limiter, cache, db_session from PIL import Image as PILimage -BAN_REASONS = ['', - "URL shorteners are not permitted.", - "Pornographic material is not permitted.", # defunct - "Copyright infringement is not permitted." - ] - -BUCKET = "i.drama.ga" - with open("snappy.txt", "r") as f: snappyquotes = f.read().split("{[para]}") @@ -606,14 +598,14 @@ def submit_post(v): return {"html": lambda: (render_template("submit.html", v=v, - error=BAN_REASONS[domain_obj.reason], + error="ToS Violation", title=title, url=url, body=request.form.get( "body", ""), b=board ), 400), - "api": lambda: ({"error": BAN_REASONS[domain_obj.reason]}, 400) + "api": lambda: ({"error": "ToS violation"}, 400) } # check for embeds @@ -1093,7 +1085,8 @@ def delete_post_pid(pid, v): for chunk in x.iter_content(1024): file.write(chunk) - u.profileurl = upload_from_file("resizing", "resizing", (50, 50)) + image = upload_from_file("resizing", "resizing", (50, 50)) + u.profileurl = image u.resized = True g.db.add(u) print(f"2 {u.profileurl}") diff --git a/drama/routes/users.py b/drama/routes/users.py index 533f0cf09..613fe4fe5 100644 --- a/drama/routes/users.py +++ b/drama/routes/users.py @@ -39,7 +39,8 @@ def leaderboard(v): for chunk in x.iter_content(1024): file.write(chunk) - u.profileurl = upload_from_file("resizing", "resizing", (50, 50)) + image = upload_from_file("resizing", "resizing", (50, 50)) + u.profileurl = image u.resized = True g.db.add(u) print(f"2 {u.profileurl}")