This commit is contained in:
Aevann1 2021-11-30 20:25:41 +02:00
parent d6d0bcdd5b
commit 57dd3a37f4
2 changed files with 16 additions and 1 deletions

View file

@ -755,6 +755,16 @@ def submit_post(v):
body = body.replace('I ', f'@{v.username} ')
body = censor_slurs2(body).upper().replace(' ME ', f' @{v.username} ')
if request.files.get("file2") and request.headers.get("cf-ipcountry") != "T1":
file=request.files["file2"]
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
name = f'/images/{int(time.time())}{secrets.token_urlsafe(2)}.webp'
file.save(name)
url = request.host_url[:-1] + process_image(name)
body += f"\n\n![]({url})"
body_html = sanitize(CustomRenderer().render(mistletoe.Document(body)))
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 400