feat: compress shusub2 polling

This commit is contained in:
2026-07-27 21:39:04 +08:00
parent 4d8d117fb1
commit 162ce03c4e
5 changed files with 81 additions and 31 deletions
+7 -5
View File
@@ -83,9 +83,11 @@ Environment variables override the config file:
`shusub2` opens a single dashboard with Accounts, Keys, Logs, and Errors
tables stacked vertically. Press `a`, `k`, `l`, or `e` to focus a table, `/` to
filter all four tables, and `r` to refresh all data. The two-line detail area
follows the selected row. Accounts, Keys, Logs, and Errors use green, yellow,
magenta, and red section styling respectively.
filter all four tables, and `r` to refresh all data immediately. Automatic Accounts,
Keys/Logs, and Errors refresh defaults to every five minutes. The client requests
gzip-compressed JSON and transparently decodes it when the upstream supports it.
The two-line detail area follows the selected row. Accounts, Keys, Logs, and
Errors use green, yellow, magenta, and red section styling respectively.
The dashboard sizes every column from the fetched content so wide terminals show
complete keys, accounts, and models. On a narrow terminal, a table scrolls
@@ -112,7 +114,7 @@ The middle dashboard table shows request logs, and `l` focuses it.
`shusub2 --once --logs` prints one logs snapshot to stdout.
The logs page reads the latest requests (default 100, `--logs-limit`) from the
Sub2API admin usage API and refreshes every 60 seconds by default
Sub2API admin usage API and refreshes every five minutes by default
(`--logs-refresh-seconds` / `SHUSUB2_LOGS_REFRESH_SECONDS`). Columns:
```text
@@ -168,7 +170,7 @@ parallel, then merges them by `created_at`:
backend, but Cloudflare often returns 1010 for non-browser clients, so the TUI
defaults to the fixed server4 origin while still labeling rows as `us`.
The dashboard and dedicated errors page refresh every 60 seconds by default
The dashboard and dedicated errors page refresh every five minutes by default
(`--errors-refresh-seconds` / `SHUSUB2_ERRORS_REFRESH_SECONDS`). Query window
defaults to `24h` (`--errors-time-range` / `SHUSUB2_ERRORS_TIME_RANGE`); each source uses
`page=1` and `page_size` from `--errors-limit` (default 100, max 500).