fsd
This commit is contained in:
parent
25d9dd0279
commit
2a70f3aa5b
4 changed files with 0 additions and 53 deletions
|
@ -279,9 +279,6 @@ def api_comment(v):
|
||||||
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
|
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
|
||||||
file=request.files["file"]
|
file=request.files["file"]
|
||||||
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
|
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)
|
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":
|
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
|
||||||
file=request.files["file"]
|
file=request.files["file"]
|
||||||
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
|
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)
|
url = upload_ibb(file=file)
|
||||||
|
|
||||||
|
|
|
@ -192,23 +192,6 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
||||||
secondrange = firstrange+100
|
secondrange = firstrange+100
|
||||||
posts = posts[firstrange:secondrange]
|
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)
|
next_exists = (len(posts) > 25)
|
||||||
|
|
||||||
posts = posts[:25]
|
posts = posts[:25]
|
||||||
|
|
|
@ -193,22 +193,6 @@ def post_id(pid, anything=None, v=None):
|
||||||
else:
|
else:
|
||||||
abort(422)
|
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
|
post.preloaded_comments = comments
|
||||||
|
|
||||||
if not v or v.highlightcomments:
|
if not v or v.highlightcomments:
|
||||||
|
@ -896,11 +880,6 @@ def submit_post(v):
|
||||||
# check for uploaded image
|
# check for uploaded image
|
||||||
if request.files.get('file') and request.headers.get("cf-ipcountry") != "T1":
|
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']
|
file = request.files['file']
|
||||||
#if not file.content_type.startswith('image/'):
|
#if not file.content_type.startswith('image/'):
|
||||||
# if request.headers.get("Authorization"): return {"error": f"Image files only"}, 400
|
# if request.headers.get("Authorization"): return {"error": f"Image files only"}, 400
|
||||||
|
|
|
@ -104,10 +104,6 @@ def settings_profile_post(v):
|
||||||
# check for uploaded image
|
# check for uploaded image
|
||||||
if request.files.get('file') and request.headers.get("cf-ipcountry") != "T1":
|
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']
|
file = request.files['file']
|
||||||
if not file.content_type.startswith('image/'):
|
if not file.content_type.startswith('image/'):
|
||||||
if request.headers.get("Authorization"): return {"error": f"Image files only"}, 400
|
if request.headers.get("Authorization"): return {"error": f"Image files only"}, 400
|
||||||
|
@ -502,9 +498,6 @@ def settings_log_out_others(v):
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def settings_images_profile(v):
|
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
|
if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403
|
||||||
|
|
||||||
file = request.files["profile"]
|
file = request.files["profile"]
|
||||||
|
@ -529,8 +522,6 @@ def settings_images_profile(v):
|
||||||
@auth_required
|
@auth_required
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def settings_images_banner(v):
|
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
|
if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue