fdsfsdsfdrt

remotes/1693045480750635534/spooky-22
Aevann1 2021-11-24 19:49:17 +02:00
parent 1af0977c98
commit 59da262194
3 changed files with 43 additions and 14 deletions

View File

@ -24,6 +24,15 @@ AJ_REPLACEMENTS = {
"too": '$#3$3', "too": '$#3$3',
'to': "too", 'to': "too",
'$#3$3': 'to', '$#3$3': 'to',
'$#3$3': 'to',
'$#3$3': 'to',
'$#3$3': 'to',
'she': 'they',
'her': 'they',
'he': 'they',
'him': 'they',
} }
SLURS = { SLURS = {
@ -43,8 +52,8 @@ SLURS = {
"kill yourself": "keep yourself safe", "kill yourself": "keep yourself safe",
"kys": "keep yourself safe", "kys": "keep yourself safe",
"kyle": "Kylie", "kyle": "Kylie",
"nig": "I LOVE BIG BLACK COCK IN MY BUSSY", "nig": "πŸ€",
"nigger": "I LOVE BIG BLACK COCK IN MY BUSSY", "nigger": "πŸ€",
"rapist": "male feminist", "rapist": "male feminist",
"steve akins": "penny verity oaken", "steve akins": "penny verity oaken",
"trannie": "πŸš‚πŸšƒπŸšƒ", "trannie": "πŸš‚πŸšƒπŸšƒ",
@ -181,6 +190,9 @@ def censor_slurs(body: str, logged_user) -> str:
if not logged_user or logged_user.slurreplacer: body = SLUR_REGEX.sub(sub_matcher, body) if not logged_user or logged_user.slurreplacer: body = SLUR_REGEX.sub(sub_matcher, body)
return body return body
def censor_slurs2(body: str) -> str:
return SLUR_REGEX.sub(sub_matcher, body)
BADGES = { BADGES = {
1: { 1: {
'name': 'Alpha User', 'name': 'Alpha User',

View File

@ -195,8 +195,11 @@ def api_comment(v):
body += f"\n\n![]({url})" body += f"\n\n![]({url})"
for k, l in AJ_REPLACEMENTS.items(): body = body.replace(k, l) if v.agendaposter:
body = body.upper() for k, l in AJ_REPLACEMENTS.items(): body = body.replace(k, l)
body = body.replace('I ', f'@{v.username}')
body = censor_slurs2(body).upper().replace(' ME ', f'@{v.username}')
body_html = sanitize(CustomRenderer().render(mistletoe.Document(body))) 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 if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 403
@ -646,8 +649,11 @@ 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): 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)})')
for k, l in AJ_REPLACEMENTS.items(): body = body.replace(k, l) if v.agendaposter:
body = body.upper() for k, l in AJ_REPLACEMENTS.items(): body = body.replace(k, l)
body = body.replace('I ', f'@{v.username}')
body = censor_slurs2(body).upper().replace(' ME ', f'@{v.username}')
body_html = sanitize(CustomRenderer().render(mistletoe.Document(body))) 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 if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 403

View File

@ -249,8 +249,11 @@ def edit_post(pid, v):
elif len(body) > 140: return {"error":"You have to type less than 140 characters!"}, 403 elif len(body) > 140: return {"error":"You have to type less than 140 characters!"}, 403
if title != p.title: if title != p.title:
for k, l in AJ_REPLACEMENTS.items(): title = title.replace(k, l) if v.agendaposter:
title = title.upper() for k, l in AJ_REPLACEMENTS.items(): title = title.replace(k, l)
title = title.replace('I ', f'@{v.username}')
title = censor_slurs2(title).upper().replace(' ME ', f'@{v.username}')
title_html = filter_title(title) 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 if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html))) > 0: return {"error":"You can only type marseys!"}, 403
p.title = title p.title = title
@ -260,8 +263,10 @@ def edit_post(pid, 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)})')
for k, l in AJ_REPLACEMENTS.items(): body = body.replace(k, l) if v.agendaposter:
body = body.upper() for k, l in AJ_REPLACEMENTS.items(): body = body.replace(k, l)
body = body.replace('I ', f'@{v.username}')
body = censor_slurs2(body).upper().replace(' ME ', f'@{v.username}')
body_html = sanitize(CustomRenderer().render(mistletoe.Document(body))) body_html = sanitize(CustomRenderer().render(mistletoe.Document(body)))
@ -540,8 +545,12 @@ def submit_post(v):
title = request.values.get("title", "").strip() title = request.values.get("title", "").strip()
url = request.values.get("url", "").strip() url = request.values.get("url", "").strip()
for k, l in AJ_REPLACEMENTS.items(): title = title.replace(k, l)
title = title.upper() if v.agendaposter:
for k, l in AJ_REPLACEMENTS.items(): title = title.replace(k, l)
title = title.replace('I ', f'@{v.username}')
title = censor_slurs2(title).upper().replace(' ME ', f'@{v.username}')
title_html = filter_title(title) title_html = filter_title(title)
body = request.values.get("body", "").strip() body = request.values.get("body", "").strip()
@ -721,8 +730,10 @@ def submit_post(v):
options.append(i.group(1)) options.append(i.group(1))
body = body.replace(i.group(0), "") body = body.replace(i.group(0), "")
for k, l in AJ_REPLACEMENTS.items(): body = body.replace(k, l) if v.agendaposter:
body = body.upper() for k, l in AJ_REPLACEMENTS.items(): body = body.replace(k, l)
body = body.replace('I ', f'@{v.username}')
body = censor_slurs2(body).upper().replace(' ME ', f'@{v.username}')
body_html = sanitize(CustomRenderer().render(mistletoe.Document(body))) body_html = sanitize(CustomRenderer().render(mistletoe.Document(body)))