sfd
This commit is contained in:
parent
53b1a2f862
commit
6a46428d05
8 changed files with 42 additions and 42 deletions
|
@ -415,10 +415,10 @@ def edit_post(pid, v):
|
|||
if len(body) > 20000: return {"error":"Character limit is 20000!"}, 403
|
||||
|
||||
if v.marseyawarded:
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", title, flags=re.A))
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", title, re.A))
|
||||
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
|
||||
if body:
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body, flags=re.A))
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body, 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
|
||||
|
@ -428,7 +428,7 @@ def edit_post(pid, v):
|
|||
if v.agendaposter and not v.marseyawarded: title = torture_ap(title, v.username)
|
||||
|
||||
title_html = filter_emojis_only(title, edit=True)
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html, flags=re.A))): return {"error":"You can only type marseys!"}, 403
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html, re.A))): return {"error":"You can only type marseys!"}, 403
|
||||
p.title = title[:500]
|
||||
p.title_html = title_html
|
||||
|
||||
|
@ -449,13 +449,13 @@ def edit_post(pid, v):
|
|||
else: return {"error": "Image/Video files only"}, 400
|
||||
|
||||
if body != p.body:
|
||||
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)($|\s|\n))', body, re.M|re.A):
|
||||
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'})')
|
||||
|
||||
if v.agendaposter and not v.marseyawarded: body = torture_ap(body, v.username)
|
||||
|
||||
if not p.options.count():
|
||||
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body, flags=re.A):
|
||||
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body, re.A):
|
||||
body = body.replace(i.group(0), "")
|
||||
c = Comment(author_id=AUTOPOLLER_ID,
|
||||
parent_submission=p.id,
|
||||
|
@ -478,7 +478,7 @@ def edit_post(pid, v):
|
|||
return {"error": reason}, 403
|
||||
|
||||
p.body = body
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html, flags=re.A))): return {"error":"You can only type marseys!"}, 40
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html, re.A))): return {"error":"You can only type marseys!"}, 40
|
||||
|
||||
if v.longpost:
|
||||
if len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
|
||||
|
@ -769,7 +769,7 @@ def submit_post(v):
|
|||
title_html = filter_emojis_only(title)
|
||||
body = request.values.get("body", "").strip().replace('','')
|
||||
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html, flags=re.A))): return {"error":"You can only type marseys!"}, 40
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html, re.A))): return {"error":"You can only type marseys!"}, 40
|
||||
|
||||
if v.longpost:
|
||||
if len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
|
||||
|
@ -859,10 +859,10 @@ def submit_post(v):
|
|||
else: render_template("submit.html", v=v, error="500 character limit for titles.", title=title[:500], url=url, body=request.values.get("body", "")), 400
|
||||
|
||||
if v.marseyawarded:
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", title, flags=re.A))
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", title, re.A))
|
||||
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
|
||||
if body:
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body, flags=re.A))
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body, 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
|
||||
|
@ -932,17 +932,17 @@ def submit_post(v):
|
|||
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error":"2048 character limit for URLs."}, 400
|
||||
return render_template("submit.html", v=v, error="2048 character limit for URLs.", title=title, url=url,body=request.values.get("body", "")), 400
|
||||
|
||||
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)($|\s|\n))', body, re.M|re.A):
|
||||
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'})')
|
||||
|
||||
if v and v.admin_level > 2:
|
||||
bet_options = []
|
||||
for i in re.finditer('\s*\$\$\$([^\$\n]+)\$\$\$\s*', body, flags=re.A):
|
||||
for i in re.finditer('\s*\$\$\$([^\$\n]+)\$\$\$\s*', body, re.A):
|
||||
bet_options.append(i.group(1))
|
||||
body = body.replace(i.group(0), "")
|
||||
|
||||
options = []
|
||||
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body, flags=re.A):
|
||||
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body, re.A):
|
||||
options.append(i.group(1))
|
||||
body = body.replace(i.group(0), "")
|
||||
|
||||
|
@ -971,7 +971,7 @@ def submit_post(v):
|
|||
|
||||
body_html = sanitize(body)
|
||||
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html, flags=re.A))): return {"error":"You can only type marseys!"}, 400
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html, re.A))): return {"error":"You can only type marseys!"}, 400
|
||||
|
||||
if v.longpost:
|
||||
if len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue