From 1288427ccee40aaee633c655bed12ac2ff206c82 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Wed, 1 Mar 2023 23:11:51 +0100 Subject: [PATCH] Show clients counter #30 --- web/html/xui/inbounds.html | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index b06e2da6..824a9683 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -38,6 +38,12 @@ {{ i18n "pages.inbounds.inboundCount" }}: [[ dbInbounds.length ]] + + {{ i18n "clients" }}: + [[ total.clients ]] + {{ i18n "enabled" }} [[ total.active ]] + {{ i18n "disabled" }} [[ total.deactive ]] + @@ -520,13 +526,32 @@ computed: { total() { let down = 0, up = 0; - for (let i = 0; i < this.dbInbounds.length; ++i) { - down += this.dbInbounds[i].down; - up += this.dbInbounds[i].up; - } + let clients = 0, active = 0, deactive = 0; + this.dbInbounds.forEach(dbInbound => { + down += dbInbound.down; + up += dbInbound.up; + inbound = dbInbound.toInbound(); + clients = this.getClients(dbInbound.protocol, inbound.settings); + if(clients){ + if(dbInbound.enable){ + isClientEnable = false; + clients.forEach(client => { + isClientEnable = client.email == "" ? true: this.isClientEnabled(dbInbound,client.email); + isClientEnable ? active++ : deactive++; + }); + } else { + deactive += clients.length; + } + } else { + dbInbound.enable ? active++ : deactive++; + } + }); return { down: down, up: up, + clients: active + deactive, + active: active, + deactive: deactive, }; } },