diff options
| author | mhsanaei <ho3ein.sanaei@gmail.com> | 2025-09-18 17:28:09 +0300 |
|---|---|---|
| committer | mhsanaei <ho3ein.sanaei@gmail.com> | 2025-09-18 17:28:09 +0300 |
| commit | b46a0b404bd9b6fddfcaeaec1e2c316015bb9967 (patch) | |
| tree | 300de9594af091ef15800948101e760ac5dc9a41 /web/html/inbounds.html | |
| parent | 0ce58a095aeb9dafee8c93851c609688d5187000 (diff) | |
enhancements
Diffstat (limited to 'web/html/inbounds.html')
| -rw-r--r-- | web/html/inbounds.html | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/web/html/inbounds.html b/web/html/inbounds.html index 5f17c98b..bea8e8d9 100644 --- a/web/html/inbounds.html +++ b/web/html/inbounds.html @@ -1434,15 +1434,19 @@ clientStats = dbInbound.clientStats ? dbInbound.clientStats.find(stats => stats.email === email) : null; return clientStats ? clientStats['enable'] : true; }, - // Returns true when client's traffic is exhausted or expiry time is passed isClientDepleted(dbInbound, email) { if (!email || !dbInbound || !dbInbound.clientStats) return false; const stats = dbInbound.clientStats.find(s => s.email === email); if (!stats) return false; - const now = new Date().getTime(); - const exhausted = stats.total > 0 && (stats.up + stats.down) >= stats.total; - const expired = stats.expiryTime > 0 && now >= stats.expiryTime; - return exhausted || expired; + const total = stats.total ?? 0; + const used = (stats.up ?? 0) + (stats.down ?? 0); + const hasTotal = total > 0; + const exhausted = hasTotal && used >= total; + const expiryTime = stats.expiryTime ?? 0; + const hasExpiry = expiryTime > 0; + const now = Date.now(); + const expired = hasExpiry && expiryTime <= now; + return expired || exhausted; }, isClientOnline(email) { return this.onlineClients.includes(email); |
