From ca2ad6589b0dcd870b5f72c782ce0989ebd839ff Mon Sep 17 00:00:00 2001 From: Stranck Date: Sat, 13 Jan 2024 16:59:13 +0100 Subject: [PATCH] Fixed upload size for propics --- app.py | 14 +++++++++++++- propic.py | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 4a74756..5a1c833 100644 --- a/app.py +++ b/app.py @@ -49,7 +49,7 @@ async def clear_session(request, exception): async def main_start(*_): print(">>>>>> main_start <<<<<<") - app.config.REQUEST_MAX_SIZE = 1024 * 1024 * 5 # 5 MB + app.config.REQUEST_MAX_SIZE = PROPIC_MAX_FILE_SIZE * 3 app.ctx.om = OrderManager() if FILL_CACHE: @@ -167,12 +167,24 @@ async def admin(request, order: Order): await request.app.ctx.om.updateCache() if not order: raise exceptions.Forbidden("You have been logged out. Please access the link in your E-Mail to login again!") + if EXTRA_PRINTS: + print(f"Checking admin credentials of {order.code} with secret {order.secret}") if not order.isAdmin(): raise exceptions.Forbidden("Birichino :)") tpl = app.ctx.tpl.get_template('admin.html') return html(tpl.render(order=order)) @app.route("/manage/logout") async def logour(request): + orgCode = request.cookies.get("foxo_code_ORG") + orgSecret = request.cookies.get("foxo_secret_ORG") + if orgCode != None and orgSecret != None: + r = redirect(f'/manage/welcome') + r.cookies['foxo_code'] = orgCode + r.cookies['foxo_secret'] = orgSecret + r.delete_cookie("foxo_code_ORG") + r.delete_cookie("foxo_secret_ORG") + return r + raise exceptions.Forbidden("You have been logged out.") if __name__ == "__main__": diff --git a/propic.py b/propic.py index 64f72e3..91adee7 100644 --- a/propic.py +++ b/propic.py @@ -55,6 +55,8 @@ async def upload_propic(request, order: Order): if not body[0].body: continue # Check max file size + if EXTRA_PRINTS: + print(f"Image {fn} weight: {len(body[0].body)} bytes") if len(body[0].body) > PROPIC_MAX_FILE_SIZE: raise exceptions.BadRequest("File size too large for " + ("Profile picture" if fn == 'propic' else 'Fursuit picture'))