feat: Exakte Reset-Uhrzeit rechts unter Prozentzahl bei AG und MiniMax
Build and Push Docker Image / build-and-push (push) Canceled after 0s

This commit is contained in:
Jannik committed 2026-09-06 19:43:05 +02:00
1 parent b47b1750a2
commit 29e6476700
3 files changed
+42 -10

No files matched your search

+29 -10
View File
@@ -78,21 +78,38 @@ function updateRow(providerId, quota) {
}
// Detail text
const detailsId = `details-${quota.provider.toLowerCase().replace(/[^a-z0-9]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '')}`;
const providerId = quota.provider.toLowerCase().replace(/[^a-z0-9]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '');
const detailsId = `details-${providerId}`;
const detailsEl = document.getElementById(detailsId);
const resetTimeEl = document.getElementById(`reset-time-${providerId}`);
// Formats a timestamp as "Heute 14:30", "Morgen 09:00" or "Mo. 14:30"
function formatResetTime(ms) {
if (!ms) return '';
const d = new Date(ms);
const now = new Date();
const todayStr = now.toDateString();
const tomorrowStr = new Date(now.getTime() + 86400000).toDateString();
const timeStr = d.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' });
if (d.toDateString() === todayStr) return `Heute ${timeStr}`;
if (d.toDateString() === tomorrowStr) return `Morgen ${timeStr}`;
const dayStr = d.toLocaleDateString('de-DE', { weekday: 'short' });
return `${dayStr} ${timeStr}`;
}
if (quota.provider.startsWith('MiniMax') && quota.meta) {
statusText.innerText = `${Math.round(quota.used)}% / 100%`;
if (detailsEl) {
const resetTs = quota.meta.reset;
const targetMs = (typeof resetTs === 'number' && resetTs < 9999999999) ? resetTs * 1000 : resetTs;
const countdownId = `countdown-${detailsId}`;
const resetTs = quota.meta.reset;
const targetMs = (typeof resetTs === 'number' && resetTs < 9999999999) ? resetTs * 1000 : resetTs;
const countdownId = `countdown-${detailsId}`;
if (resetTimeEl) resetTimeEl.innerText = formatResetTime(targetMs);
if (detailsEl) {
if (quota.provider.includes('5h')) {
detailsEl.innerHTML = `<div><span>Reset in:</span> <strong id="${countdownId}" style="color: var(--success)">--:--:--</strong></div>`;
if (targetMs) startCountdown(countdownId, targetMs);
} else {
// Weekly: show countdown if in the future, else formatted date
if (targetMs && targetMs > Date.now()) {
detailsEl.innerHTML = `<div><span>Reset in:</span> <strong id="${countdownId}" style="color: var(--success)">--:--:--</strong></div>`;
startCountdown(countdownId, targetMs);
@@ -104,11 +121,13 @@ function updateRow(providerId, quota) {
}
} else if (quota.provider.startsWith('AG ') && quota.meta) {
statusText.innerText = `${Math.round(quota.used)}% / 100%`;
if (detailsEl) {
const resetTs = quota.meta.resetTime;
const targetMs = resetTs ? new Date(resetTs).getTime() : null;
const countdownId = `countdown-${detailsId}`;
const resetTs = quota.meta.resetTime;
const targetMs = resetTs ? new Date(resetTs).getTime() : null;
const countdownId = `countdown-${detailsId}`;
if (resetTimeEl) resetTimeEl.innerText = formatResetTime(targetMs);
if (detailsEl) {
if (targetMs && targetMs > Date.now()) {
detailsEl.innerHTML = `<div><span>Reset in:</span> <strong id="${countdownId}" style="color: var(--success)">--:--:--</strong></div>`;
startCountdown(countdownId, targetMs);
+6
View File
@@ -74,6 +74,7 @@
<div class="provider-stats">
<span class="percentage" id="percentage-ag-gemini-5h">0%</span>
<span class="raw-value" id="status-ag-gemini-5h">Loading...</span>
<span class="reset-time" id="reset-time-ag-gemini-5h"></span>
</div>
</div>
<div class="provider-details" id="details-ag-gemini-5h"></div>
@@ -96,6 +97,7 @@
<div class="provider-stats">
<span class="percentage" id="percentage-ag-gemini-weekly">0%</span>
<span class="raw-value" id="status-ag-gemini-weekly">Loading...</span>
<span class="reset-time" id="reset-time-ag-gemini-weekly"></span>
</div>
</div>
<div class="provider-details" id="details-ag-gemini-weekly"></div>
@@ -118,6 +120,7 @@
<div class="provider-stats">
<span class="percentage" id="percentage-ag-claude-5h">0%</span>
<span class="raw-value" id="status-ag-claude-5h">Loading...</span>
<span class="reset-time" id="reset-time-ag-claude-5h"></span>
</div>
</div>
<div class="provider-details" id="details-ag-claude-5h"></div>
@@ -140,6 +143,7 @@
<div class="provider-stats">
<span class="percentage" id="percentage-ag-claude-weekly">0%</span>
<span class="raw-value" id="status-ag-claude-weekly">Loading...</span>
<span class="reset-time" id="reset-time-ag-claude-weekly"></span>
</div>
</div>
<div class="provider-details" id="details-ag-claude-weekly"></div>
@@ -162,6 +166,7 @@
<div class="provider-stats">
<span class="percentage" id="percentage-minimax-5h">0%</span>
<span class="raw-value" id="status-minimax-5h">Loading...</span>
<span class="reset-time" id="reset-time-minimax-5h"></span>
</div>
</div>
<div class="provider-details" id="details-minimax-5h"></div>
@@ -184,6 +189,7 @@
<div class="provider-stats">
<span class="percentage" id="percentage-minimax-weekly">0%</span>
<span class="raw-value" id="status-minimax-weekly">Loading...</span>
<span class="reset-time" id="reset-time-minimax-weekly"></span>
</div>
</div>
<div class="provider-details" id="details-minimax-weekly"></div>
+7
View File
@@ -201,6 +201,13 @@ header p {
color: var(--text-muted);
}
.reset-time {
font-size: 0.78em;
color: var(--text-muted);
opacity: 0.75;
font-variant-numeric: tabular-nums;
}
.charts {
background-color: var(--row-bg);
border: 1px solid var(--row-border);