mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Fix selecting channel/guild in ratelimit
This commit is contained in:
parent
49a42c6b11
commit
ca770f3261
@ -37,19 +37,19 @@ def make_guilds_cache_key():
|
|||||||
return (sess + ip + "user_guilds").encode('utf-8')
|
return (sess + ip + "user_guilds").encode('utf-8')
|
||||||
|
|
||||||
def make_guildchannels_cache_key():
|
def make_guildchannels_cache_key():
|
||||||
guild_id = request.args.get('guild_id', "0")
|
guild_id = request.values.get('guild_id', "0")
|
||||||
sess = generate_session_key()
|
sess = generate_session_key()
|
||||||
ip = get_client_ipaddr()
|
ip = get_client_ipaddr()
|
||||||
return (sess + ip + guild_id + "user_guild_channels").encode('utf-8')
|
return (sess + ip + guild_id + "user_guild_channels").encode('utf-8')
|
||||||
|
|
||||||
def channel_ratelimit_key(): # Generate a bucket with given channel & unique session key
|
def channel_ratelimit_key(): # Generate a bucket with given channel & unique session key
|
||||||
sess = generate_session_key()
|
sess = generate_session_key()
|
||||||
channel_id = request.args.get('channel_id', "0")
|
channel_id = request.values.get('channel_id', "0")
|
||||||
return (sess + channel_id).encode('utf-8')
|
return (sess + channel_id).encode('utf-8')
|
||||||
|
|
||||||
def guild_ratelimit_key():
|
def guild_ratelimit_key():
|
||||||
sess = generate_session_key()
|
sess = generate_session_key()
|
||||||
guild_id = request.args.get('guild_id', "0")
|
guild_id = request.values.get('guild_id', "0")
|
||||||
return (sess + guild_id).encode('utf-8')
|
return (sess + guild_id).encode('utf-8')
|
||||||
|
|
||||||
def check_guild_existance(guild_id):
|
def check_guild_existance(guild_id):
|
||||||
@ -62,5 +62,5 @@ def check_guild_existance(guild_id):
|
|||||||
def guild_query_unauth_users_bool(guild_id):
|
def guild_query_unauth_users_bool(guild_id):
|
||||||
dbGuild = db.session.query(Guilds).filter(Guilds.guild_id==guild_id).first()
|
dbGuild = db.session.query(Guilds).filter(Guilds.guild_id==guild_id).first()
|
||||||
return dbGuild.unauth_users
|
return dbGuild.unauth_users
|
||||||
|
|
||||||
rate_limiter = Limiter(key_func=get_client_ipaddr) # Default limit by ip address
|
rate_limiter = Limiter(key_func=get_client_ipaddr) # Default limit by ip address
|
||||||
|
Loading…
Reference in New Issue
Block a user