stranck-dev #5

Merged
drew merged 4 commits from stranck-dev into drew-dev 2024-01-07 20:31:00 +00:00
4 changed files with 7 additions and 3 deletions

2
app.py
View File

@ -47,6 +47,8 @@ async def clear_session(request, exception):
@app.before_server_start @app.before_server_start
async def main_start(*_): async def main_start(*_):
print(">>>>>> main_start <<<<<<") print(">>>>>> main_start <<<<<<")
app.config.REQUEST_MAX_SIZE = 1024 * 1024 * 5 # 5 MB
app.ctx.om = OrderManager() app.ctx.om = OrderManager()
if FILL_CACHE: if FILL_CACHE:

View File

@ -45,6 +45,8 @@ async def upload_propic(request, order: Order):
try: try:
img = Image.open(BytesIO(body[0].body)) img = Image.open(BytesIO(body[0].body))
if(img.size[0] > 2048 or img.size[1] > 2048):
raise exceptions.BadRequest("Maximum allowed dimensions: 2048x2048")
with open(f"res/propic/{fn}_{order.code}_original", "wb") as f: with open(f"res/propic/{fn}_{order.code}_original", "wb") as f:
f.write(body[0].body) f.write(body[0].body)

View File

@ -7,7 +7,7 @@ bp = Blueprint("stats", url_prefix="/manage")
@bp.route("/sponsorcount") @bp.route("/sponsorcount")
async def sponsor_count(request, order: Order): async def sponsor_count(request, order: Order):
await request.app.ctx.om.updateCache() await request.app.ctx.om.updateCache()
orders = {key:value for key,value in sorted(request.app.ctx.om.cache.items(), key=lambda x: len(x[1].room_members), reverse=True) if value.status not in ['c', 'e']} orders = {key:value for key,value in sorted(request.app.ctx.om.cache.items(), key=lambda x: x[1].ans('fursona_name')) if value.status not in ['c', 'e']}
tpl = request.app.ctx.tpl.get_template('sponsorcount.html') tpl = request.app.ctx.tpl.get_template('sponsorcount.html')
return html(tpl.render(orders=orders, order=order)) return html(tpl.render(orders=orders, order=order))
@ -23,7 +23,7 @@ async def nose_count(request, order: Order):
@bp.route("/fursuitcount") @bp.route("/fursuitcount")
async def fursuit_count(request, order: Order): async def fursuit_count(request, order: Order):
await request.app.ctx.om.updateCache() await request.app.ctx.om.updateCache()
orders = {key:value for key,value in sorted(request.app.ctx.om.cache.items(), key=lambda x: len(x[1].room_members), reverse=True) if value.status not in ['c', 'e']} orders = {key:value for key,value in sorted(request.app.ctx.om.cache.items(), key=lambda x: x[1].ans('fursona_name')) if value.status not in ['c', 'e']}
tpl = request.app.ctx.tpl.get_template('fursuitcount.html') tpl = request.app.ctx.tpl.get_template('fursuitcount.html')
return html(tpl.render(orders=orders, order=order)) return html(tpl.render(orders=orders, order=order))

View File

@ -2,7 +2,7 @@
<summary role="button"><img src="/res/icons/bedroom.svg" class="icon"/> Accomodation & Roommates <span class="status">{% if not order.room_confirmed %}⚠️{% endif %}</span></summary> <summary role="button"><img src="/res/icons/bedroom.svg" class="icon"/> Accomodation & Roommates <span class="status">{% if not order.room_confirmed %}⚠️{% endif %}</span></summary>
<h2 style="margin-bottom:0;">Your room {% if room_members %}- {{room_members[0].ans('room_name')}}{% endif %}</h2> <h2 style="margin-bottom:0;">Your room {% if room_members %}- {{room_members[0].ans('room_name')}}{% endif %}</h2>
<p><b>Room's type:</b> {{ROOM_TYPE_NAMES[order.bed_in_room]}}.</p> <p><b>Room's type:</b> {{ROOM_TYPE_NAMES[order.bed_in_room]}}.</p>
<p class="notice" style="background:#0881c0"><b>Note! </b> Only people with the same room type can be roommates. If you need help, you can check the support guide <a href="https://pornhub.com">clicking here</a>.</p> <p class="notice" style="background:#0881c0"><b>Note! </b> Only people with the same room type can be roommates. If you need help, contact the <a href="https://furizon.net/contact/">Furizon's Staff</a>.</p>
{# Show alert if room owner has wrong people inside #} {# Show alert if room owner has wrong people inside #}