feat: add Sub2API multi-site, multi-key usage tracking - #188
Merged
Merged
Conversation
需求:集中展示 Sub2API 限额、订阅和钱包用量,每个 Key 独立管理。 实现:增加独立凭据存储及协议适配,接入卡片、托盘、告警和本地 HTTP,保护缓存生命周期与隐私边界,并同步手动 Key 贡献规则。 验证:后端 Sub2API 定向测试 28 项、前端定向测试 8 项通过,TypeScript 与 diff 检查通过。
实现思路:保留缺失指标偏好并按当前数据投影,补齐滚动额度周期,统一共享存储错误提示。补充布局恢复及预测告警回归测试。
修复思路:自动选择跳过空指标卡片,无候选时保留错误提示兜底;补充选择、禁用及过期缓存回归测试。
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pane users with Sub2API keys currently need to open each site's dashboard to inspect their usage. This adds a dedicated Sub2API provider with multiple sites and keys, with one stable card per key.
GET /v1/usagewith that key's Bearer credential. Display total and rolling key quotas, daily/weekly/monthly subscription allowances, wallet balances (including debt), expiry, and collapsible request/token/actual-cost summaries.Validation
cargo test --manifest-path src-tauri/Cargo.toml sub2api --lib: 28 passed. Windows credential ACL tests passed when rerun outside the sandbox.node scripts/sub2api-display.test.mjs: 8 passed.npx tsc --noEmit: passed.git diff --cached --check: passed before commit.Tests use local mock endpoints and temporary credentials; no live paid services were queried. Desktop layout, tray appearance, and settings interactions still need manual visual validation; screenshots are not included.