From 53904f0cf0ff61595e5556e046a250dd2e152fa5 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sat, 18 Jul 2026 07:01:30 -0700 Subject: add config option to skip if exceeding client count due to rate limit issues with TS6 --- app.py | 5 +++++ config.py | 1 + 2 files changed, 6 insertions(+) diff --git a/app.py b/app.py index 2b7cfea..19c8ccf 100644 --- a/app.py +++ b/app.py @@ -49,9 +49,14 @@ def fetch_teamspeak_data(cfg): client_list = clients_json.get("body") or [] + afk_threshold = cfg.get("afk_status_max_clients") + fetch_afk_status = afk_threshold is None or len(client_list) <= afk_threshold + for client in client_list: clid = client.get("clid") nickname = client.get("client_nickname") + if not fetch_afk_status: + continue if clid and nickname != "serveradmin": client_info_res = requests.get( f"{base_url}/clientinfo?clid={clid}", diff --git a/config.py b/config.py index 9aef79f..4d774a2 100644 --- a/config.py +++ b/config.py @@ -17,6 +17,7 @@ CONFIG = { "ts_domain": os.environ.get("TS_HOST", ""), # Used by the connect button "cache_time": 30, # Refresh interval in seconds (anti-spam) "cache_file": BASE_DIR / "cache.json", + "afk_status_max_clients": 3, # Skip per-client clientinfo (AFK/streaming) calls when client count exceeds this (due to potential rate limits) }, # Main design and copy -- cgit v1.2.3