forked from MarseyWorld/MarseyWorld
fix retarded /transfers logic for API users
parent
9ad4dbeaa7
commit
216b0c33f6
|
@ -404,14 +404,16 @@ 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]
|
||||
|
||||
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>")
|
||||
|
|
Loading…
Reference in New Issue