big money
This commit is contained in:
parent
58a3f37241
commit
e2d4d9d016
3 changed files with 21 additions and 16 deletions
|
@ -214,8 +214,7 @@ def api_comment(v):
|
||||||
process_image(filename, 200)
|
process_image(filename, 200)
|
||||||
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/static/assets/images/badges/{badge.id}.webp"]})
|
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/static/assets/images/badges/{badge.id}.webp"]})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
return {"error": e}, 400
|
||||||
return {"error": "You didn't follow the format retard"}, 400
|
|
||||||
elif v.admin_level > 2 and parent_post.id == 37838:
|
elif v.admin_level > 2 and parent_post.id == 37838:
|
||||||
try:
|
try:
|
||||||
marsey = loads(body.lower())
|
marsey = loads(body.lower())
|
||||||
|
@ -232,8 +231,7 @@ def api_comment(v):
|
||||||
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/static/assets/images/emojis/{name}.webp"]})
|
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/static/assets/images/emojis/{name}.webp"]})
|
||||||
cache.delete_memoized(marsey_list)
|
cache.delete_memoized(marsey_list)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
return {"error": e}, 400
|
||||||
return {"error": "You didn't follow the format retard"}, 400
|
|
||||||
body += f"\n\n"
|
body += f"\n\n"
|
||||||
elif file.content_type.startswith('video/'):
|
elif file.content_type.startswith('video/'):
|
||||||
file.save("video.mp4")
|
file.save("video.mp4")
|
||||||
|
@ -568,9 +566,6 @@ def api_comment(v):
|
||||||
v.comment_count = g.db.query(Comment.id).filter(Comment.author_id == v.id, Comment.parent_submission != None).filter_by(is_banned=False, deleted_utc=0).count()
|
v.comment_count = g.db.query(Comment.id).filter(Comment.author_id == v.id, Comment.parent_submission != None).filter_by(is_banned=False, deleted_utc=0).count()
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
||||||
parent_post.comment_count += 1
|
|
||||||
g.db.add(parent_post)
|
|
||||||
|
|
||||||
c.voted = 1
|
c.voted = 1
|
||||||
|
|
||||||
if v.id == PIZZASHILL_ID:
|
if v.id == PIZZASHILL_ID:
|
||||||
|
@ -603,6 +598,10 @@ def api_comment(v):
|
||||||
treasure = Treasure(g)
|
treasure = Treasure(g)
|
||||||
treasure.check_for_treasure(body, c)
|
treasure.check_for_treasure(body, c)
|
||||||
|
|
||||||
|
if not c.slots_result and not c.blackjack_result:
|
||||||
|
parent_post.comment_count += 1
|
||||||
|
g.db.add(parent_post)
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return c.json
|
if request.headers.get("Authorization"): return c.json
|
||||||
|
|
|
@ -294,7 +294,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
||||||
|
|
||||||
if sort == "hot":
|
if sort == "hot":
|
||||||
ti = int(time.time()) + 3600
|
ti = int(time.time()) + 3600
|
||||||
posts = posts.order_by(-1000000*(Submission.realupvotes + 1)/(func.power(((ti - Submission.created_utc)/1000), 1.23)))
|
posts = posts.order_by(-1000000*(Submission.realupvotes + 1 + Submission.comment_count/5)/(func.power(((ti - Submission.created_utc)/1000), 1.23)))
|
||||||
elif sort == "new":
|
elif sort == "new":
|
||||||
posts = posts.order_by(Submission.created_utc.desc())
|
posts = posts.order_by(Submission.created_utc.desc())
|
||||||
elif sort == "old":
|
elif sort == "old":
|
||||||
|
|
|
@ -179,7 +179,9 @@ def post_id(pid, anything=None, v=None):
|
||||||
elif sort == "bottom":
|
elif sort == "bottom":
|
||||||
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
||||||
|
|
||||||
comments = [c[0] for c in comments.all()]
|
first = [c[0] for c in comments.filter(Comment.slots_result == None, Comment.blackjack_result == None).all()]
|
||||||
|
second = [c[0] for c in comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None)).all()]
|
||||||
|
comments = first + second
|
||||||
else:
|
else:
|
||||||
pinned = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.is_pinned != None).all()
|
pinned = g.db.query(Comment).filter(Comment.parent_submission == post.id, Comment.is_pinned != None).all()
|
||||||
|
|
||||||
|
@ -196,7 +198,9 @@ def post_id(pid, anything=None, v=None):
|
||||||
elif sort == "bottom":
|
elif sort == "bottom":
|
||||||
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
||||||
|
|
||||||
comments = comments.all()
|
first = comments.filter(Comment.slots_result == None, Comment.blackjack_result == None).all()
|
||||||
|
second = comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None)).all()
|
||||||
|
comments = first + second
|
||||||
|
|
||||||
offset = 0
|
offset = 0
|
||||||
|
|
||||||
|
@ -298,9 +302,10 @@ def viewmore(v, pid, sort, offset):
|
||||||
elif sort == "bottom":
|
elif sort == "bottom":
|
||||||
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
||||||
|
|
||||||
comments = comments.offset(offset)
|
first = [c[0] for c in comments.filter(Comment.slots_result == None, Comment.blackjack_result == None).all()]
|
||||||
|
second = [c[0] for c in comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None)).all()]
|
||||||
comments = [c[0] for c in comments.all()]
|
comments = first + second
|
||||||
|
comments = comments[offset:]
|
||||||
else:
|
else:
|
||||||
comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == pid, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID)), Comment.level == 1, Comment.is_pinned == None)
|
comments = g.db.query(Comment).join(User, User.id == Comment.author_id).filter(User.shadowbanned == None, Comment.parent_submission == pid, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID)), Comment.level == 1, Comment.is_pinned == None)
|
||||||
|
|
||||||
|
@ -315,9 +320,10 @@ def viewmore(v, pid, sort, offset):
|
||||||
elif sort == "bottom":
|
elif sort == "bottom":
|
||||||
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
comments = comments.order_by(Comment.upvotes - Comment.downvotes)
|
||||||
|
|
||||||
comments = comments.offset(offset)
|
first = comments.filter(Comment.slots_result == None, Comment.blackjack_result == None).all()
|
||||||
|
second = comments.filter(or_(Comment.slots_result != None, Comment.blackjack_result != None)).all()
|
||||||
comments = comments.all()
|
comments = first + second
|
||||||
|
comments = comments[offset:]
|
||||||
|
|
||||||
comments2 = []
|
comments2 = []
|
||||||
count = 0
|
count = 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue