diff --git a/web/assets/js/model/models.js b/web/assets/js/model/models.js index d15afdc6..ba79d8a2 100644 --- a/web/assets/js/model/models.js +++ b/web/assets/js/model/models.js @@ -44,7 +44,7 @@ class DBInbound { this.streamSettings = ""; this.tag = ""; this.sniffing = ""; - + this.clientStats = "" if (data == null) { return; } @@ -125,6 +125,10 @@ class DBInbound { if (!ObjectUtil.isEmpty(this.sniffing)) { sniffing = JSON.parse(this.sniffing); } + let clientStats = {}; + if (!ObjectUtil.isEmpty(this.clientStats)) { + clientStats = JSON.parse(this.clientStats); + } const config = { port: this.port, listen: this.listen, @@ -133,6 +137,7 @@ class DBInbound { streamSettings: streamSettings, tag: this.tag, sniffing: sniffing, + clientStats: clientStats, }; return Inbound.fromJson(config); } diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index bdf7a2cc..f4aa500f 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -608,6 +608,7 @@ class Inbound extends XrayCommonClass { streamSettings=new StreamSettings(), tag='', sniffing=new Sniffing(), + clientStats='', ) { super(); this.port = port; @@ -617,6 +618,10 @@ class Inbound extends XrayCommonClass { this.stream = streamSettings; this.tag = tag; this.sniffing = sniffing; + this.clientStats = clientStats; + } + getClientStats() { + return this.clientStats; } get protocol() { @@ -1066,6 +1071,7 @@ class Inbound extends XrayCommonClass { StreamSettings.fromJson(json.streamSettings), json.tag, Sniffing.fromJson(json.sniffing), + json.clientStats ) } @@ -1082,6 +1088,7 @@ class Inbound extends XrayCommonClass { streamSettings: streamSettings, tag: this.tag, sniffing: this.sniffing.toJson(), + clientStats: this.clientStats }; } } @@ -1203,6 +1210,14 @@ Inbound.VmessSettings.Vmess = class extends XrayCommonClass { this.expiryTime = t.valueOf(); } } + get _totalGB() { + return toFixed(this.totalGB / ONE_GB, 2); + } + + set _totalGB(gb) { + this.totalGB = toFixed(gb * ONE_GB, 0); + } + }; Inbound.VLESSSettings = class extends Inbound.Settings { @@ -1254,6 +1269,14 @@ Inbound.VLESSSettings = class extends Inbound.Settings { this.expiryTime = t.valueOf(); } } + get _totalGB() { + return toFixed(this.totalGB / ONE_GB, 2); + } + + set _totalGB(gb) { + this.totalGB = toFixed(gb * ONE_GB, 0); + } + }; Inbound.VLESSSettings.VLESS = class extends XrayCommonClass { diff --git a/web/html/xui/form/protocol/vmess.html b/web/html/xui/form/protocol/vmess.html index ad4e0db4..cc2fd908 100644 --- a/web/html/xui/form/protocol/vmess.html +++ b/web/html/xui/form/protocol/vmess.html @@ -71,9 +71,15 @@ - - - + [[ sizeFormat(getUpStats(vmess.email)) ]] / [[ sizeFormat(getDownStats(vmess.email)) ]] + + used : [[ sizeFormat(getUpStats(vmess.email) + getDownStats(vmess.email)) ]] + + + + +