forked from rDrama/rDrama
fds
parent
9c9b600afe
commit
78530d6d17
|
@ -44,13 +44,12 @@ SLURS = {
|
||||||
" pedo": "libertarian",
|
" pedo": "libertarian",
|
||||||
"kill yourself": "keep yourself safe",
|
"kill yourself": "keep yourself safe",
|
||||||
" kys ": "keep yourself safe",
|
" kys ": "keep yourself safe",
|
||||||
"kyle": "Kylie",
|
|
||||||
"n1g": "BIPOC",
|
|
||||||
"nlg": "BIPOC",
|
|
||||||
"nig": "BIPOC",
|
|
||||||
"n1gger": "BIPOC",
|
"n1gger": "BIPOC",
|
||||||
"nlgger": "BIPOC",
|
"nlgger": "BIPOC",
|
||||||
"nigger": "BIPOC",
|
"nigger": "BIPOC",
|
||||||
|
" n1g ": "BIPOC",
|
||||||
|
" nlg ": "BIPOC",
|
||||||
|
" nig ": "BIPOC",
|
||||||
" rapist": "male feminist",
|
" rapist": "male feminist",
|
||||||
"steve akins": "penny verity oaken",
|
"steve akins": "penny verity oaken",
|
||||||
"trannie": "πππ",
|
"trannie": "πππ",
|
||||||
|
@ -101,8 +100,7 @@ SLURS = {
|
||||||
"kung flu": "SARS-CoV-2 syndemic",
|
"kung flu": "SARS-CoV-2 syndemic",
|
||||||
"elon musk": "rocket daddy",
|
"elon musk": "rocket daddy",
|
||||||
" elon ": " rocket daddy ",
|
" elon ": " rocket daddy ",
|
||||||
"fake and gay": "fake and straight",
|
"fake and gay": "fake and straight"
|
||||||
'<img loading="lazy" data-bs-toggle="tooltip" alt=":n:" title=":n:" class="emoji-md" src="/e/n.webp"> <img loading="lazy" data-bs-toggle="tooltip" alt=":i:" title=":i:" class="emoji-md" src="/e/i.webp"><img loading="lazy" data-bs-toggle="tooltip" alt=":g:" title=":g:" class="emoji-md" src="/e/g.webp"><img loading="lazy" data-bs-toggle="tooltip" alt=":g:" title=":g:" class="emoji-md" src="/e/g.webp"><img loading="lazy" data-bs-toggle="tooltip" alt=":e:" title=":e:" class="emoji-md" src="/e/e.webp"><img loading="lazy" data-bs-toggle="tooltip" alt=":r:" title=":r:" class="emoji-md" src="/e/r.webp">':'<img loading="lazy" data-bs-toggle="tooltip" alt=":b:" title=":b:" class="emoji-md" src="/e/b.webp"> <img loading="lazy" data-bs-toggle="tooltip" alt=":i:" title=":i:" class="emoji-md" src="/e/i.webp"><img loading="lazy" data-bs-toggle="tooltip" alt=":p:" title=":p:" class="emoji-md" src="/e/p.webp"><img loading="lazy" data-bs-toggle="tooltip" alt=":o:" title=":o:" class="emoji-md" src="/e/o.webp"><img loading="lazy" data-bs-toggle="tooltip" alt=":c:" title=":c:" class="emoji-md" src="/e/c.webp">'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
single_words = "|".join([slur.lower() for slur in SLURS.keys()])
|
single_words = "|".join([slur.lower() for slur in SLURS.keys()])
|
||||||
|
@ -734,8 +732,8 @@ email_regex = re.compile('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|
|
||||||
utm_regex = re.compile('utm_[a-z]+=[a-z0-9_]+&', flags=re.A)
|
utm_regex = re.compile('utm_[a-z]+=[a-z0-9_]+&', flags=re.A)
|
||||||
utm_regex2 = re.compile('[?&]utm_[a-z]+=[a-z0-9_]+', flags=re.A)
|
utm_regex2 = re.compile('[?&]utm_[a-z]+=[a-z0-9_]+', flags=re.A)
|
||||||
|
|
||||||
slur_regex = re.compile(rf"((?<=\s|>)|^)({single_words})((?=[\s<,.$]|s[\s<,.$]))", flags=re.I|re.A)
|
slur_regex = re.compile(f"(?<! href=[^>]{0,255})({single_words})", flags=re.I|re.A)
|
||||||
slur_regex_upper = re.compile(rf"((?<=\s|>)|^)({single_words.upper()})((?=[\s<,.$]|S[\s<,.$]))", flags=re.A)
|
slur_regex_upper = re.compile(f"(?<! href=[^>]{0,255})({single_words.upper()})", flags=re.A)
|
||||||
torture_regex = re.compile('(^|\s)(i|me) ', flags=re.I|re.A)
|
torture_regex = re.compile('(^|\s)(i|me) ', flags=re.I|re.A)
|
||||||
torture_regex2 = re.compile("(^|\s)i'm ", flags=re.I|re.A)
|
torture_regex2 = re.compile("(^|\s)i'm ", flags=re.I|re.A)
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
||||||
|
|
||||||
u = get_user(i.group(1), graceful=True)
|
u = get_user(i.group(1), graceful=True)
|
||||||
if u:
|
if u:
|
||||||
sanitized = sanitized.replace(i.group(0), f'''<p><a href="/id/{u.id}"><img loading="lazy" src="/pp/{u.id}">@{u.username}</a>''', 1)
|
sanitized = sanitized.replace(i.group(0), f'''<p><a href="/id/{u.id}"><img loading="lazy" src="/pp/{u.id}">@{u.username}</a>''')
|
||||||
else:
|
else:
|
||||||
sanitized = reddit_regex.sub(r'\1<a href="https://old.reddit.com/\2" rel="nofollow noopener noreferrer">/\2</a>', sanitized)
|
sanitized = reddit_regex.sub(r'\1<a href="https://old.reddit.com/\2" rel="nofollow noopener noreferrer">/\2</a>', sanitized)
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
||||||
if noimages:
|
if noimages:
|
||||||
sanitized = sanitized.replace(i.group(0), f'{i.group(1)}<a href="/id/{u.id}">@{u.username}</a>', 1)
|
sanitized = sanitized.replace(i.group(0), f'{i.group(1)}<a href="/id/{u.id}">@{u.username}</a>', 1)
|
||||||
else:
|
else:
|
||||||
sanitized = sanitized.replace(i.group(0), f'''{i.group(1)}<a href="/id/{u.id}"><img loading="lazy" src="/pp/{u.id}">@{u.username}</a>''', 1)
|
sanitized = sanitized.replace(i.group(0), f'''{i.group(1)}<a href="/id/{u.id}"><img loading="lazy" src="/pp/{u.id}">@{u.username}</a>''')
|
||||||
|
|
||||||
|
|
||||||
sanitized = imgur_regex.sub(r'\1_d.webp?maxwidth=9999&fidelity=high', sanitized)
|
sanitized = imgur_regex.sub(r'\1_d.webp?maxwidth=9999&fidelity=high', sanitized)
|
||||||
|
|
Loadingβ¦
Reference in New Issue