forked from MarseyWorld/MarseyWorld
dfssdf
parent
74425721a0
commit
b35c28b216
|
@ -188,9 +188,9 @@ def sanitize(sanitized, noimages=False):
|
|||
|
||||
if start in sanitized and end in sanitized and start in sanitized.split(end)[0] and end in sanitized.split(start)[1]: sanitized = sanitized.replace(start, '<span class="spoiler">').replace(end, '</span>')
|
||||
|
||||
for i in re.finditer("<p>\s*(:!?\w+:\s*)+<\/p>", sanitized):
|
||||
for i in re.finditer(">\s*(:!?\w+:\s*)+<\/", sanitized):
|
||||
old = i.group(0)
|
||||
new = old.lower().replace("<p>", "<p style='margin-bottom:0 !important'>")
|
||||
new = old.lower().replace(">", " style='margin-bottom:0 !important'>")
|
||||
for i in re.finditer('\w*(?<!"):([^ ]{1,30}?):', new):
|
||||
emoji = i.group(1).lower()
|
||||
if emoji.startswith("!"):
|
||||
|
|
|
@ -157,7 +157,7 @@ def api_comment(v):
|
|||
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)})')
|
||||
body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body)
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md)
|
||||
|
||||
# Run safety filter
|
||||
|
@ -270,7 +270,7 @@ def api_comment(v):
|
|||
|
||||
body = request.values.get("body") + f"\n![]({url})"
|
||||
body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body)
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md)
|
||||
|
||||
if len(body_html) > 20000: abort(400)
|
||||
|
@ -365,7 +365,7 @@ def api_comment(v):
|
|||
|
||||
body = AGENDAPOSTER_MSG.format(username=v.username)
|
||||
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
|
||||
body_jannied_html = sanitize(body_md)
|
||||
|
||||
|
@ -403,7 +403,7 @@ def api_comment(v):
|
|||
|
||||
body = random.choice(LONGPOST_REPLIES)
|
||||
body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body)
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
body_html2 = sanitize(body_md)
|
||||
|
||||
|
||||
|
@ -434,7 +434,7 @@ def api_comment(v):
|
|||
if "rdrama" in request.host and random.random() < 0.001 and v.username != "Snappy" and v.username != "zozbot":
|
||||
|
||||
body = "zoz"
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
body_html2 = sanitize(body_md)
|
||||
|
||||
|
||||
|
@ -462,7 +462,7 @@ def api_comment(v):
|
|||
|
||||
|
||||
body = "zle"
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
body_html2 = sanitize(body_md)
|
||||
|
||||
|
||||
|
@ -486,7 +486,7 @@ def api_comment(v):
|
|||
|
||||
|
||||
body = "zozzle"
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
body_html2 = sanitize(body_md)
|
||||
|
||||
|
||||
|
@ -597,7 +597,7 @@ def edit_comment(cid, v):
|
|||
body = request.values.get("body", "")[:10000]
|
||||
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)})')
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md)
|
||||
|
||||
bans = filter_comment_html(body_html)
|
||||
|
@ -689,7 +689,7 @@ def edit_comment(cid, v):
|
|||
url = request.host_url[:-1] + process_image(name)
|
||||
|
||||
body += f"\n![]({url})"
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md)
|
||||
|
||||
if len(body_html) > 20000: abort(400)
|
||||
|
@ -706,7 +706,7 @@ def edit_comment(cid, v):
|
|||
|
||||
body = VAXX_MSG.format(username=v.username)
|
||||
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
|
||||
body_jannied_html = sanitize(body_md)
|
||||
|
||||
|
@ -741,7 +741,7 @@ def edit_comment(cid, v):
|
|||
|
||||
body = AGENDAPOSTER_MSG.format(username=v.username)
|
||||
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
|
||||
body_jannied_html = sanitize(body_md)
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ def edit_post(pid, v):
|
|||
if body != p.body:
|
||||
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)})')
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md)
|
||||
|
||||
# Run safety filter
|
||||
|
@ -266,7 +266,7 @@ def edit_post(pid, v):
|
|||
|
||||
body = VAXX_MSG.format(username=v.username)
|
||||
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
|
||||
body_jannied_html = sanitize(body_md)
|
||||
|
||||
|
@ -300,7 +300,7 @@ def edit_post(pid, v):
|
|||
|
||||
body = AGENDAPOSTER_MSG.format(username=v.username)
|
||||
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
|
||||
body_jannied_html = sanitize(body_md)
|
||||
|
||||
|
@ -737,7 +737,7 @@ def submit_post(v):
|
|||
options.append(i.group(1))
|
||||
body = body.replace(i.group(0), "")
|
||||
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md)
|
||||
|
||||
|
||||
|
@ -905,7 +905,7 @@ def submit_post(v):
|
|||
|
||||
body = VAXX_MSG.format(username=v.username)
|
||||
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
|
||||
body_jannied_html = sanitize(body_md)
|
||||
|
||||
|
@ -939,7 +939,7 @@ def submit_post(v):
|
|||
|
||||
body = AGENDAPOSTER_MSG.format(username=v.username)
|
||||
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
|
||||
body_jannied_html = sanitize(body_md)
|
||||
|
||||
|
@ -982,7 +982,7 @@ def submit_post(v):
|
|||
if new_post.url:
|
||||
body += f"Snapshots:\n\n* [reveddit.com](https://reveddit.com/{new_post.url})\n* [archive.org](https://web.archive.org/{new_post.url})\n* [archive.ph](https://archive.ph/?url={urllib.parse.quote(new_post.url)}&run=1) (click to archive)"
|
||||
gevent.spawn(archiveorg, new_post.url)
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body)).replace("<marquee>","<marquee><p>").replace("</marquee>","</marquee></p>")
|
||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue