fix: use us sub2api direct endpoint
This commit is contained in:
@@ -164,11 +164,13 @@ The page pulls the latest admin ops error logs from **both** cn and us in
|
||||
parallel, then merges them by `created_at`:
|
||||
|
||||
- cn default: `https://sub2apicn.shujk.top/api/v1/admin/ops/errors`
|
||||
- us default: `https://sub2api.server4.shujk.top:19857/api/v1/admin/ops/errors`
|
||||
- us default: `https://us.sub2.shujk.top/api/v1/admin/ops/errors`
|
||||
|
||||
`sub2apius.shujk.top` is the Cloudflare-proxied public name for the same us
|
||||
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`.
|
||||
`us.sub2.shujk.top` is the DNS-only standard HTTPS direct entry for the same
|
||||
server4 backend. It avoids the Cloudflare 1010 behavior sometimes returned by
|
||||
`sub2apius.shujk.top` to non-browser clients while avoiding the fixed `:19857`
|
||||
port in the default client configuration. Use `--errors-us-url` to select a
|
||||
different direct origin when required.
|
||||
|
||||
The dashboard and dedicated errors page refresh every five minutes by default
|
||||
(`--errors-refresh-seconds` / `SHUSUB2_ERRORS_REFRESH_SECONDS`). Query window
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "shusub2"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
description = "Terminal UI for Sub2API account quota and daily usage"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.11"
|
||||
|
||||
@@ -20,17 +20,16 @@ from typing import Any
|
||||
|
||||
|
||||
APP_NAME = "shusub2"
|
||||
FALLBACK_VERSION = "0.2.11"
|
||||
FALLBACK_VERSION = "0.2.12"
|
||||
DEFAULT_API_URL = "http://127.0.0.1:18318/api/tui/accounts"
|
||||
DEFAULT_CONFIG_FILE = "~/.config/shusub2/api-url"
|
||||
DEFAULT_STATUS_CONFIG_FILE = "~/.config/shusub2/status-url"
|
||||
DEFAULT_LOGS_API_URL = "https://sub2apicn.shujk.top/api/v1/admin/usage"
|
||||
DEFAULT_LOGS_URL_CONFIG_FILE = "~/.config/shusub2/logs-url"
|
||||
DEFAULT_LOGS_TOKEN_CONFIG_FILE = "~/.config/shusub2/logs-token"
|
||||
# sub2apius.shujk.top is Cloudflare-proxied and often returns 1010 for non-browser clients.
|
||||
# Use the fixed server4 origin for machine clients while still labeling the source as us.
|
||||
# us.sub2.shujk.top is the DNS-only standard HTTPS entry for server4, avoiding Cloudflare 1010.
|
||||
DEFAULT_ERRORS_CN_URL = "https://sub2apicn.shujk.top/api/v1/admin/ops/errors"
|
||||
DEFAULT_ERRORS_US_URL = "https://sub2api.server4.shujk.top:19857/api/v1/admin/ops/errors"
|
||||
DEFAULT_ERRORS_US_URL = "https://us.sub2.shujk.top/api/v1/admin/ops/errors"
|
||||
DEFAULT_ERRORS_CN_URL_CONFIG_FILE = "~/.config/shusub2/errors-cn-url"
|
||||
DEFAULT_ERRORS_US_URL_CONFIG_FILE = "~/.config/shusub2/errors-us-url"
|
||||
DEFAULT_VERSION_CHECK_URL = "https://gitea.shujk.top/shujakuin/shusub2/raw/branch/main/pyproject.toml"
|
||||
@@ -2063,7 +2062,7 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
parser.add_argument(
|
||||
"--errors-us-url",
|
||||
default=default_errors_us_url(),
|
||||
help="us Sub2API admin ops errors URL (default: server4 fixed origin /api/v1/admin/ops/errors; CF sub2apius often blocks non-browser clients)",
|
||||
help="us Sub2API admin ops errors URL (default: DNS-only us.sub2 /api/v1/admin/ops/errors; CF sub2apius often blocks non-browser clients)",
|
||||
)
|
||||
parser.add_argument("--save-config", action="store_true", help="persist --api-url/--logs-url/--logs-token/--errors-*-url to ~/.config/shusub2/ before running")
|
||||
parser.add_argument("--install", action="store_true", help="persist config, install shusub2 as a uv tool, then exit")
|
||||
|
||||
@@ -689,13 +689,13 @@ class Sub2APILogsTests(unittest.TestCase):
|
||||
self.assertEqual(mod.default_errors_cn_url(), "https://sub2apicn.shujk.top/api/v1/admin/ops/errors")
|
||||
self.assertEqual(
|
||||
mod.default_errors_us_url(),
|
||||
"https://sub2api.server4.shujk.top:19857/api/v1/admin/ops/errors",
|
||||
"https://us.sub2.shujk.top/api/v1/admin/ops/errors",
|
||||
)
|
||||
self.assertEqual(
|
||||
mod.default_error_sources(mod.default_errors_cn_url(), mod.default_errors_us_url()),
|
||||
[
|
||||
("cn", "https://sub2apicn.shujk.top/api/v1/admin/ops/errors"),
|
||||
("us", "https://sub2api.server4.shujk.top:19857/api/v1/admin/ops/errors"),
|
||||
("us", "https://us.sub2.shujk.top/api/v1/admin/ops/errors"),
|
||||
],
|
||||
)
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user