forked from rDrama/rDrama
fix images again
parent
a4128b32fe
commit
903fb21961
|
@ -57,8 +57,7 @@ def process_files(files, v, body):
|
||||||
name = f'/images/{time.time()}'.replace('.','') + '.webp'
|
name = f'/images/{time.time()}'.replace('.','') + '.webp'
|
||||||
file.save(name)
|
file.save(name)
|
||||||
url = process_image(name, v)
|
url = process_image(name, v)
|
||||||
print(f'{url} ', flush=True)
|
body = body.replace(f'[{file.filename}]', f'{url} ', 1)
|
||||||
body = body.replace(f'[{file.filename}]', f'{url} ', 1)
|
|
||||||
elif file.content_type.startswith('video/'):
|
elif file.content_type.startswith('video/'):
|
||||||
body = body.replace(f'[{file.filename}]', process_video(file, v), 1)
|
body = body.replace(f'[{file.filename}]', process_video(file, v), 1)
|
||||||
elif file.content_type.startswith('audio/'):
|
elif file.content_type.startswith('audio/'):
|
||||||
|
@ -66,7 +65,6 @@ def process_files(files, v, body):
|
||||||
else:
|
else:
|
||||||
abort(415)
|
abort(415)
|
||||||
|
|
||||||
print(body, flush=True)
|
|
||||||
return body
|
return body
|
||||||
|
|
||||||
|
|
||||||
|
@ -298,7 +296,7 @@ def process_dm_images(v, user, body):
|
||||||
try: url = req['files'][0]['url']
|
try: url = req['files'][0]['url']
|
||||||
except: abort(400, req['description'])
|
except: abort(400, req['description'])
|
||||||
|
|
||||||
body = body.replace(f'[{file.filename}]', url, 1)
|
body = body.replace(f'[{file.filename}]', f'{url} ', 1)
|
||||||
|
|
||||||
with open(f"{LOG_DIRECTORY}/dm_images.log", "a+", encoding="utf-8") as f:
|
with open(f"{LOG_DIRECTORY}/dm_images.log", "a+", encoding="utf-8") as f:
|
||||||
if user:
|
if user:
|
||||||
|
|
|
@ -211,7 +211,7 @@ def comment(v:User):
|
||||||
purge_files_in_cache(f"https://{SITE}/assets/images/badges/{badge.id}.webp")
|
purge_files_in_cache(f"https://{SITE}/assets/images/badges/{badge.id}.webp")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
abort(400, str(e))
|
abort(400, str(e))
|
||||||
body = body.replace(f'[{file.filename}]', image, 1)
|
body = body.replace(f'[{file.filename}]', f'{image} ', 1)
|
||||||
elif file.content_type.startswith('video/'):
|
elif file.content_type.startswith('video/'):
|
||||||
body = body.replace(f'[{file.filename}]', process_video(file, v), 1)
|
body = body.replace(f'[{file.filename}]', process_video(file, v), 1)
|
||||||
elif file.content_type.startswith('audio/'):
|
elif file.content_type.startswith('audio/'):
|
||||||
|
|
Loading…
Reference in New Issue