master
Aevann1 2021-07-22 21:29:19 +02:00
parent 0f1301dbfc
commit 7ec680f735
2 changed files with 6 additions and 12 deletions

View File

@ -20,14 +20,6 @@ from io import BytesIO
from drama.__main__ import app, limiter, cache, db_session from drama.__main__ import app, limiter, cache, db_session
from PIL import Image as PILimage 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: with open("snappy.txt", "r") as f:
snappyquotes = f.read().split("{[para]}") snappyquotes = f.read().split("{[para]}")
@ -606,14 +598,14 @@ def submit_post(v):
return {"html": lambda: (render_template("submit.html", return {"html": lambda: (render_template("submit.html",
v=v, v=v,
error=BAN_REASONS[domain_obj.reason], error="ToS Violation",
title=title, title=title,
url=url, url=url,
body=request.form.get( body=request.form.get(
"body", ""), "body", ""),
b=board b=board
), 400), ), 400),
"api": lambda: ({"error": BAN_REASONS[domain_obj.reason]}, 400) "api": lambda: ({"error": "ToS violation"}, 400)
} }
# check for embeds # check for embeds
@ -1093,7 +1085,8 @@ def delete_post_pid(pid, v):
for chunk in x.iter_content(1024): for chunk in x.iter_content(1024):
file.write(chunk) 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 u.resized = True
g.db.add(u) g.db.add(u)
print(f"2 {u.profileurl}") print(f"2 {u.profileurl}")

View File

@ -39,7 +39,8 @@ def leaderboard(v):
for chunk in x.iter_content(1024): for chunk in x.iter_content(1024):
file.write(chunk) 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 u.resized = True
g.db.add(u) g.db.add(u)
print(f"2 {u.profileurl}") print(f"2 {u.profileurl}")