dffd
This commit is contained in:
parent
e28c59ba4a
commit
eefbd43e0f
4 changed files with 22 additions and 18 deletions
|
@ -263,9 +263,9 @@ def api_comment(v):
|
|||
file=request.files["file"]
|
||||
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
|
||||
|
||||
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}.webp'
|
||||
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}.gif'
|
||||
file.save(name)
|
||||
url = process_image(name)
|
||||
url = request.host_url[:-1] + process_image(name)
|
||||
|
||||
body = request.values.get("body") + f"\n"
|
||||
body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body)
|
||||
|
@ -684,9 +684,9 @@ def edit_comment(cid, v):
|
|||
file=request.files["file"]
|
||||
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
|
||||
|
||||
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}.webp'
|
||||
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}.gif'
|
||||
file.save(name)
|
||||
url = process_image(name)
|
||||
url = request.host_url[:-1] + process_image(name)
|
||||
|
||||
body += f"\n"
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue