mirror of
https://github.com/dyzulk/twinpath-hotspot-themes.git
synced 2026-01-26 13:31:54 +07:00
Fix: Implement strict Unlimited display logic in status page
This commit is contained in:
14
js/script.js
14
js/script.js
@@ -110,7 +110,10 @@ function openInExternalBrowser() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatMikrotikTime(timeStr) {
|
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;
|
const regex = /(\d+)([wdhms])/g;
|
||||||
let parts = [];
|
let parts = [];
|
||||||
@@ -179,6 +182,15 @@ function updateProgressBars() {
|
|||||||
const quotaBar = document.querySelector('.progress-quota');
|
const quotaBar = document.querySelector('.progress-quota');
|
||||||
if (quotaBar) quotaBar.style.width = '100%'; // Unlimited
|
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) {
|
function checkVoucher(forceCode = null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user