From b84c072b39474ced3be58190916936b1c75202de Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 3 Dec 2021 22:51:16 +0200 Subject: [PATCH] sdffds --- files/helpers/sanitize.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index fd1fb1132..91f4f4853 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -165,26 +165,28 @@ def sanitize(sanitized, noimages=False): if start in sanitized and end in sanitized and start in sanitized.split(end)[0] and end in sanitized.split(start)[1]: sanitized = sanitized.replace(start, '').replace(end, '') - for i in re.finditer("[^a]>\s*(:!?\w+:\s*)+<\/", sanitized): + for i in re.finditer("[^a]>\s*(:[!#]?\w+:\s*)+<\/", sanitized): old = i.group(0) if 'marseylong1' in old or 'marseylong2' in old or 'marseyllama1' in old or 'marseyllama2' in old: new = old.lower().replace(">", " class='mb-0'>") else: new = old.lower() for i in re.finditer('(?', new) - - if emoji in session["favorite_emojis"]: session["favorite_emojis"][emoji] += 1 - else: session["favorite_emojis"][emoji] = 1 + classes = "bigemoji mirrored" + remoji = emoji[1:] + elif emoji.startswith("#"): + classes = "" + remoji = emoji[1:] + else: + classes = "bigemoji" + remoji = emoji + + if path.isfile(f'./files/assets/images/emojis/{remoji}.webp'): + new = re.sub(f'(?', new) - elif path.isfile(f'./files/assets/images/emojis/{emoji}.webp'): - new = re.sub(f'(?', new) - if emoji in session["favorite_emojis"]: session["favorite_emojis"][emoji] += 1 else: session["favorite_emojis"][emoji] = 1 - + sanitized = sanitized.replace(old, new)