parse usernames in new rate limiting functions

This commit is contained in:
PC-Admin 2023-08-18 17:27:56 +08:00
parent 811c6d2b35
commit 771d1b78e4

View File

@ -432,6 +432,7 @@ def list_account_pushers(preset_username):
def get_rate_limit(): def get_rate_limit():
username = input("\nPlease enter the username to get its ratelimiting: ") username = input("\nPlease enter the username to get its ratelimiting: ")
username = parse_username(username)
url = f"https://{hardcoded_variables.homeserver_url}/_synapse/admin/v1/users/@{username}:{hardcoded_variables.base_url}/override_ratelimit?access_token={hardcoded_variables.access_token}" url = f"https://{hardcoded_variables.homeserver_url}/_synapse/admin/v1/users/@{username}:{hardcoded_variables.base_url}/override_ratelimit?access_token={hardcoded_variables.access_token}"
@ -450,6 +451,7 @@ def get_rate_limit():
def set_rate_limit(): def set_rate_limit():
username = input("\nPlease enter the username to adjust its ratelimiting: ") username = input("\nPlease enter the username to adjust its ratelimiting: ")
username = parse_username(username)
messages_per_second = input("\nPlease enter the desired messages per second: ") messages_per_second = input("\nPlease enter the desired messages per second: ")
burst_count = input("\nPlease enter the desired burst count: ") burst_count = input("\nPlease enter the desired burst count: ")
@ -478,6 +480,7 @@ def set_rate_limit():
def delete_rate_limit(): def delete_rate_limit():
username = input("\nPlease enter the username to delete its ratelimiting: ") username = input("\nPlease enter the username to delete its ratelimiting: ")
username = parse_username(username)
url = f"https://{hardcoded_variables.homeserver_url}/_synapse/admin/v1/users/@{username}:{hardcoded_variables.base_url}/override_ratelimit?access_token={hardcoded_variables.access_token}" url = f"https://{hardcoded_variables.homeserver_url}/_synapse/admin/v1/users/@{username}:{hardcoded_variables.base_url}/override_ratelimit?access_token={hardcoded_variables.access_token}"