vcxvxc
This commit is contained in:
parent
f59d4e6f11
commit
bdc1745e37
3 changed files with 11 additions and 11 deletions
|
@ -116,12 +116,11 @@ def after_request(response):
|
||||||
response.headers.add("X-Frame-Options", "deny")
|
response.headers.add("X-Frame-Options", "deny")
|
||||||
return response
|
return response
|
||||||
|
|
||||||
if not cache.get("marseys"):
|
with open("marseys.json", 'r') as f: cache.set("marseys", loads(f.read()))
|
||||||
with open("marseys.json", 'r') as f: cache.set("marseys", loads(f.read()))
|
|
||||||
|
|
||||||
from files.routes import *
|
from files.routes import *
|
||||||
|
|
||||||
def close_running_threads():
|
def close_running_threads():
|
||||||
with open('marsey_count.json', 'w') as f: dump(cache.get("marseys"), f)
|
with open('marseys.json', 'w') as f: dump(cache.get("marseys"), f)
|
||||||
stdout.flush()
|
stdout.flush()
|
||||||
atexit.register(close_running_threads)
|
atexit.register(close_running_threads)
|
|
@ -263,7 +263,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
||||||
if comment:
|
if comment:
|
||||||
for emoji in marseys_used:
|
for emoji in marseys_used:
|
||||||
if emoji in marsey_count: marsey_count[emoji]["count"] += 1
|
if emoji in marsey_count: marsey_count[emoji]["count"] += 1
|
||||||
marsey_count = cache.set("marseys", marsey_count)
|
cache.set("marseys", marsey_count)
|
||||||
|
|
||||||
return sanitized
|
return sanitized
|
||||||
|
|
||||||
|
|
|
@ -241,13 +241,14 @@ def api_comment(v):
|
||||||
if ban.reason: reason += f" {ban.reason}"
|
if ban.reason: reason += f" {ban.reason}"
|
||||||
return {"error": reason}, 401
|
return {"error": reason}, 401
|
||||||
|
|
||||||
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
|
if parent_post.id not in (37696,37697,37749,37833,37838):
|
||||||
Comment.deleted_utc == 0,
|
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
|
||||||
Comment.parent_comment_id == parent_comment_id,
|
Comment.deleted_utc == 0,
|
||||||
Comment.parent_submission == parent_submission,
|
Comment.parent_comment_id == parent_comment_id,
|
||||||
Comment.body_html == body_html
|
Comment.parent_submission == parent_submission,
|
||||||
).one_or_none()
|
Comment.body_html == body_html
|
||||||
if existing: return {"error": f"You already made that comment: /comment/{existing.id}"}, 409
|
).one_or_none()
|
||||||
|
if existing: return {"error": f"You already made that comment: /comment/{existing.id}"}, 409
|
||||||
|
|
||||||
if parent.author.any_block_exists(v) and v.admin_level < 2: return {"error": "You can't reply to users who have blocked you, or users you have blocked."}, 403
|
if parent.author.any_block_exists(v) and v.admin_level < 2: return {"error": "You can't reply to users who have blocked you, or users you have blocked."}, 403
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue