mirror of
https://github.com/zgs225/cliproxy-plugin-commandcode.git
synced 2026-09-26 11:42:48 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
016929f9a7 |
@@ -0,0 +1 @@
|
|||||||
|
7830fab0eb763247602fd4815549a13eeb25841afbe2d3a047d25b9f4b9cf86d commandcode_0.2.2_linux_amd64.zip
|
||||||
Binary file not shown.
+1
-1
@@ -13,7 +13,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
PluginID = "commandcode"
|
PluginID = "commandcode"
|
||||||
PluginName = "commandcode"
|
PluginName = "commandcode"
|
||||||
PluginVersion = "0.2.1"
|
PluginVersion = "0.2.2"
|
||||||
PluginAuthor = "zgs225"
|
PluginAuthor = "zgs225"
|
||||||
PluginRepo = "https://github.com/zgs225/cliproxy-plugin-commandcode"
|
PluginRepo = "https://github.com/zgs225/cliproxy-plugin-commandcode"
|
||||||
PluginLogo = "https://raw.githubusercontent.com/zgs225/cliproxy-plugin-commandcode/main/assets/logo.svg"
|
PluginLogo = "https://raw.githubusercontent.com/zgs225/cliproxy-plugin-commandcode/main/assets/logo.svg"
|
||||||
|
|||||||
+22
-16
@@ -663,7 +663,7 @@ const QuotaPageHTML = `<!DOCTYPE html>
|
|||||||
<div>
|
<div>
|
||||||
<div class="brand-title">
|
<div class="brand-title">
|
||||||
Command Code 配额
|
Command Code 配额
|
||||||
<span class="version-tag">v0.2.1</span>
|
<span class="version-tag">v0.2.2</span>
|
||||||
<span id="planBadge" class="plan-tag" style="display:none;">Plan: -</span>
|
<span id="planBadge" class="plan-tag" style="display:none;">Plan: -</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="brand-subtitle">CLIProxyAPI 实时限额与 Credits 用量监控</div>
|
<div class="brand-subtitle">CLIProxyAPI 实时限额与 Credits 用量监控</div>
|
||||||
@@ -932,9 +932,15 @@ const QuotaPageHTML = `<!DOCTYPE html>
|
|||||||
alertBox.className = "alert";
|
alertBox.className = "alert";
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatNumber(num) {
|
// Command Code 额度按美元(USD)计价:金额统一加 $ 前缀,按美元格式输出(千分位 + 两位小数)
|
||||||
if (num === null || num === undefined || isNaN(num)) return "0";
|
function formatUSD(num) {
|
||||||
return Number(num).toLocaleString(undefined, { maximumFractionDigits: 2 });
|
if (num === null || num === undefined || isNaN(num)) return "$0.00";
|
||||||
|
return Number(num).toLocaleString("en-US", {
|
||||||
|
style: "currency",
|
||||||
|
currency: "USD",
|
||||||
|
minimumFractionDigits: 2,
|
||||||
|
maximumFractionDigits: 2
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatCountdown(targetDate) {
|
function formatCountdown(targetDate) {
|
||||||
@@ -987,17 +993,17 @@ const QuotaPageHTML = `<!DOCTYPE html>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Credits
|
// Credits
|
||||||
valMonthlyCredits.textContent = formatNumber(credits.monthly_credits);
|
valMonthlyCredits.textContent = formatUSD(credits.monthly_credits);
|
||||||
valOpensourceCredits.textContent = formatNumber(credits.opensource_monthly_credits);
|
valOpensourceCredits.textContent = formatUSD(credits.opensource_monthly_credits);
|
||||||
valTotalCredits.textContent = formatNumber(credits.total_credits);
|
valTotalCredits.textContent = formatUSD(credits.total_credits);
|
||||||
|
|
||||||
// Monthly (billing period)
|
// Monthly (billing period)
|
||||||
const monthly = limits.monthly || {};
|
const monthly = limits.monthly || {};
|
||||||
const pMonth = Math.min(100, Math.max(0, monthly.percentage || 0));
|
const pMonth = Math.min(100, Math.max(0, monthly.percentage || 0));
|
||||||
badgeMonthly.textContent = pMonth.toFixed(1) + "%";
|
badgeMonthly.textContent = pMonth.toFixed(1) + "%";
|
||||||
usedMonthly.textContent = formatNumber(monthly.used);
|
usedMonthly.textContent = formatUSD(monthly.used);
|
||||||
capMonthly.textContent = "/ " + formatNumber(monthly.cap);
|
capMonthly.textContent = "/ " + formatUSD(monthly.cap);
|
||||||
remainMonthly.textContent = formatNumber(monthly.remaining);
|
remainMonthly.textContent = formatUSD(monthly.remaining);
|
||||||
barMonthly.style.width = pMonth + "%";
|
barMonthly.style.width = pMonth + "%";
|
||||||
|
|
||||||
barMonthly.className = "progress-bar" + (pMonth >= 90 || monthly.exceeded ? " danger" : pMonth >= 70 ? " warning" : "");
|
barMonthly.className = "progress-bar" + (pMonth >= 90 || monthly.exceeded ? " danger" : pMonth >= 70 ? " warning" : "");
|
||||||
@@ -1009,9 +1015,9 @@ const QuotaPageHTML = `<!DOCTYPE html>
|
|||||||
const fiveHour = limits.five_hour || {};
|
const fiveHour = limits.five_hour || {};
|
||||||
const pFive = Math.min(100, Math.max(0, fiveHour.percentage || 0));
|
const pFive = Math.min(100, Math.max(0, fiveHour.percentage || 0));
|
||||||
badgeFiveHour.textContent = pFive.toFixed(1) + "%";
|
badgeFiveHour.textContent = pFive.toFixed(1) + "%";
|
||||||
usedFiveHour.textContent = formatNumber(fiveHour.used);
|
usedFiveHour.textContent = formatUSD(fiveHour.used);
|
||||||
capFiveHour.textContent = "/ " + formatNumber(fiveHour.cap);
|
capFiveHour.textContent = "/ " + formatUSD(fiveHour.cap);
|
||||||
remainFiveHour.textContent = formatNumber(fiveHour.remaining);
|
remainFiveHour.textContent = formatUSD(fiveHour.remaining);
|
||||||
barFiveHour.style.width = pFive + "%";
|
barFiveHour.style.width = pFive + "%";
|
||||||
|
|
||||||
barFiveHour.className = "progress-bar" + (pFive >= 90 || fiveHour.exceeded ? " danger" : pFive >= 70 ? " warning" : "");
|
barFiveHour.className = "progress-bar" + (pFive >= 90 || fiveHour.exceeded ? " danger" : pFive >= 70 ? " warning" : "");
|
||||||
@@ -1029,9 +1035,9 @@ const QuotaPageHTML = `<!DOCTYPE html>
|
|||||||
const weekly = limits.weekly || {};
|
const weekly = limits.weekly || {};
|
||||||
const pWeek = Math.min(100, Math.max(0, weekly.percentage || 0));
|
const pWeek = Math.min(100, Math.max(0, weekly.percentage || 0));
|
||||||
badgeWeekly.textContent = pWeek.toFixed(1) + "%";
|
badgeWeekly.textContent = pWeek.toFixed(1) + "%";
|
||||||
usedWeekly.textContent = formatNumber(weekly.used);
|
usedWeekly.textContent = formatUSD(weekly.used);
|
||||||
capWeekly.textContent = "/ " + formatNumber(weekly.cap);
|
capWeekly.textContent = "/ " + formatUSD(weekly.cap);
|
||||||
remainWeekly.textContent = formatNumber(weekly.remaining);
|
remainWeekly.textContent = formatUSD(weekly.remaining);
|
||||||
barWeekly.style.width = pWeek + "%";
|
barWeekly.style.width = pWeek + "%";
|
||||||
|
|
||||||
barWeekly.className = "progress-bar" + (pWeek >= 90 || weekly.exceeded ? " danger" : pWeek >= 70 ? " warning" : "");
|
barWeekly.className = "progress-bar" + (pWeek >= 90 || weekly.exceeded ? " danger" : pWeek >= 70 ? " warning" : "");
|
||||||
|
|||||||
Reference in New Issue
Block a user