forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2022-01-29 02:00:05 +02:00
parent 848b22e1bf
commit d23320c1ae
1 changed files with 11 additions and 7 deletions

View File

@ -165,12 +165,13 @@ def api_comment(v):
with open(f"snappy_{SITE_NAME}.txt", "a") as f:
f.write('\n{[para]}\n' + body)
if v.marseyawarded:
if v.marseyawarded and parent_post.id not in (37696,37697,37749,37833,37838):
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body, flags=re.A))
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
if v.longpost and len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
elif v.bird and len(body) > 140: return {"error":"You have to type less than 140 characters!"}, 403
elif v.bird and len(body) > 140 and parent_post.id not in (37696,37697,37749,37833,37838):
return {"error":"You have to type less than 140 characters!"}, 403
if not body and not request.files.get('file'): return {"error":"You need to actually write something!"}, 400
@ -248,10 +249,12 @@ def api_comment(v):
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html, flags=re.A))): return {"error":"You can only type marseys!"}, 403
if v.longpost:
if len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
elif v.bird:
if len(body) > 140 : return {"error":"You have to type less than 140 characters!"}, 403
if parent_post.id not in (37696,37697,37749,37833,37838):
if v.longpost:
if len(body) < 280 or ' [](' in body or body.startswith('[]('):
return {"error":"You have to type more than 280 characters!"}, 403
elif v.bird:
if len(body) > 140 : return {"error":"You have to type less than 140 characters!"}, 403
bans = filter_comment_html(body_html)
@ -270,7 +273,8 @@ def api_comment(v):
).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
is_bot = bool(request.headers.get("Authorization"))