master
Aevann1 2021-09-30 23:25:51 +02:00
parent f878557b77
commit 4a5b54ff76
1 changed files with 3 additions and 4 deletions

View File

@ -219,11 +219,10 @@ def sanitize(sanitized, noimages=False):
for i in re.finditer("^(\s+)?((:[\w]+:)+(\s+)?)+", sanitized.replace("<p>", "").replace("</p>", ""), re.MULTILINE):
emojis = i.group(0).lower()
for i in re.finditer('\w*(?<!"):([^ ]{1,30}?):', emojis):
emoji = i.group(1)
print(emoji)
for i in re.finditer('\w*(?<!"):([^ ]{1,30}?):', sanitized):
emoji = i.group(1).lower()
if path.isfile(f'./files/assets/images/emojis/{emoji}.webp'):
sanitized = sanitized.replace(f':{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" height=60 src="https://{site}/assets/images/emojis/{emoji}.webp">')
sanitized = re.sub(f'\w*(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" height=60 src="https://{site}/assets/images/emojis/{emoji}.webp">', sanitized)
try:
if emoji in session["favorite_emojis"]: session["favorite_emojis"][emoji] += 1