master
Aevann1 2021-10-09 15:49:13 +02:00
parent 3bb345680f
commit d5ddc816c4
4 changed files with 6 additions and 12 deletions

View File

@ -148,7 +148,7 @@ def api_comment(v):
if not body and not request.files.get('file'): return {"error":"You need to actually write something!"}, 400 if not body and not request.files.get('file'): return {"error":"You need to actually write something!"}, 400
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 = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body) body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body)
@ -579,7 +579,7 @@ def edit_comment(cid, v):
if c.is_banned or c.deleted_utc > 0: abort(403) if c.is_banned or c.deleted_utc > 0: abort(403)
body = request.values.get("body", "")[:10000] body = request.values.get("body", "")[:10000]
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 = CustomRenderer().render(mistletoe.Document(body)) body_md = CustomRenderer().render(mistletoe.Document(body))
body_html = sanitize(body_md) body_html = sanitize(body_md)

View File

@ -206,7 +206,7 @@ def edit_post(pid, v):
p.title_html = filter_title(title) p.title_html = filter_title(title)
if body != p.body: if body != p.body:
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 = CustomRenderer().render(mistletoe.Document(body)) body_md = CustomRenderer().render(mistletoe.Document(body))
body_html = sanitize(body_md) body_html = sanitize(body_md)
@ -665,7 +665,7 @@ def submit_post(v):
if request.headers.get("Authorization"): return {"error":"2048 character limit for URLs."}, 400 if request.headers.get("Authorization"): return {"error":"2048 character limit for URLs."}, 400
else: return render_template("submit.html", v=v, error="2048 character limit for URLs.", title=title, url=url,body=request.values.get("body", "")), 400 else: return render_template("submit.html", v=v, error="2048 character limit for URLs.", title=title, url=url,body=request.values.get("body", "")), 400
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 = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body) body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body)

View File

@ -103,7 +103,7 @@ def settings_profile_post(v):
if request.values.get("bio"): if request.values.get("bio"):
bio = request.values.get("bio")[:1500] bio = request.values.get("bio")[:1500]
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'![]({i.group(1)})') if "wikipedia" not in i.group(1): bio = bio.replace(i.group(1), f'![]({i.group(1)})')
bio = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', bio) bio = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', bio)
@ -199,6 +199,7 @@ def settings_profile_post(v):
theme = request.values.get("theme") theme = request.values.get("theme")
if theme: if theme:
v.theme = theme v.theme = theme
if theme == "win98": v.themecolor = "30409f"
updated = True updated = True
quadrant = request.values.get("quadrant") quadrant = request.values.get("quadrant")

View File

@ -366,13 +366,6 @@
} }
} }
</style> </style>
<!--[if mso]>
<style type="text/css">
.f-fallback {
font-family: Arial, sans-serif;
}
</style>
<![endif]-->
</head> </head>
<body> <body>
<span class="preheader">{% block preheader %}Thanks for joining {{'SITE_NAME' | app_config}}! Please take a sec to verify the email you used to sign up.{% endblock %}</span> <span class="preheader">{% block preheader %}Thanks for joining {{'SITE_NAME' | app_config}}! Please take a sec to verify the email you used to sign up.{% endblock %}</span>