Fix: Implement strict Unlimited display logic in status page

This commit is contained in:
dyzulk
2026-01-12 10:28:33 +07:00
parent 77ec4f68c4
commit 06205ee56b

View File

@@ -110,7 +110,10 @@ function openInExternalBrowser() {
}
function formatMikrotikTime(timeStr) {
if (!timeStr || timeStr === 'unlimited' || timeStr.includes('$(')) return timeStr;
if (!timeStr || timeStr === 'unlimited' || timeStr.includes('$(')) {
const lang = localStorage.getItem('twinpath_lang') || 'en';
return (translations[lang] && translations[lang]['unlimited']) || 'Unlimited';
}
const regex = /(\d+)([wdhms])/g;
let parts = [];
@@ -179,6 +182,15 @@ function updateProgressBars() {
const quotaBar = document.querySelector('.progress-quota');
if (quotaBar) quotaBar.style.width = '100%'; // Unlimited
}
// Check for "Reached Limit" state
const isExpiredTime = limitUptime > 0 && uptime >= limitUptime;
const isExpiredQuota = limitBytes > 0 && bytesOut >= limitBytes;
if (isExpiredTime || isExpiredQuota) {
console.warn("User has reached limit!");
// We could add a label here, but MikroTik usually redirects/logs out automatically
}
}
function checkVoucher(forceCode = null) {