sdffsd
This commit is contained in:
parent
fe551f0700
commit
14b8fb0f6b
6 changed files with 12 additions and 27 deletions
|
@ -113,8 +113,6 @@ def send_unblock_notif(vid, user, text):
|
||||||
|
|
||||||
def send_admin(vid, text):
|
def send_admin(vid, text):
|
||||||
|
|
||||||
text = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', text)
|
|
||||||
|
|
||||||
text_html = Renderer().render(mistletoe.Document(text))
|
text_html = Renderer().render(mistletoe.Document(text))
|
||||||
|
|
||||||
text_html = sanitize(text_html, True)
|
text_html = sanitize(text_html, True)
|
||||||
|
|
|
@ -83,7 +83,7 @@ allowed_styles = ['color', 'font-weight', 'transform', '-webkit-transform']
|
||||||
|
|
||||||
def sanitize(sanitized, noimages=False):
|
def sanitize(sanitized, noimages=False):
|
||||||
|
|
||||||
sanitized = sanitized.replace("\ufeff", "").replace("m.youtube.com", "youtube.com")
|
sanitized = sanitized.replace("\ufeff", "").replace("m.youtube.com", "youtube.com").replace("𒐪","")
|
||||||
|
|
||||||
for i in re.finditer('https://i.imgur.com/(([^_]*?)\.(jpg|png|jpeg))', sanitized):
|
for i in re.finditer('https://i.imgur.com/(([^_]*?)\.(jpg|png|jpeg))', sanitized):
|
||||||
sanitized = sanitized.replace(i.group(1), i.group(2) + "_d." + i.group(3) + "?maxwidth=9999")
|
sanitized = sanitized.replace(i.group(1), i.group(2) + "_d." + i.group(3) + "?maxwidth=9999")
|
||||||
|
|
|
@ -166,7 +166,6 @@ 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'})')
|
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'})')
|
||||||
body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body)
|
|
||||||
|
|
||||||
body_md = body
|
body_md = body
|
||||||
options = []
|
options = []
|
||||||
|
@ -183,7 +182,6 @@ def api_comment(v):
|
||||||
url = request.host_url[:-1] + process_image(name)
|
url = request.host_url[:-1] + process_image(name)
|
||||||
|
|
||||||
body = request.values.get("body") + f"\n"
|
body = request.values.get("body") + f"\n"
|
||||||
body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body)
|
|
||||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_html = sanitize(body_md)
|
body_html = sanitize(body_md)
|
||||||
else:
|
else:
|
||||||
|
@ -398,7 +396,6 @@ def api_comment(v):
|
||||||
if "rama" in request.host and len(c.body) >= 1000 and "<" not in body and "</blockquote>" not in body_html:
|
if "rama" in request.host and len(c.body) >= 1000 and "<" not in body and "</blockquote>" not in body_html:
|
||||||
|
|
||||||
body = random.choice(LONGPOST_REPLIES)
|
body = random.choice(LONGPOST_REPLIES)
|
||||||
body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body)
|
|
||||||
body_md = CustomRenderer().render(mistletoe.Document(body))
|
body_md = CustomRenderer().render(mistletoe.Document(body))
|
||||||
body_html2 = sanitize(body_md)
|
body_html2 = sanitize(body_md)
|
||||||
|
|
||||||
|
|
|
@ -666,7 +666,6 @@ def submit_post(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'})')
|
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'})')
|
||||||
body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body)
|
|
||||||
|
|
||||||
options = []
|
options = []
|
||||||
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body):
|
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body):
|
||||||
|
|
|
@ -106,7 +106,6 @@ def settings_profile_post(v):
|
||||||
|
|
||||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', bio, re.MULTILINE):
|
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', bio, re.MULTILINE):
|
||||||
if "wikipedia" not in i.group(1): bio = bio.replace(i.group(1), f'})')
|
if "wikipedia" not in i.group(1): bio = bio.replace(i.group(1), f'})')
|
||||||
bio = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', bio)
|
|
||||||
|
|
||||||
if request.files.get('file'):
|
if request.files.get('file'):
|
||||||
file = request.files['file']
|
file = request.files['file']
|
||||||
|
@ -124,11 +123,6 @@ def settings_profile_post(v):
|
||||||
bio_html = sanitize(bio_html)
|
bio_html = sanitize(bio_html)
|
||||||
bans = filter_comment_html(bio_html)
|
bans = filter_comment_html(bio_html)
|
||||||
|
|
||||||
if len(bio_html) > 10000:
|
|
||||||
return render_template("settings_profile.html",
|
|
||||||
v=v,
|
|
||||||
error="Your bio is too long")
|
|
||||||
|
|
||||||
if bans:
|
if bans:
|
||||||
ban = bans[0]
|
ban = bans[0]
|
||||||
reason = f"Remove the {ban.domain} link from your bio and try again."
|
reason = f"Remove the {ban.domain} link from your bio and try again."
|
||||||
|
@ -137,7 +131,10 @@ def settings_profile_post(v):
|
||||||
|
|
||||||
return {"error": reason}, 401
|
return {"error": reason}, 401
|
||||||
|
|
||||||
if len(bio_html) > 10000: abort(400)
|
if len(bio_html) > 10000:
|
||||||
|
return render_template("settings_profile.html",
|
||||||
|
v=v,
|
||||||
|
error="Your bio is too long")
|
||||||
|
|
||||||
v.bio = bio[:1500]
|
v.bio = bio[:1500]
|
||||||
v.bio_html=bio_html
|
v.bio_html=bio_html
|
||||||
|
@ -149,20 +146,15 @@ def settings_profile_post(v):
|
||||||
|
|
||||||
|
|
||||||
if v.patron and request.values.get("sig"):
|
if v.patron and request.values.get("sig"):
|
||||||
sig = request.values.get("sig")[:1500]
|
sig = request.values.get("sig")[:200]
|
||||||
|
|
||||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', sig, re.MULTILINE):
|
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', sig, re.MULTILINE):
|
||||||
if "wikipedia" not in i.group(1): sig = sig.replace(i.group(1), f'})')
|
if "wikipedia" not in i.group(1): sig = sig.replace(i.group(1), f'})')
|
||||||
sig = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', sig)
|
|
||||||
|
|
||||||
sig_html = CustomRenderer().render(mistletoe.Document(sig))
|
sig_html = CustomRenderer().render(mistletoe.Document(sig))
|
||||||
sig_html = sanitize(sig_html)
|
sig_html = sanitize(sig_html)
|
||||||
bans = filter_comment_html(sig_html)
|
bans = filter_comment_html(sig_html)
|
||||||
|
|
||||||
if len(sig_html) > 10000:
|
|
||||||
return render_template("settings_profile.html",
|
|
||||||
v=v,
|
|
||||||
error="Your sig is too long")
|
|
||||||
|
|
||||||
if bans:
|
if bans:
|
||||||
ban = bans[0]
|
ban = bans[0]
|
||||||
|
@ -172,9 +164,12 @@ def settings_profile_post(v):
|
||||||
|
|
||||||
return {"error": reason}, 401
|
return {"error": reason}, 401
|
||||||
|
|
||||||
if len(sig_html) > 10000: abort(400)
|
if len(sig_html) > 1000:
|
||||||
|
return render_template("settings_profile.html",
|
||||||
|
v=v,
|
||||||
|
error="Your sig is too long")
|
||||||
|
|
||||||
v.sig = sig[:1500]
|
v.sig = sig[:200]
|
||||||
v.sig_html=sig_html
|
v.sig_html=sig_html
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
@ -188,7 +183,6 @@ def settings_profile_post(v):
|
||||||
|
|
||||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', bio, re.MULTILINE):
|
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', bio, re.MULTILINE):
|
||||||
if "wikipedia" not in i.group(1): bio = bio.replace(i.group(1), f'})')
|
if "wikipedia" not in i.group(1): bio = bio.replace(i.group(1), f'})')
|
||||||
bio = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', bio)
|
|
||||||
|
|
||||||
if request.files.get('file'):
|
if request.files.get('file'):
|
||||||
file = request.files['file']
|
file = request.files['file']
|
||||||
|
|
|
@ -238,8 +238,6 @@ def message2(v, username):
|
||||||
).first()
|
).first()
|
||||||
if existing: return redirect('/notifications?messages=true')
|
if existing: return redirect('/notifications?messages=true')
|
||||||
|
|
||||||
text = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', message)
|
|
||||||
|
|
||||||
text_html = Renderer().render(mistletoe.Document(text))
|
text_html = Renderer().render(mistletoe.Document(text))
|
||||||
|
|
||||||
text_html = sanitize(text_html, True)
|
text_html = sanitize(text_html, True)
|
||||||
|
@ -291,7 +289,6 @@ def messagereply(v):
|
||||||
id = int(request.values.get("parent_id"))
|
id = int(request.values.get("parent_id"))
|
||||||
parent = get_comment(id, v=v)
|
parent = get_comment(id, v=v)
|
||||||
user = parent.author
|
user = parent.author
|
||||||
message = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', message)
|
|
||||||
|
|
||||||
text_html = Renderer().render(mistletoe.Document(message))
|
text_html = Renderer().render(mistletoe.Document(message))
|
||||||
text_html = sanitize(text_html, True)
|
text_html = sanitize(text_html, True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue