From 1703a863e8c3e44660f9321da222ec8682d28fe3 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 21 Sep 2021 23:45:48 +0200 Subject: [PATCH] fsd --- files/routes/comments.py | 6 ------ files/routes/front.py | 17 ----------------- files/routes/posts.py | 21 --------------------- files/routes/settings.py | 9 --------- 4 files changed, 53 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index 1d66d52e1..c65f38982 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -279,9 +279,6 @@ def api_comment(v): if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1": file=request.files["file"] if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400 - if request.content_length > 16 * 1024 * 1024: - g.db.rollback() - abort(413) url = upload_ibb(file=file) @@ -693,9 +690,6 @@ def edit_comment(cid, v): if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1": file=request.files["file"] if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400 - if request.content_length > 16 * 1024 * 1024: - g.db.rollback() - abort(413) url = upload_ibb(file=file) diff --git a/files/routes/front.py b/files/routes/front.py index 2c6a9966f..6e3a82fe9 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -192,23 +192,6 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' secondrange = firstrange+100 posts = posts[firstrange:secondrange] - # if random.random() < 0.004: - # for post in posts: - # if post.author and post.author.shadowbanned: - # rand = random.randint(5,20) - # if post.score > rand: continue - # rand = random.randint(500,1400) - # vote = Vote(user_id=rand, - # vote_type=random.choice([-1, 1, 1, 1, 1]), - # submission_id=post.id) - # g.db.add(vote) - # try: g.db.flush() - # except: g.db.rollback() - # post.upvotes = g.db.query(Vote).options(lazyload('*')).filter_by(submission_id=post.id, vote_type=1).count() - # post.downvotes = g.db.query(Vote).options(lazyload('*')).filter_by(submission_id=post.id, vote_type=-1).count() - # post.views = post.views + random.randint(7,10) - # g.db.add(post) - next_exists = (len(posts) > 25) posts = posts[:25] diff --git a/files/routes/posts.py b/files/routes/posts.py index c178481a9..afe410986 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -193,22 +193,6 @@ def post_id(pid, anything=None, v=None): else: abort(422) - # if random.random() < 0.02: - # for comment in comments: - # if comment.author and comment.author.shadowbanned: - # rand = random.randint(5,20) - # if comment.score > rand: continue - # rand = random.randint(500,1400) - # vote = CommentVote(user_id=rand, - # vote_type=random.choice([-1, 1, 1, 1, 1]), - # comment_id=comment.id) - # g.db.add(vote) - # try: g.db.flush() - # except: g.db.rollback() - # comment.upvotes = g.db.query(CommentVote).options(lazyload('*')).filter_by(comment_id=comment.id, vote_type=1).count() - # comment.downvotes = g.db.query(CommentVote).options(lazyload('*')).filter_by(comment_id=comment.id, vote_type=-1).count() - # g.db.add(comment) - post.preloaded_comments = comments if not v or v.highlightcomments: @@ -896,11 +880,6 @@ def submit_post(v): # check for uploaded image if request.files.get('file') and request.headers.get("cf-ipcountry") != "T1": - #check file size - if request.content_length > 16 * 1024 * 1024: - g.db.rollback() - abort(413) - file = request.files['file'] #if not file.content_type.startswith('image/'): # if request.headers.get("Authorization"): return {"error": f"Image files only"}, 400 diff --git a/files/routes/settings.py b/files/routes/settings.py index 611418fdc..093a99561 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -104,10 +104,6 @@ def settings_profile_post(v): # check for uploaded image if request.files.get('file') and request.headers.get("cf-ipcountry") != "T1": - #check file size - if request.content_length > 16 * 1024 * 1024: - abort(413) - file = request.files['file'] if not file.content_type.startswith('image/'): if request.headers.get("Authorization"): return {"error": f"Image files only"}, 400 @@ -502,9 +498,6 @@ def settings_log_out_others(v): @validate_formkey def settings_images_profile(v): - if request.content_length > 16 * 1024 * 1024: - abort(413) - if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403 file = request.files["profile"] @@ -529,8 +522,6 @@ def settings_images_profile(v): @auth_required @validate_formkey def settings_images_banner(v): - if request.content_length > 16 * 1024 * 1024: - abort(413) if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403