feat: infer status url and check updates

This commit is contained in:
2026-06-09 16:45:17 +08:00
parent 3b9d092c06
commit 01aa4a6012
5 changed files with 123 additions and 12 deletions
+13 -6
View File
@@ -9,25 +9,23 @@ Run once from a public Git repo with `uvx`:
```bash
uvx --from git+https://gitea.shujk.top/shujakuin/shusub2.git shusub2 \
--api-url https://example.com/api/tui/accounts
--api-url https://codex.server2.shujk.top/1232131231313123/api/tui/accounts
```
Install as a user command:
```bash
uv tool install git+https://gitea.shujk.top/shujakuin/shusub2.git
shusub2 --api-url https://example.com/api/tui/accounts
shusub2 --api-url https://codex.server2.shujk.top/1232131231313123/api/tui/accounts
```
Configure default API and optional status URLs for `shusub2`:
Configure the default public API URL for `shusub2`:
```bash
mkdir -p ~/.config/shusub2
chmod 700 ~/.config/shusub2
printf '%s\n' 'https://example.com/api/tui/accounts' > ~/.config/shusub2/api-url
printf '%s\n' 'https://example.com/api/status' > ~/.config/shusub2/status-url
printf '%s\n' 'https://codex.server2.shujk.top/1232131231313123/api/tui/accounts' > ~/.config/shusub2/api-url
chmod 600 ~/.config/shusub2/api-url
chmod 600 ~/.config/shusub2/status-url
shusub2
```
@@ -38,6 +36,9 @@ Environment variables override the config file:
- `SHUSUB2_API_URL_FILE`
- `SHUSUB2_STATUS_URL`
- `SHUSUB2_STATUS_URL_FILE`
- `SHUSUB2_VERSION_CHECK_URL`
- `SHUSUB2_VERSION_CHECK_TIMEOUT`
- `SHUSUB2_NO_VERSION_CHECK`
## Local Development
@@ -64,6 +65,12 @@ The TUI reads `/api/tui/accounts` and can optionally read `sub2api-status`
`/api/status` for channel monitor health. It does not need SSH, database
access, API keys, OAuth credentials, or plaintext env files.
When `--status-url` is omitted, `shusub2` infers a sibling `/api/status` URL
from account URLs ending in `/api/tui/accounts`, so the public Codex endpoint
automatically enables monitor availability. On startup it also checks the
public Gitea repo for a newer package version and prints a short upgrade hint
when one is available.
Columns are ordered for scanning inside zellij:
```text