fd
This commit is contained in:
parent
872f5e7289
commit
81b22840cc
2 changed files with 18 additions and 28 deletions
|
@ -166,7 +166,7 @@ def api_comment(v):
|
||||||
|
|
||||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF|9999))', body, re.MULTILINE): body = body.replace(i.group(1), f'})')
|
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF|9999))', body, re.MULTILINE): body = body.replace(i.group(1), f'})')
|
||||||
body = body.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n")
|
body = body.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n")
|
||||||
with CustomRenderer(post_id=parent_id) as renderer: body_md = renderer.render(mistletoe.Document(body))
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_html = sanitize(body_md)
|
body_html = sanitize(body_md)
|
||||||
|
|
||||||
# Run safety filter
|
# Run safety filter
|
||||||
|
@ -293,8 +293,7 @@ def api_comment(v):
|
||||||
|
|
||||||
body = request.form.get("body") + f"\n"
|
body = request.form.get("body") + f"\n"
|
||||||
body = body.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n")
|
body = body.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n")
|
||||||
with CustomRenderer(post_id=parent_id) as renderer:
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_md = renderer.render(mistletoe.Document(body))
|
|
||||||
body_html = sanitize(body_md)
|
body_html = sanitize(body_md)
|
||||||
|
|
||||||
if len(body_html) > 20000: abort(400)
|
if len(body_html) > 20000: abort(400)
|
||||||
|
@ -330,7 +329,7 @@ def api_comment(v):
|
||||||
|
|
||||||
body2 = BASED_MSG.format(username=basedguy.username, basedcount=basedguy.basedcount, pills=basedguy.pills)
|
body2 = BASED_MSG.format(username=basedguy.username, basedcount=basedguy.basedcount, pills=basedguy.pills)
|
||||||
|
|
||||||
with CustomRenderer(post_id=parent_id) as renderer: body_md = renderer.render(mistletoe.Document(body2))
|
body_md = CustomRenderer().render(mistletoe.Document(body2))
|
||||||
|
|
||||||
body_based_html = sanitize(body_md)
|
body_based_html = sanitize(body_md)
|
||||||
c_aux = CommentAux(
|
c_aux = CommentAux(
|
||||||
|
@ -365,8 +364,7 @@ def api_comment(v):
|
||||||
|
|
||||||
body2 = VAXX_MSG.format(username=v.username)
|
body2 = VAXX_MSG.format(username=v.username)
|
||||||
|
|
||||||
with CustomRenderer(post_id=parent_id) as renderer:
|
body_md = CustomRenderer().render(mistletoe.Document(body2))
|
||||||
body_md = renderer.render(mistletoe.Document(body2))
|
|
||||||
|
|
||||||
body_jannied_html = sanitize(body_md)
|
body_jannied_html = sanitize(body_md)
|
||||||
c_aux = CommentAux(
|
c_aux = CommentAux(
|
||||||
|
@ -399,8 +397,7 @@ def api_comment(v):
|
||||||
|
|
||||||
body = AGENDAPOSTER_MSG.format(username=v.username)
|
body = AGENDAPOSTER_MSG.format(username=v.username)
|
||||||
|
|
||||||
with CustomRenderer(post_id=parent_id) as renderer:
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_md = renderer.render(mistletoe.Document(body))
|
|
||||||
|
|
||||||
body_jannied_html = sanitize(body_md)
|
body_jannied_html = sanitize(body_md)
|
||||||
c_aux = CommentAux(
|
c_aux = CommentAux(
|
||||||
|
@ -426,7 +423,7 @@ def api_comment(v):
|
||||||
|
|
||||||
body = random.choice(LONGPOST_REPLIES)
|
body = random.choice(LONGPOST_REPLIES)
|
||||||
body = body.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n")
|
body = body.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n")
|
||||||
with CustomRenderer(post_id=parent_id) as renderer: body_md = renderer.render(mistletoe.Document(body))
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_html2 = sanitize(body_md)
|
body_html2 = sanitize(body_md)
|
||||||
c_aux = CommentAux(
|
c_aux = CommentAux(
|
||||||
id=c2.id,
|
id=c2.id,
|
||||||
|
@ -456,7 +453,7 @@ def api_comment(v):
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
|
||||||
body = "zoz"
|
body = "zoz"
|
||||||
with CustomRenderer(post_id=parent_id) as renderer: body_md = renderer.render(mistletoe.Document(body))
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_html2 = sanitize(body_md)
|
body_html2 = sanitize(body_md)
|
||||||
c_aux = CommentAux(
|
c_aux = CommentAux(
|
||||||
id=c2.id,
|
id=c2.id,
|
||||||
|
@ -482,7 +479,7 @@ def api_comment(v):
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
|
||||||
body = "zle"
|
body = "zle"
|
||||||
with CustomRenderer(post_id=parent_id) as renderer: body_md = renderer.render(mistletoe.Document(body))
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_html2 = sanitize(body_md)
|
body_html2 = sanitize(body_md)
|
||||||
c_aux = CommentAux(
|
c_aux = CommentAux(
|
||||||
id=c3.id,
|
id=c3.id,
|
||||||
|
@ -508,7 +505,7 @@ def api_comment(v):
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
|
|
||||||
body = "zozzle"
|
body = "zozzle"
|
||||||
with CustomRenderer(post_id=parent_id) as renderer: body_md = renderer.render(mistletoe.Document(body))
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_html2 = sanitize(body_md)
|
body_html2 = sanitize(body_md)
|
||||||
c_aux = CommentAux(
|
c_aux = CommentAux(
|
||||||
id=c4.id,
|
id=c4.id,
|
||||||
|
@ -614,7 +611,7 @@ def edit_comment(cid, v):
|
||||||
body = request.form.get("body", "")[:10000]
|
body = request.form.get("body", "")[:10000]
|
||||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF|9999))', body, re.MULTILINE): body = body.replace(i.group(1), f'})')
|
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF|9999))', body, re.MULTILINE): body = body.replace(i.group(1), f'})')
|
||||||
body = body.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n")
|
body = body.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n")
|
||||||
with CustomRenderer(post_id=c.post.id) as renderer: body_md = renderer.render(mistletoe.Document(body))
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_html = sanitize(body_md)
|
body_html = sanitize(body_md)
|
||||||
|
|
||||||
bans = filter_comment_html(body_html)
|
bans = filter_comment_html(body_html)
|
||||||
|
@ -709,8 +706,7 @@ def edit_comment(cid, v):
|
||||||
else: url = upload_imgur(file=file)
|
else: url = upload_imgur(file=file)
|
||||||
|
|
||||||
body += f"\n"
|
body += f"\n"
|
||||||
with CustomRenderer(post_id=c.parent_submission) as renderer:
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_md = renderer.render(mistletoe.Document(body))
|
|
||||||
body_html = sanitize(body_md)
|
body_html = sanitize(body_md)
|
||||||
|
|
||||||
if len(body_html) > 20000: abort(400)
|
if len(body_html) > 20000: abort(400)
|
||||||
|
@ -738,8 +734,7 @@ def edit_comment(cid, v):
|
||||||
|
|
||||||
body = VAXX_MSG.format(username=v.username)
|
body = VAXX_MSG.format(username=v.username)
|
||||||
|
|
||||||
with CustomRenderer(post_id=c.parent_submission) as renderer:
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_md = renderer.render(mistletoe.Document(body))
|
|
||||||
|
|
||||||
body_jannied_html = sanitize(body_md)
|
body_jannied_html = sanitize(body_md)
|
||||||
c_aux = CommentAux(
|
c_aux = CommentAux(
|
||||||
|
@ -773,8 +768,7 @@ def edit_comment(cid, v):
|
||||||
|
|
||||||
body = AGENDAPOSTER_MSG.format(username=v.username)
|
body = AGENDAPOSTER_MSG.format(username=v.username)
|
||||||
|
|
||||||
with CustomRenderer(post_id=c.parent_submission) as renderer:
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_md = renderer.render(mistletoe.Document(body))
|
|
||||||
|
|
||||||
body_jannied_html = sanitize(body_md)
|
body_jannied_html = sanitize(body_md)
|
||||||
c_aux = CommentAux(
|
c_aux = CommentAux(
|
||||||
|
|
|
@ -318,8 +318,7 @@ def edit_post(pid, v):
|
||||||
|
|
||||||
body = VAXX_MSG.format(username=v.username)
|
body = VAXX_MSG.format(username=v.username)
|
||||||
|
|
||||||
with CustomRenderer(post_id=p.id) as renderer:
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_md = renderer.render(mistletoe.Document(body))
|
|
||||||
|
|
||||||
body_jannied_html = sanitize(body_md)
|
body_jannied_html = sanitize(body_md)
|
||||||
c_aux = CommentAux(
|
c_aux = CommentAux(
|
||||||
|
@ -355,8 +354,7 @@ def edit_post(pid, v):
|
||||||
|
|
||||||
body = AGENDAPOSTER_MSG.format(username=v.username)
|
body = AGENDAPOSTER_MSG.format(username=v.username)
|
||||||
|
|
||||||
with CustomRenderer(post_id=p.id) as renderer:
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_md = renderer.render(mistletoe.Document(body))
|
|
||||||
|
|
||||||
body_jannied_html = sanitize(body_md)
|
body_jannied_html = sanitize(body_md)
|
||||||
c_aux = CommentAux(
|
c_aux = CommentAux(
|
||||||
|
@ -989,8 +987,7 @@ def submit_post(v):
|
||||||
|
|
||||||
body = VAXX_MSG.format(username=v.username)
|
body = VAXX_MSG.format(username=v.username)
|
||||||
|
|
||||||
with CustomRenderer(post_id=new_post.id) as renderer:
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_md = renderer.render(mistletoe.Document(body))
|
|
||||||
|
|
||||||
body_jannied_html = sanitize(body_md)
|
body_jannied_html = sanitize(body_md)
|
||||||
c_aux = CommentAux(
|
c_aux = CommentAux(
|
||||||
|
@ -1026,8 +1023,7 @@ def submit_post(v):
|
||||||
|
|
||||||
body = AGENDAPOSTER_MSG.format(username=v.username)
|
body = AGENDAPOSTER_MSG.format(username=v.username)
|
||||||
|
|
||||||
with CustomRenderer(post_id=new_post.id) as renderer:
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_md = renderer.render(mistletoe.Document(body))
|
|
||||||
|
|
||||||
body_jannied_html = sanitize(body_md)
|
body_jannied_html = sanitize(body_md)
|
||||||
c_aux = CommentAux(
|
c_aux = CommentAux(
|
||||||
|
@ -1069,7 +1065,7 @@ def submit_post(v):
|
||||||
if new_post.url:
|
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)"
|
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)
|
gevent.spawn(archiveorg, new_post.url)
|
||||||
with CustomRenderer(post_id=new_post.id) as renderer: body_md = renderer.render(mistletoe.Document(body))
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_html = sanitize(body_md)
|
body_html = sanitize(body_md)
|
||||||
c_aux = CommentAux(
|
c_aux = CommentAux(
|
||||||
id=c.id,
|
id=c.id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue