remotes/1693045480750635534/spooky-22
Aevann1 2021-10-02 02:06:10 +02:00
parent 7195fd1416
commit b1e9d798ba
1 changed files with 7 additions and 4 deletions

View File

@ -116,7 +116,7 @@ def front_all(v):
if not v and request.path == "/" and not request.headers.get("Authorization"): return redirect(f"/logged_out{request.full_path}")
if v and "logged_out" in request.full_path: v = None
if v and request.path.startswith('/logged_out'): v = None
try: page = int(request.values.get("page") or 1)
except: abort(400)
@ -208,11 +208,14 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
elif sort == "comments":
posts = posts.order_by(Submission.comment_count.desc())
posts = posts.offset(25 * (page - 1)).limit(26).all()
if v: size = v.frontsize
else: size = 25
next_exists = (len(posts) > 25)
posts = posts.offset(size * (page - 1)).limit(size+1).all()
posts = posts[:25]
next_exists = (len(posts) > size)
posts = posts[:size]
if page == 1: posts = g.db.query(Submission.id).options(lazyload('*')).filter(Submission.stickied != None).all() + posts