forked from rDrama/rDrama
1
0
Fork 0

stop submitted emojis from ending with modifiers

master
Aevann 2023-08-17 18:28:14 +03:00
parent e9b5a4eabf
commit 6bead41d68
1 changed files with 6 additions and 0 deletions

View File

@ -37,6 +37,8 @@ def submit_emojis(v):
return render_template("submit_emojis.html", v=v, emojis=emojis)
emoji_modifiers = ('pat', 'talking', 'genocide', 'heart')
@app.post("/submit/emojis")
@limiter.limit('1/second', scope=rpath)
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
@ -50,6 +52,10 @@ def submit_emoji(v):
username = request.values.get('author', '').lower().strip()
kind = request.values.get('kind', '').strip()
for modifier in emoji_modifiers:
if name.endswith(modifier):
abort(400, f'Submitted emoji names should NOT end with the word "{modifier}"')
if kind not in EMOJI_KINDS:
abort(400, "Invalid emoji kind!")