fix retarded /transfers logic for API users

master
Aevann1 2022-09-10 02:30:25 +02:00
parent 9ad4dbeaa7
commit 216b0c33f6
1 changed files with 5 additions and 3 deletions

View File

@ -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("%</a> 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/<page>")
@auth_desired