forked from MarseyWorld/MarseyWorld
fdsfsd
parent
69e33b675d
commit
cf5b215bfa
|
@ -192,9 +192,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'images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
file.save(name)
|
||||
url = request.host_url + process_image(name)
|
||||
url = request.host_url[:-1] + process_image(name)
|
||||
|
||||
body += f"\n\n![]({url})"
|
||||
|
||||
|
@ -722,9 +722,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'images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
file.save(name)
|
||||
url = request.host_url + process_image(name)
|
||||
url = request.host_url[:-1] + process_image(name)
|
||||
|
||||
body += f"\n\n![]({url})"
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
|
|
|
@ -422,9 +422,9 @@ def edit_post(pid, v):
|
|||
file=request.files["file"]
|
||||
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
|
||||
|
||||
name = f'images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
file.save(name)
|
||||
url = request.host_url + process_image(name)
|
||||
url = request.host_url[:-1] + process_image(name)
|
||||
|
||||
body += f"\n\n![]({url})"
|
||||
|
||||
|
@ -691,13 +691,13 @@ def thumbnail_thread(pid):
|
|||
db.close()
|
||||
return
|
||||
|
||||
name = f'images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
|
||||
with open(name, "wb") as file:
|
||||
for chunk in image_req.iter_content(1024):
|
||||
file.write(chunk)
|
||||
|
||||
post.thumburl = f"https://{site}/" + process_image(name, True)
|
||||
post.thumburl = f"https://{site}" + process_image(name, True)
|
||||
db.add(post)
|
||||
db.commit()
|
||||
db.close()
|
||||
|
@ -916,9 +916,9 @@ def submit_post(v):
|
|||
file=request.files["file2"]
|
||||
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
|
||||
|
||||
name = f'images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
file.save(name)
|
||||
url = request.host_url + process_image(name)
|
||||
url = request.host_url[:-1] + process_image(name)
|
||||
|
||||
body += f"\n\n![]({url})"
|
||||
|
||||
|
@ -1015,9 +1015,9 @@ def submit_post(v):
|
|||
), 403
|
||||
|
||||
if file.content_type.startswith('image/'):
|
||||
name = f'images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
file.save(name)
|
||||
new_post.url = request.host_url + process_image(name)
|
||||
new_post.url = request.host_url[:-1] + process_image(name)
|
||||
|
||||
elif file.content_type.startswith('video/'):
|
||||
file.save("video.mp4")
|
||||
|
|
|
@ -124,9 +124,9 @@ 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'images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
file.save(name)
|
||||
url = request.host_url + process_image(name)
|
||||
url = request.host_url[:-1] + process_image(name)
|
||||
|
||||
bio += f"\n\n![]({url})"
|
||||
|
||||
|
@ -314,9 +314,9 @@ 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'images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
file.save(name)
|
||||
url = request.host_url + process_image(name)
|
||||
url = request.host_url[:-1] + process_image(name)
|
||||
|
||||
bio += f"\n\n![]({url})"
|
||||
|
||||
|
@ -720,9 +720,9 @@ def settings_images_profile(v):
|
|||
|
||||
file = request.files["profile"]
|
||||
|
||||
name = f'images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
file.save(name)
|
||||
highres = request.host_url + process_image(name)
|
||||
highres = request.host_url[:-1] + process_image(name)
|
||||
|
||||
if not highres: abort(400)
|
||||
|
||||
|
@ -756,9 +756,9 @@ def settings_images_banner(v):
|
|||
|
||||
file = request.files["banner"]
|
||||
|
||||
name = f'images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp'
|
||||
file.save(name)
|
||||
bannerurl = request.host_url + process_image(name)
|
||||
bannerurl = request.host_url[:-1] + process_image(name)
|
||||
|
||||
if bannerurl:
|
||||
if v.bannerurl and '/images/' in v.bannerurl : os.remove('images/' + v.bannerurl.split('/images/')[1])
|
||||
|
|
Loading…
Reference in New Issue