add prefixes for asset_submissions

master
Aevann1 2022-09-10 07:49:39 +02:00
parent 166060cb01
commit 0ddacad599
3 changed files with 10 additions and 10 deletions

View File

@ -510,10 +510,10 @@ def submit_marsey(v):
author = request.values.get('author').strip() author = request.values.get('author').strip()
author = get_user(author) author = get_user(author)
highquality = f'/asset_submissions/{name}.png' highquality = f'/asset_submissions/m_{name}.png'
file.save(highquality) file.save(highquality)
filename = f'/asset_submissions/{name}.webp' filename = f'/asset_submissions/m_{name}.webp'
copyfile(highquality, filename) copyfile(highquality, filename)
process_image(filename, 200) process_image(filename, 200)
@ -561,7 +561,7 @@ def approve_marsey(v, name):
marsey.tags = tags marsey.tags = tags
g.db.add(marsey) g.db.add(marsey)
move(f"/asset_submissions/{name}.webp", f"files/assets/images/emojis/{marsey.name}.webp") move(f"/asset_submissions/m_{name}.webp", f"files/assets/images/emojis/{marsey.name}.webp")
author = get_account(marsey.author_id) author = get_account(marsey.author_id)
all_by_author = g.db.query(Marsey).filter_by(author_id=author.id).count() all_by_author = g.db.query(Marsey).filter_by(author_id=author.id).count()
@ -602,7 +602,7 @@ def reject_marsey(v, name):
send_repeatable_notification(marsey.submitter_id, msg) send_repeatable_notification(marsey.submitter_id, msg)
g.db.delete(marsey) g.db.delete(marsey)
os.remove(f"/asset_submissions/{marsey.name}.webp") os.remove(f"/asset_submissions/m_{marsey.name}.webp")
return {"message": f"'{marsey.name}' rejected!"} return {"message": f"'{marsey.name}' rejected!"}
@ -648,14 +648,14 @@ def submit_hat(v):
author = request.values.get('author').strip() author = request.values.get('author').strip()
author = get_user(author) author = get_user(author)
highquality = f'/asset_submissions/{name}.png' highquality = f'/asset_submissions/h_{name}.png'
file.save(highquality) file.save(highquality)
i = Image.open(highquality) i = Image.open(highquality)
if i.width > 100 or i.height > 130: if i.width > 100 or i.height > 130:
return error("Images must be 100x130") return error("Images must be 100x130")
filename = f'/asset_submissions/{name}.webp' filename = f'/asset_submissions/h_{name}.webp'
copyfile(highquality, filename) copyfile(highquality, filename)
process_image(filename) process_image(filename)
@ -699,7 +699,7 @@ def approve_hat(v, name):
hat.description = description hat.description = description
g.db.add(hat) g.db.add(hat)
move(f"/asset_submissions/{name}.webp", f"files/assets/images/hats/{hat.name}.webp") move(f"/asset_submissions/h_{name}.webp", f"files/assets/images/hats/{hat.name}.webp")
g.db.flush() g.db.flush()
@ -749,6 +749,6 @@ def reject_hat(v, name):
send_repeatable_notification(hat.submitter_id, msg) send_repeatable_notification(hat.submitter_id, msg)
g.db.delete(hat) g.db.delete(hat)
os.remove(f"/asset_submissions/{hat.name}.webp") os.remove(f"/asset_submissions/h_{hat.name}.webp")
return {"message": f"'{hat.name}' rejected!"} return {"message": f"'{hat.name}' rejected!"}

View File

@ -136,7 +136,7 @@
<input type="hidden" name="formkey" value="{{v.formkey}}"> <input type="hidden" name="formkey" value="{{v.formkey}}">
<div><label class="mt-3">Image</label></div> <div><label class="mt-3">Image</label></div>
<img loading="lazy" src="/asset_submissions/{{hat.name}}.webp" style="max-width:50%"> <img loading="lazy" src="/asset_submissions/h_{{hat.name}}.webp" style="max-width:50%">
<div><label class="mt-3" for="{{hat.name}}-submitter">Submitter</label></div> <div><label class="mt-3" for="{{hat.name}}-submitter">Submitter</label></div>
<input autocomplete="off" type="text" id="{{hat.name}}-submitter" class="form-control" maxlength="30" value="{{hat.submitter.username}}" readonly> <input autocomplete="off" type="text" id="{{hat.name}}-submitter" class="form-control" maxlength="30" value="{{hat.submitter.username}}" readonly>

View File

@ -141,7 +141,7 @@
<input type="hidden" name="formkey" value="{{v.formkey}}"> <input type="hidden" name="formkey" value="{{v.formkey}}">
<div><label class="mt-3">Image</label></div> <div><label class="mt-3">Image</label></div>
<img loading="lazy" src="/asset_submissions/{{marsey.name}}.webp" style="max-width:50%"> <img loading="lazy" src="/asset_submissions/m_{{marsey.name}}.webp" style="max-width:50%">
<div><label class="mt-3" for="{{marsey.name}}-submitter">Submitter</label></div> <div><label class="mt-3" for="{{marsey.name}}-submitter">Submitter</label></div>
<input autocomplete="off" type="text" id="{{marsey.name}}-submitter" class="form-control" maxlength="30" value="{{marsey.submitter}}" readonly> <input autocomplete="off" type="text" id="{{marsey.name}}-submitter" class="form-control" maxlength="30" value="{{marsey.submitter}}" readonly>