forked from rDrama/rDrama
master
parent
b256e7cba5
commit
fb8ab50e45
|
@ -165,23 +165,11 @@ def api_comment(v):
|
||||||
body = request.values.get("body", "").strip()[:10000]
|
body = request.values.get("body", "").strip()[:10000]
|
||||||
|
|
||||||
if v.marseyawarded:
|
if v.marseyawarded:
|
||||||
if time.time() > v.marseyawarded:
|
marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body))
|
||||||
v.marseyawarded = None
|
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
|
||||||
g.db.add(v)
|
|
||||||
else:
|
|
||||||
marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body))
|
|
||||||
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
|
|
||||||
|
|
||||||
if v.longpost:
|
if v.longpost and len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
|
||||||
if time.time() > v.longpost:
|
elif v.bird and len(body) > 140: return {"error":"You have to type less than 140 characters!"}, 403
|
||||||
v.longpost = None
|
|
||||||
g.db.add(v)
|
|
||||||
elif len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
|
|
||||||
elif v.bird:
|
|
||||||
if time.time() > v.bird:
|
|
||||||
v.bird = None
|
|
||||||
g.db.add(v)
|
|
||||||
elif len(body) > 140: 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
|
if not body and not request.files.get('file'): return {"error":"You need to actually write something!"}, 400
|
||||||
|
|
||||||
|
@ -554,23 +542,11 @@ def edit_comment(cid, v):
|
||||||
|
|
||||||
if body != c.body or request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
|
if body != c.body or request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
|
||||||
if v.marseyawarded:
|
if v.marseyawarded:
|
||||||
if time.time() > v.marseyawarded:
|
marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body))
|
||||||
v.marseyawarded = None
|
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
|
||||||
g.db.add(v)
|
|
||||||
else:
|
|
||||||
marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body))
|
|
||||||
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
|
|
||||||
|
|
||||||
if v.longpost:
|
if v.longpost and len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
|
||||||
if time.time() > v.longpost:
|
elif v.bird and len(body) > 140: return {"error":"You have to type less than 140 characters!"}, 403
|
||||||
v.longpost = None
|
|
||||||
g.db.add(v)
|
|
||||||
elif len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
|
|
||||||
elif v.bird:
|
|
||||||
if time.time() > v.bird:
|
|
||||||
v.bird = None
|
|
||||||
g.db.add(v)
|
|
||||||
elif len(body) > 140: return {"error":"You have to type less than 140 characters!"}, 403
|
|
||||||
|
|
||||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE):
|
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE):
|
||||||
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})')
|
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})')
|
||||||
|
|
Loading…
Reference in New Issue