From 866ac5b9d5ee95dbe5973ae9a40414ba10b4f6fd Mon Sep 17 00:00:00 2001 From: Stranck Date: Thu, 4 Jan 2024 21:40:06 +0100 Subject: [PATCH 1/3] Fixed order in sponsor/fursuit count pages --- stats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stats.py b/stats.py index 75d7467..d9759c1 100644 --- a/stats.py +++ b/stats.py @@ -7,7 +7,7 @@ bp = Blueprint("stats", url_prefix="/manage") @bp.route("/sponsorcount") async def sponsor_count(request, order: Order): 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') return html(tpl.render(orders=orders, order=order)) @@ -23,7 +23,7 @@ async def nose_count(request, order: Order): @bp.route("/fursuitcount") async def fursuit_count(request, order: Order): 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') return html(tpl.render(orders=orders, order=order)) \ No newline at end of file -- 2.43.5 From 6b70d9120117af25a777f096a00d398b6ebfa08a Mon Sep 17 00:00:00 2001 From: Stranck Date: Thu, 4 Jan 2024 22:15:02 +0100 Subject: [PATCH 2/3] Fixed propic upload limits If the size is bigger than 5MB the error will be handled by SANIC directly. Maybe we'd like a better user-visible handling? --- app.py | 2 ++ propic.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app.py b/app.py index fa2a1b1..ccb1102 100644 --- a/app.py +++ b/app.py @@ -47,6 +47,8 @@ async def clear_session(request, exception): @app.before_server_start async def main_start(*_): print(">>>>>> main_start <<<<<<") + + app.config.REQUEST_MAX_SIZE = 1024 * 1024 * 5 # 5 MB app.ctx.om = OrderManager() if FILL_CACHE: diff --git a/propic.py b/propic.py index 7eef9b4..907caa9 100644 --- a/propic.py +++ b/propic.py @@ -45,6 +45,8 @@ async def upload_propic(request, order: Order): try: 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: f.write(body[0].body) -- 2.43.5 From 25ed127e81cb61e5847995b51bf0ab2f95549e34 Mon Sep 17 00:00:00 2001 From: Stranck Date: Sat, 6 Jan 2024 12:58:23 +0100 Subject: [PATCH 3/3] Fixed funny link in room.html --- tpl/blocks/room.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tpl/blocks/room.html b/tpl/blocks/room.html index 8de7962..4425c1f 100644 --- a/tpl/blocks/room.html +++ b/tpl/blocks/room.html @@ -2,7 +2,7 @@ Accomodation & Roommates {% if not order.room_confirmed %}⚠️{% endif %}

Your room {% if room_members %}- {{room_members[0].ans('room_name')}}{% endif %}

Room's type: {{ROOM_TYPE_NAMES[order.bed_in_room]}}.

-

Note! Only people with the same room type can be roommates. If you need help, you can check the support guide clicking here.

+

Note! Only people with the same room type can be roommates. If you need help, contact the Furizon's Staff.

{# Show alert if room owner has wrong people inside #} -- 2.43.5