From 447ce65c9b4b733853676e371f0c2e1655747cb3 Mon Sep 17 00:00:00 2001 From: yuez Date: Sun, 20 Sep 2026 14:52:24 +0800 Subject: [PATCH] feat(quota): All tab first in tab bar; remove header usage-alert badge (v0.4.3) - Tab order: All | Command Code | OpenCode Go (All remains the default) - Drop the global status badge in the header action row and its updateGlobalBadge aggregation; per-card chips and All-tab provider badges are unaffected --- plugin/management_test.go | 4 ++-- plugin/plugin.go | 2 +- plugin/quota_page.go | 34 +++------------------------------- 3 files changed, 6 insertions(+), 34 deletions(-) diff --git a/plugin/management_test.go b/plugin/management_test.go index 55a3395..6876be8 100644 --- a/plugin/management_test.go +++ b/plugin/management_test.go @@ -74,8 +74,8 @@ func TestHandleManagement_QuotaResource(t *testing.T) { if !strings.Contains(bodyStr, "用量配额") { t.Errorf("Body does not contain expected menu text 用量配额") } - if !strings.Contains(bodyStr, "v0.4.2") { - t.Errorf("Body does not contain version badge v0.4.2") + if !strings.Contains(bodyStr, "v0.4.3") { + t.Errorf("Body does not contain version badge v0.4.3") } } } diff --git a/plugin/plugin.go b/plugin/plugin.go index 64bddf4..292aed0 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -13,7 +13,7 @@ import ( const ( PluginID = "commandcode" PluginName = "commandcode" - PluginVersion = "0.4.2" + PluginVersion = "0.4.3" PluginAuthor = "zgs225" PluginRepo = "https://github.com/zgs225/cliproxy-plugin-commandcode" PluginLogo = "https://raw.githubusercontent.com/zgs225/cliproxy-plugin-commandcode/main/assets/logo.svg" diff --git a/plugin/quota_page.go b/plugin/quota_page.go index 4fca556..cd9dea7 100644 --- a/plugin/quota_page.go +++ b/plugin/quota_page.go @@ -918,17 +918,12 @@ const QuotaPageHTML = `
用量配额 - v0.4.2 + v0.4.3
-
- - 正在检查... -
- -
@@ -1191,8 +1186,6 @@ const QuotaPageHTML = ` const inputOpenCodeKeys = document.getElementById("inputOpenCodeKeys"); const alertBox = document.getElementById("alertBox"); const alertMsg = document.getElementById("alertMsg"); - const statusBadge = document.getElementById("statusBadge"); - const statusText = document.getElementById("statusText"); const planBadge = document.getElementById("planBadge"); // Tab sections and per-provider error cards @@ -1345,26 +1338,9 @@ const QuotaPageHTML = ` return level === "error" ? "exceeded" : level === "unknown" ? "" : level; } - function updateGlobalBadge() { - let p; - if (activeTab === "commandcode") { - p = providerState.commandcode; - } else if (activeTab === "opencode") { - p = providerState.opencode; - } else { - const a = providerState.commandcode; - const b = providerState.opencode; - p = LEVEL_RANK[a.level] >= LEVEL_RANK[b.level] ? a : b; - } - const visual = badgeVisualClass(p.level); - statusBadge.className = visual ? "status-badge " + visual : "status-badge"; - statusText.textContent = BADGE_TEXT[p.level] || "正在检查..."; - } - function setProviderStatus(provider, level) { providerState[provider].level = level; providerState[provider].err = null; - updateGlobalBadge(); } function summaryRow(label, value) { @@ -1390,7 +1366,6 @@ const QuotaPageHTML = ` ocErrorMsg.textContent = msg; ocErrorCard.classList.add("show"); } - updateGlobalBadge(); } // Multi-window countdown elements carry their reset info in data @@ -1500,7 +1475,7 @@ const QuotaPageHTML = ` weeklyTargetTime = null; } - // Per-provider status; the header badge is aggregated in updateGlobalBadge() + // Per-provider status; consumed by All tab provider badges let ccLevel; if (fiveHour.exceeded || weekly.exceeded || monthly.exceeded) { ccLevel = "exceeded"; @@ -1692,7 +1667,6 @@ const QuotaPageHTML = ` document.getElementById("sectionCommandcode").classList.toggle("active", tab === "commandcode"); document.getElementById("sectionOpencode").classList.toggle("active", tab === "opencode"); document.getElementById("sectionAll").classList.toggle("active", tab === "all"); - updateGlobalBadge(); if (updateHash) { if (tab === "all") { // All 为默认 tab:激活 All 时清掉 hash(刷新回到默认) @@ -1741,8 +1715,6 @@ const QuotaPageHTML = ` if (res.status === 401 || res.status === 403) { settingsDrawer.classList.add("open"); showAlert("需要 CLIProxyAPI 管理密钥 (401/403)。请在上方输入框填入 Management Key 并保存。", true); - statusBadge.className = "status-badge warning"; - statusText.textContent = "未授权"; return; }