forked from MarseyWorld/MarseyWorld
Fix ratelimit_user on 3 routes, make proper dec.
parent
24678ab7af
commit
d3f25739f0
|
@ -151,4 +151,10 @@ def ratelimit_user(limit:Union[str, Callable[[], str]]=DEFAULT_RATELIMIT_USER):
|
|||
Ratelimits based on a user. This requires at least auth_required (or stronger) to be present,
|
||||
otherwise logged out users will receive 500s
|
||||
'''
|
||||
return limiter.limit(limit, key_func=lambda:f'{SITE}-{g.v.id}')
|
||||
def inner(func):
|
||||
@functools.wraps(func)
|
||||
@limiter.limit(limit, key_func=lambda:f'{SITE}-{g.v.id}')
|
||||
def wrapped(*args, **kwargs):
|
||||
return func(*args, **kwargs)
|
||||
return wrapped
|
||||
return inner
|
||||
|
|
|
@ -120,10 +120,10 @@ def buy(v, award):
|
|||
return {"message": f"{award_title} award bought!"}
|
||||
|
||||
@app.post("/award/<thing_type>/<id>")
|
||||
@feature_required('AWARDS')
|
||||
@limiter.limit(DEFAULT_RATELIMIT_SLOWER)
|
||||
@is_not_permabanned
|
||||
@ratelimit_user()
|
||||
@feature_required('AWARDS')
|
||||
def award_thing(v, thing_type, id):
|
||||
if thing_type == 'post':
|
||||
thing = get_post(id)
|
||||
|
|
|
@ -787,10 +787,10 @@ def settings_title_change(v):
|
|||
|
||||
|
||||
@app.post("/settings/pronouns_change")
|
||||
@feature_required('PRONOUNS')
|
||||
@limiter.limit(DEFAULT_RATELIMIT_SLOWER)
|
||||
@auth_required
|
||||
@ratelimit_user()
|
||||
@feature_required('PRONOUNS')
|
||||
def settings_pronouns_change(v):
|
||||
pronouns = sanitize_settings_text(request.values.get("pronouns"))
|
||||
|
||||
|
|
|
@ -319,10 +319,10 @@ def transfer_coins(v, username):
|
|||
return transfer_currency(v, username, 'coins', True)
|
||||
|
||||
@app.post("/@<username>/transfer_bux")
|
||||
@feature_required('PROCOINS')
|
||||
@limiter.limit(DEFAULT_RATELIMIT_SLOWER)
|
||||
@is_not_permabanned
|
||||
@ratelimit_user()
|
||||
@feature_required('PROCOINS')
|
||||
def transfer_bux(v, username):
|
||||
return transfer_currency(v, username, 'procoins', False)
|
||||
|
||||
|
|
Loading…
Reference in New Issue