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