This commit is contained in:
Aevann1 2021-11-24 19:33:44 +02:00
parent 82ee587588
commit 499fb3671d
4 changed files with 48 additions and 9 deletions

View file

@ -104,7 +104,7 @@ def post_id(pid, anything=None, v=None):
if v and request.path.startswith('/logged_out'): v = None
if v and v.agendaposter and random.randint(1, 10) < 3:
if v and v.agendaposter and random.randint(1, 20) == 1:
if request.host == 'rdrama.net':
return redirect(random.choice(['https://secure.actblue.com/donate/ms_blm_homepage_2019','https://rdrama.net/post/19711/a-short-guide-on-how-to','https://secure.transequality.org/site/Donation2?df_id=1480']))
return redirect('https://secure.actblue.com/donate/ms_blm_homepage_2019')
@ -249,6 +249,8 @@ def edit_post(pid, v):
elif len(body) > 140: return {"error":"You have to type less than 140 characters!"}, 403
if title != p.title:
for k, l in AJ_REPLACEMENTS.items(): title = title.replace(k, l)
title = title.upper()
title_html = filter_title(title)
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html))) > 0: return {"error":"You can only type marseys!"}, 403
p.title = title
@ -257,8 +259,11 @@ def edit_post(pid, v):
if body != p.body:
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)})')
body_md = CustomRenderer().render(mistletoe.Document(body))
body_html = sanitize(body_md)
for k, l in AJ_REPLACEMENTS.items(): body = body.replace(k, l)
body = body.upper()
body_html = sanitize(CustomRenderer().render(mistletoe.Document(body)))
bans = filter_comment_html(body_html)
if bans:
@ -535,6 +540,8 @@ def submit_post(v):
title = request.values.get("title", "").strip()
url = request.values.get("url", "").strip()
for k, l in AJ_REPLACEMENTS.items(): title = title.replace(k, l)
title = title.upper()
title_html = filter_title(title)
body = request.values.get("body", "").strip()
@ -714,8 +721,10 @@ def submit_post(v):
options.append(i.group(1))
body = body.replace(i.group(0), "")
body_md = CustomRenderer().render(mistletoe.Document(body))
body_html = sanitize(body_md)
for k, l in AJ_REPLACEMENTS.items(): body = body.replace(k, l)
body = body.upper()
body_html = sanitize(CustomRenderer().render(mistletoe.Document(body)))
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 400
@ -987,7 +996,7 @@ def submit_post(v):
g.db.commit()
if v.agendaposter and random.randint(1, 10) < 7:
if v.agendaposter and random.randint(1, 10) < 4:
if request.host == 'rdrama.net':
return redirect(random.choice(['https://secure.actblue.com/donate/ms_blm_homepage_2019','https://rdrama.net/post/19711/a-short-guide-on-how-to','https://secure.transequality.org/site/Donation2?df_id=1480']))
return redirect('https://secure.actblue.com/donate/ms_blm_homepage_2019')