master
Aevann1 2021-10-03 21:12:07 +02:00
parent 32285d464a
commit 9d91d420bf
3 changed files with 8 additions and 8 deletions

View File

@ -263,7 +263,7 @@ 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)}'
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}.webp'
file.save(name)
url = process_image(name)
@ -684,7 +684,7 @@ 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)}'
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}.webp'
file.save(name)
url = process_image(name)

View File

@ -509,7 +509,7 @@ def thumbnail_thread(pid):
db.close()
return
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}'
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}.webp'
with open(name, "wb") as file:
for chunk in image_req.iter_content(1024):
@ -836,7 +836,7 @@ def submit_post(v):
), 403
if file.content_type.startswith('image/'):
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}'
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}.webp'
file.save(name)
new_post.url = process_image(name)

View File

@ -111,7 +111,7 @@ def settings_profile_post(v):
if request.headers.get("Authorization"): return {"error": f"Image files only"}, 400
else: return render_template("settings_profile.html", v=v, error=f"Image files only."), 400
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}'
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}.webp'
file.save(name)
url = process_image(name)
@ -506,13 +506,13 @@ def settings_images_profile(v):
file = request.files["profile"]
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}'
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}.webp'
file.save(name)
highres = process_image(name)
if not highres: abort(400)
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}'
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}.webp'
file.save(name)
imageurl = process_image(name, True)
@ -537,7 +537,7 @@ def settings_images_banner(v):
file = request.files["banner"]
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}'
name = f'/hostedimages/{int(time.time())}{secrets.token_urlsafe(8)}.webp'
file.save(name)
imageurl = process_image(name)