From 1f5fa278d0a1a26fb2f17ddb9ee7634b3d934155 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 17 Apr 2022 11:23:42 +0200 Subject: [PATCH] fsd --- files/routes/admin.py | 9 ++++++--- files/routes/feeds.py | 3 ++- files/routes/front.py | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index c56f0779b..39a3768b4 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -712,7 +712,8 @@ def badge_remove_post(v): @admin_level_required(2) def users_list(v): - page = int(request.values.get("page", 1)) + try: page = int(request.values.get("page", 1)) + except: page = 1 users = g.db.query(User).filter_by(is_banned=0 ).order_by(User.created_utc.desc() @@ -868,7 +869,8 @@ def admin_link_accounts(v): @admin_level_required(2) def admin_removed(v): - page = int(request.values.get("page", 1)) + try: page = int(request.values.get("page", 1)) + except: page = 1 if page < 1: abort(400) @@ -894,7 +896,8 @@ def admin_removed(v): @admin_level_required(2) def admin_removed_comments(v): - page = int(request.values.get("page", 1)) + try: page = int(request.values.get("page", 1)) + except: page = 1 ids = g.db.query(Comment.id).join(User, User.id == Comment.author_id).filter(or_(Comment.is_banned==True, User.shadowbanned != None)).order_by(Comment.id.desc()).offset(25 * (page - 1)).limit(26).all() diff --git a/files/routes/feeds.py b/files/routes/feeds.py index 9a44350d2..4fa4e2c34 100644 --- a/files/routes/feeds.py +++ b/files/routes/feeds.py @@ -12,7 +12,8 @@ from files.__main__ import app @auth_required def feeds_user(v=None, sort='hot', t='all'): - page = int(request.values.get("page", 1)) + try: page = int(request.values.get("page", 1)) + except: page = 1 ids, next_exists = frontlist( sort=sort, diff --git a/files/routes/front.py b/files/routes/front.py index edf338c47..cd3a1cef5 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -515,7 +515,8 @@ def random_post(v): def all_comments(v): - page = int(request.values.get("page", 1)) + try: page = int(request.values.get("page", 1)) + except: page = 1 sort=request.values.get("sort", "new") t=request.values.get("t", defaulttimefilter) @@ -603,7 +604,8 @@ def transfers(v): if request.headers.get("Authorization"): return {"data": [x.json for x in comments.all()]} - page = int(request.values.get("page", 1)) + try: page = int(request.values.get("page", 1)) + except: page = 1 comments = comments.offset(25 * (page - 1)).limit(26).all() next_exists = len(comments) > 25 comments = comments[:25]