forked from rDrama/rDrama
sdfsfd
parent
eec5bbe256
commit
69e8a4bcd6
|
@ -167,11 +167,10 @@ def api_comment(v):
|
||||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE):
|
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)})')
|
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})')
|
||||||
|
|
||||||
body_md = body
|
|
||||||
options = []
|
options = []
|
||||||
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body_md):
|
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body):
|
||||||
options.append(i.group(1))
|
options.append(i.group(1))
|
||||||
body_md = body_md.replace(i.group(0), "")
|
body = body.replace(i.group(0), "")
|
||||||
|
|
||||||
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
|
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
|
||||||
file=request.files["file"]
|
file=request.files["file"]
|
||||||
|
@ -181,12 +180,9 @@ def api_comment(v):
|
||||||
file.save(name)
|
file.save(name)
|
||||||
url = request.host_url[:-1] + process_image(name)
|
url = request.host_url[:-1] + process_image(name)
|
||||||
|
|
||||||
body = request.values.get("body") + f"\n![]({url})"
|
body += f"\n![]({url})"
|
||||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
|
||||||
body_html = sanitize(body_md)
|
body_html = sanitize(CustomRenderer().render(mistletoe.Document(body)))
|
||||||
else:
|
|
||||||
body_md = CustomRenderer().render(mistletoe.Document(body_md))
|
|
||||||
body_html = sanitize(body_md)
|
|
||||||
|
|
||||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 403
|
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 403
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue