forked from rDrama/rDrama
fdfd
parent
b04bbef5b9
commit
dca7ece444
|
@ -2,7 +2,7 @@ from drama.helpers.wrappers import *
|
|||
from drama.helpers.get import *
|
||||
from flask import g
|
||||
from drama.__main__ import app
|
||||
|
||||
from drama.helpers.sanitize import sanitize
|
||||
|
||||
@app.post("/flag/post/<pid>")
|
||||
@auth_desired
|
||||
|
@ -14,9 +14,9 @@ def api_flag_post(pid, v):
|
|||
existing = g.db.query(Flag).filter_by(
|
||||
user_id=v.id, post_id=post.id).first()
|
||||
|
||||
if existing:
|
||||
return "", 409
|
||||
reason = request.form.get("reason", "")[:100].strip()
|
||||
if existing: return "", 409
|
||||
reason = sanitize(request.form.get("reason", "")[:100].strip(), flair=True)
|
||||
|
||||
flag = Flag(post_id=post.id,
|
||||
user_id=v.id,
|
||||
reason=reason,
|
||||
|
@ -38,10 +38,8 @@ def api_flag_comment(cid, v):
|
|||
existing = g.db.query(CommentFlag).filter_by(
|
||||
user_id=v.id, comment_id=comment.id).first()
|
||||
|
||||
if existing:
|
||||
return "", 409
|
||||
|
||||
reason = request.form.get("reason", "")[:100].strip()
|
||||
if existing: return "", 409
|
||||
reason = sanitize(request.form.get("reason", "")[:100].strip(), flair=True)
|
||||
flag = CommentFlag(comment_id=comment.id,
|
||||
user_id=v.id,
|
||||
reason=reason,
|
||||
|
|
|
@ -71,8 +71,7 @@ def settings_profile_post(v):
|
|||
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF))', bio, re.MULTILINE): bio = bio.replace(i.group(1), f'![]({i.group(1)})')
|
||||
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))
|
||||
with CustomRenderer() as renderer: bio_html = renderer.render(mistletoe.Document(bio))
|
||||
bio_html = sanitize(bio_html, linkgen=True)
|
||||
|
||||
# Run safety filter
|
||||
|
|
Loading…
Reference in New Issue