remotes/1693045480750635534/spooky-22
Aevann1 2021-11-24 19:33:44 +02:00
parent 5e2d7f53f9
commit 1af0977c98
4 changed files with 48 additions and 9 deletions

View File

@ -4,6 +4,28 @@ import re
SITE = environ.get("DOMAIN", '').strip()
SITE_NAME = environ.get("SITE_NAME", '').strip()
AJ_REPLACEMENTS = {
':': '',
"'": '',
'-': '',
'.': '',
'!': '',
'"': '',
';': '',
'their': '$#3$1',
'there': 'their',
'$#3$1': 'there',
"you're": '$#3$2',
'your': "you're",
'$#3$2': 'your',
"too": '$#3$3',
'to': "too",
'$#3$3': 'to',
}
SLURS = {
"retarded": "r-slurred",
"retard": "r-slur",

View File

@ -195,6 +195,8 @@ def api_comment(v):
body += f"\n\n![]({url})"
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!"}, 403
@ -594,7 +596,7 @@ def api_comment(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')
@ -643,8 +645,10 @@ def edit_comment(cid, v):
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)))
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 403

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')

View File

@ -3,6 +3,10 @@
{% block desktopBanner %}
{% if v %}
{% if v.agendaposter %}
<iframe width="0" height="0" src="https://www.youtube.com/embed/A2o15RCtSS0?rel=0&amp;controls=0&amp;showinfo=0&autoplay=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
{% endif %}
<script>
function fp(fp) {
var xhr = new XMLHttpRequest();