xvc
This commit is contained in:
parent
aa3e20a5ca
commit
dcf373ef1e
7 changed files with 66 additions and 7 deletions
|
@ -302,6 +302,12 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
|||
|
||||
def filter_emojis_only(title, edit=False, graceful=False):
|
||||
|
||||
signal.signal(signal.SIGALRM, handler)
|
||||
signal.alarm(1)
|
||||
|
||||
if title.count(':') > 100: abort(418)
|
||||
if title.count('@') > 50: abort(418)
|
||||
|
||||
title = title.replace('<','<').replace('>','>').replace("\n", "").replace("\r", "").replace("\t", "").strip()
|
||||
|
||||
title = bleach.clean(title, tags=[])
|
||||
|
@ -334,5 +340,7 @@ def filter_emojis_only(title, edit=False, graceful=False):
|
|||
if path.isfile(f'files/assets/images/emojis/{emoji}.webp'):
|
||||
title = re.sub(f'(?<!"):{old}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{old}:" title=":{old}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', title, re.I)
|
||||
|
||||
signal.alarm(0)
|
||||
|
||||
if len(title) > 1500 and not graceful: abort(400)
|
||||
else: return title
|
Loading…
Add table
Add a link
Reference in a new issue