master
Aevann1 2022-01-18 02:37:36 +02:00
parent 801dc09ae6
commit 7d772d0391
1 changed files with 5 additions and 5 deletions

View File

@ -202,7 +202,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False):
classes = 'emoji-md' classes = 'emoji-md'
remoji = emoji remoji = emoji
if random() < 0.01: classes += ' golden' if random() < 0.01 and 'marsey' in emoji: classes += ' golden'
if path.isfile(f'files/assets/images/emojis/{remoji}.webp'): if path.isfile(f'files/assets/images/emojis/{remoji}.webp'):
new = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{remoji}.webp" >', new, flags=re.I) new = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{remoji}.webp" >', new, flags=re.I)
@ -216,14 +216,14 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False):
if emoji.startswith("!"): if emoji.startswith("!"):
emoji = emoji[1:] emoji = emoji[1:]
classes = 'emoji mirrored' classes = 'emoji mirrored'
if random() < 0.01: classes += ' golden' if random() < 0.01 and 'marsey' in emoji: classes += ' golden'
if path.isfile(f'files/assets/images/emojis/{emoji}.webp'): if path.isfile(f'files/assets/images/emojis/{emoji}.webp'):
sanitized = re.sub(f'(?<!"):!{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":!{emoji}:" title=":!{emoji}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', sanitized, flags=re.I) sanitized = re.sub(f'(?<!"):!{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":!{emoji}:" title=":!{emoji}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', sanitized, flags=re.I)
if comment: marseys_used.add(emoji) if comment: marseys_used.add(emoji)
elif path.isfile(f'files/assets/images/emojis/{emoji}.webp'): elif path.isfile(f'files/assets/images/emojis/{emoji}.webp'):
classes = 'emoji' classes = 'emoji'
if random() < 0.01: classes += ' golden' if random() < 0.01 and 'marsey' in emoji: classes += ' golden'
sanitized = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', sanitized, flags=re.I) sanitized = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', sanitized, flags=re.I)
if comment: marseys_used.add(emoji) if comment: marseys_used.add(emoji)
@ -276,13 +276,13 @@ def filter_emojis_only(title):
if emoji.startswith("!"): if emoji.startswith("!"):
emoji = emoji[1:] emoji = emoji[1:]
classes = 'emoji mirrored' classes = 'emoji mirrored'
if random() < 0.01: classes += ' golden' if random() < 0.01 and 'marsey' in emoji: classes += ' golden'
if path.isfile(f'files/assets/images/emojis/{emoji}.webp'): if path.isfile(f'files/assets/images/emojis/{emoji}.webp'):
title = re.sub(f'(?<!"):!{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":!{emoji}:" title=":!{emoji}:" delay="0" src="/static/assets/images/emojis/{emoji}.webp" class="{classes}">', title, flags=re.I) title = re.sub(f'(?<!"):!{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":!{emoji}:" title=":!{emoji}:" delay="0" src="/static/assets/images/emojis/{emoji}.webp" class="{classes}">', title, flags=re.I)
elif path.isfile(f'files/assets/images/emojis/{emoji}.webp'): elif path.isfile(f'files/assets/images/emojis/{emoji}.webp'):
classes = 'emoji' classes = 'emoji'
if random() < 0.01: classes += ' golden' if random() < 0.01 and 'marsey' in emoji: classes += ' golden'
title = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', title, flags=re.I) title = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', title, flags=re.I)
if len(title) > 1500: abort(400) if len(title) > 1500: abort(400)