From 216b0c33f69c9e09f24ea18a0f67ab93be246fda Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 10 Sep 2022 02:30:25 +0200 Subject: [PATCH] fix retarded /transfers logic for API users --- files/routes/static.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/files/routes/static.py b/files/routes/static.py index 95acbeab2..3022f768c 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -404,15 +404,17 @@ def transfers(v): comments = g.db.query(Comment).filter(Comment.author_id == AUTOJANNY_ID, Comment.parent_submission == None, Comment.body_html.like("% has transferred %")).order_by(Comment.id.desc()) - if request.headers.get("Authorization"): return {"data": [x.json for x in comments.all()]} - try: page = max(int(request.values.get("page", 1)), 1) except: page = 1 comments = comments.offset(25 * (page - 1)).limit(26).all() next_exists = len(comments) > 25 comments = comments[:25] - return render_template("transfers.html", v=v, page=page, comments=comments, standalone=True, next_exists=next_exists) + + if request.headers.get("Authorization"): + return {"data": [x.json for x in comments]} + else: + return render_template("transfers.html", v=v, page=page, comments=comments, standalone=True, next_exists=next_exists) @app.get("/kb/") @auth_desired