dffd
This commit is contained in:
parent
5964e8e29e
commit
d9f5b7eeb3
7 changed files with 33 additions and 31 deletions
|
@ -13,7 +13,7 @@ def send_notification(vid, user, text):
|
|||
with CustomRenderer() as renderer:
|
||||
text_html = renderer.render(mistletoe.Document(text))
|
||||
|
||||
text_html = sanitize(text_html, linkgen=True)
|
||||
text_html = sanitize(text_html)
|
||||
|
||||
new_comment = Comment(author_id=vid,
|
||||
parent_submission=None,
|
||||
|
@ -38,7 +38,7 @@ def send_pm(vid, user, text):
|
|||
|
||||
with CustomRenderer() as renderer: text_html = renderer.render(mistletoe.Document(text))
|
||||
|
||||
text_html = sanitize(text_html, linkgen=True)
|
||||
text_html = sanitize(text_html)
|
||||
|
||||
new_comment = Comment(author_id=vid,
|
||||
parent_submission=None,
|
||||
|
@ -61,7 +61,7 @@ def send_follow_notif(vid, user, text):
|
|||
text = text.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() as renderer: text_html = renderer.render(mistletoe.Document(text))
|
||||
text_html = sanitize(text_html, linkgen=True)
|
||||
text_html = sanitize(text_html)
|
||||
|
||||
new_comment = Comment(author_id=1046,
|
||||
parent_submission=None,
|
||||
|
@ -87,7 +87,7 @@ def send_unfollow_notif(vid, user, text):
|
|||
|
||||
with CustomRenderer() as renderer:
|
||||
text_html = renderer.render(mistletoe.Document(text))
|
||||
text_html = sanitize(text_html, linkgen=True)
|
||||
text_html = sanitize(text_html)
|
||||
|
||||
new_comment = Comment(author_id=1046,
|
||||
parent_submission=None,
|
||||
|
@ -113,7 +113,7 @@ def send_block_notif(vid, user, text):
|
|||
|
||||
with CustomRenderer() as renderer:
|
||||
text_html = renderer.render(mistletoe.Document(text))
|
||||
text_html = sanitize(text_html, linkgen=True)
|
||||
text_html = sanitize(text_html)
|
||||
|
||||
new_comment = Comment(author_id=1046,
|
||||
parent_submission=None,
|
||||
|
@ -139,7 +139,7 @@ def send_unblock_notif(vid, user, text):
|
|||
|
||||
with CustomRenderer() as renderer:
|
||||
text_html = renderer.render(mistletoe.Document(text))
|
||||
text_html = sanitize(text_html, linkgen=True)
|
||||
text_html = sanitize(text_html)
|
||||
|
||||
new_comment = Comment(author_id=1046,
|
||||
parent_submission=None,
|
||||
|
@ -165,7 +165,7 @@ def send_admin(vid, text):
|
|||
|
||||
with CustomRenderer() as renderer: text_html = renderer.render(mistletoe.Document(text))
|
||||
|
||||
text_html = sanitize(text_html, linkgen=True)
|
||||
text_html = sanitize(text_html)
|
||||
|
||||
new_comment = Comment(author_id=vid,
|
||||
parent_submission=None,
|
||||
|
|
|
@ -566,7 +566,7 @@ def admin_title_change(user_id, v):
|
|||
new_name=request.form.get("title").strip()
|
||||
|
||||
user.customtitleplain=new_name
|
||||
new_name = sanitize(new_name, linkgen=True)
|
||||
new_name = sanitize(new_name)
|
||||
|
||||
user=g.db.query(User).with_for_update().options(lazyload('*')).filter_by(id=user.id).first()
|
||||
user.customtitle=new_name
|
||||
|
@ -703,7 +703,7 @@ def ban_post(post_id, v):
|
|||
ban_reason = ban_reason.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() as renderer:
|
||||
ban_reason = renderer.render(mistletoe.Document(ban_reason))
|
||||
ban_reason = sanitize(ban_reason, linkgen=True)
|
||||
ban_reason = sanitize(ban_reason)
|
||||
|
||||
post.ban_reason = ban_reason
|
||||
|
||||
|
|
|
@ -161,7 +161,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'})')
|
||||
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_html = sanitize(body_md, linkgen=True)
|
||||
body_html = sanitize(body_md)
|
||||
|
||||
# Run safety filter
|
||||
bans = filter_comment_html(body_html)
|
||||
|
@ -284,7 +284,7 @@ def api_comment(v):
|
|||
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_html = sanitize(body_md, linkgen=True)
|
||||
body_html = sanitize(body_md)
|
||||
|
||||
c_aux = CommentAux(
|
||||
id=c.id,
|
||||
|
@ -349,7 +349,7 @@ def api_comment(v):
|
|||
body = random.choice(choices)
|
||||
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_html2 = sanitize(body_md, linkgen=True)
|
||||
body_html2 = sanitize(body_md)
|
||||
c_aux = CommentAux(
|
||||
id=c2.id,
|
||||
body_html=body_html2,
|
||||
|
@ -379,7 +379,7 @@ def api_comment(v):
|
|||
|
||||
body = "zoz"
|
||||
with CustomRenderer(post_id=parent_id) as renderer: body_md = renderer.render(mistletoe.Document(body))
|
||||
body_html2 = sanitize(body_md, linkgen=True)
|
||||
body_html2 = sanitize(body_md)
|
||||
c_aux = CommentAux(
|
||||
id=c2.id,
|
||||
body_html=body_html2,
|
||||
|
@ -405,7 +405,7 @@ def api_comment(v):
|
|||
|
||||
body = "zle"
|
||||
with CustomRenderer(post_id=parent_id) as renderer: body_md = renderer.render(mistletoe.Document(body))
|
||||
body_html2 = sanitize(body_md, linkgen=True)
|
||||
body_html2 = sanitize(body_md)
|
||||
c_aux = CommentAux(
|
||||
id=c3.id,
|
||||
body_html=body_html2,
|
||||
|
@ -431,7 +431,7 @@ def api_comment(v):
|
|||
|
||||
body = "zozzle"
|
||||
with CustomRenderer(post_id=parent_id) as renderer: body_md = renderer.render(mistletoe.Document(body))
|
||||
body_html2 = sanitize(body_md, linkgen=True)
|
||||
body_html2 = sanitize(body_md)
|
||||
c_aux = CommentAux(
|
||||
id=c4.id,
|
||||
body_html=body_html2,
|
||||
|
@ -538,7 +538,7 @@ def edit_comment(cid, 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'})')
|
||||
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_html = sanitize(body_md, linkgen=True)
|
||||
body_html = sanitize(body_md)
|
||||
|
||||
bans = filter_comment_html(body_html)
|
||||
|
||||
|
@ -632,7 +632,7 @@ def edit_comment(cid, v):
|
|||
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.parent_submission) as renderer:
|
||||
body_md = renderer.render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md, linkgen=True)
|
||||
body_html = sanitize(body_md)
|
||||
|
||||
c.body = body
|
||||
c.body_html = body_html
|
||||
|
|
|
@ -240,7 +240,7 @@ def edit_post(pid, v):
|
|||
body = request.form.get("body", "")
|
||||
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'})')
|
||||
with CustomRenderer() as renderer: body_md = renderer.render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md, linkgen=True)
|
||||
body_html = sanitize(body_md)
|
||||
|
||||
# Run safety filter
|
||||
bans = filter_comment_html(body_html)
|
||||
|
@ -708,7 +708,7 @@ def submit_post(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'})')
|
||||
with CustomRenderer() as renderer:
|
||||
body_md = renderer.render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md, linkgen=True)
|
||||
body_html = sanitize(body_md)
|
||||
|
||||
# Run safety filter
|
||||
bans = filter_comment_html(body_html)
|
||||
|
@ -902,7 +902,7 @@ def submit_post(v):
|
|||
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)
|
||||
with CustomRenderer(post_id=new_post.id) as renderer: body_md = renderer.render(mistletoe.Document(body))
|
||||
body_html = sanitize(body_md, linkgen=True)
|
||||
body_html = sanitize(body_md)
|
||||
c_aux = CommentAux(
|
||||
id=c.id,
|
||||
body_html=body_html,
|
||||
|
|
|
@ -81,7 +81,7 @@ def settings_profile_post(v):
|
|||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF|9999))', bio, re.MULTILINE): bio = bio.replace(i.group(1), f'})')
|
||||
bio = bio.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() as renderer: bio_html = renderer.render(mistletoe.Document(bio))
|
||||
bio_html = sanitize(bio_html, linkgen=True)
|
||||
bio_html = sanitize(bio_html)
|
||||
|
||||
# Run safety filter
|
||||
bans = filter_comment_html(bio_html)
|
||||
|
|
|
@ -116,7 +116,7 @@ def messagereply(v, username, id):
|
|||
if existing: return redirect('/notifications?messages=true')
|
||||
|
||||
with CustomRenderer() as renderer: text_html = renderer.render(mistletoe.Document(message))
|
||||
text_html = sanitize(text_html, linkgen=True)
|
||||
text_html = sanitize(text_html)
|
||||
parent = get_comment(int(id), v=v)
|
||||
new_comment = Comment(author_id=v.id,
|
||||
parent_submission=None,
|
||||
|
|
|
@ -386,6 +386,8 @@
|
|||
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
|
||||
{% if request.path.endswith('/admin/queue') %}
|
||||
|
||||
<div class="row no-gutters">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue