From 0a207b8a2c0629b7f1996025a40a10fbe58d05d0 Mon Sep 17 00:00:00 2001 From: "Shishkevich D." <135337715+shishkevichd@users.noreply.github.com> Date: Fri, 7 Mar 2025 09:07:23 +0000 Subject: refactor: merging all util functions into classes --- web/html/xui/form/client.html | 8 +++---- web/html/xui/inbound_client_table.html | 22 ++++++++--------- web/html/xui/inbound_info_modal.html | 12 +++++----- web/html/xui/inbounds.html | 44 +++++++++++++++++----------------- web/html/xui/index.html | 28 +++++++++++----------- web/html/xui/settings.html | 2 +- web/html/xui/warp_modal.html | 6 ++--- web/html/xui/xray.html | 8 +++---- 8 files changed, 65 insertions(+), 65 deletions(-) (limited to 'web/html/xui') diff --git a/web/html/xui/form/client.html b/web/html/xui/form/client.html index 0b894f01..c2bcace1 100644 --- a/web/html/xui/form/client.html +++ b/web/html/xui/form/client.html @@ -126,10 +126,10 @@ - - [[ sizeFormat(clientStats.up) ]] / - [[ sizeFormat(clientStats.down) ]] - ([[ sizeFormat(clientStats.up + clientStats.down) ]]) + + [[ SizeFormatter.sizeFormat(clientStats.up) ]] / + [[ SizeFormatter.sizeFormat(clientStats.down) ]] + ([[ SizeFormatter.sizeFormat(clientStats.up + clientStats.down) ]]) diff --git a/web/html/xui/inbound_client_table.html b/web/html/xui/inbound_client_table.html index 13593cea..fbf0699a 100644 --- a/web/html/xui/inbound_client_table.html +++ b/web/html/xui/inbound_client_table.html @@ -55,18 +55,18 @@ - + @@ -124,9 +124,9 @@ - [[ remainedDays(client.expiryTime) ]] + [[ remainedDays(client.expiryTime) ]] - + @@ -172,7 +172,7 @@ - + @@ -181,12 +181,12 @@ @@ -244,7 +244,7 @@ - [[ remainedDays(client.expiryTime) ]] + [[ remainedDays(client.expiryTime) ]] diff --git a/web/html/xui/inbound_info_modal.html b/web/html/xui/inbound_info_modal.html index 1c561aa6..5ac5e9ab 100644 --- a/web/html/xui/inbound_info_modal.html +++ b/web/html/xui/inbound_info_modal.html @@ -181,8 +181,8 @@
{{ i18n "usage" }} - [[ sizeFormat(infoModal.clientStats.up + infoModal.clientStats.down) ]] - ↑ [[ sizeFormat(infoModal.clientStats.up) ]] / [[ sizeFormat(infoModal.clientStats.down) ]] ↓ + [[ SizeFormatter.sizeFormat(infoModal.clientStats.up + infoModal.clientStats.down) ]] + ↑ [[ SizeFormatter.sizeFormat(infoModal.clientStats.up) ]] / [[ SizeFormatter.sizeFormat(infoModal.clientStats.down) ]] ↓
@@ -224,7 +224,7 @@ [[ getRemStats() ]] - [[ sizeFormat(infoModal.clientSettings.totalGB) ]] + [[ SizeFormatter.sizeFormat(infoModal.clientSettings.totalGB) ]] @@ -233,7 +233,7 @@
[[ sizeFormat(getSumStats(record, client.email)) ]] [[ SizeFormatter.sizeFormat(getSumStats(record, client.email)) ]] {{ i18n "pages.inbounds.traffic" }}
[[ sizeFormat(getUpStats(record, client.email) + getDownStats(record, client.email)) ]] [[ SizeFormatter.sizeFormat(getUpStats(record, client.email) + getDownStats(record, client.email)) ]]
- - + + - +
↑[[ sizeFormat(dbInbound.up) ]]↓[[ sizeFormat(dbInbound.down) ]]↑[[ SizeFormatter.sizeFormat(dbInbound.up) ]]↓[[ SizeFormatter.sizeFormat(dbInbound.down) ]]
{{ i18n "remained" }}[[ sizeFormat(dbInbound.total - dbInbound.up - dbInbound.down) ]][[ SizeFormatter.sizeFormat(dbInbound.total - dbInbound.up - dbInbound.down) ]]
- - [[ sizeFormat(dbInbound.up + dbInbound.down) ]] / + + [[ SizeFormatter.sizeFormat(dbInbound.up + dbInbound.down) ]] / - - [[ sizeFormat(dbInbound.up + dbInbound.down) ]] / + + [[ SizeFormatter.sizeFormat(dbInbound.up + dbInbound.down) ]] / Out: [[ SizeFormatter.sizeFormat(status.netTraffic.sent) ]]
@@ -246,7 +246,7 @@ In: [[ sizeFormat(status.netTraffic.recv) ]] + In: [[ SizeFormatter.sizeFormat(status.netTraffic.recv) ]] @@ -353,7 +353,7 @@ if (this.total === 0) { return 0; } - return toFixed(this.current / this.total * 100, 2); + return NumberFormatter.toFixed(this.current / this.total * 100, 2); } get color() { @@ -396,7 +396,7 @@ this.logicalPro = data.logicalPro; this.cpuSpeedMhz = data.cpuSpeedMhz; this.disk = new CurTotal(data.disk.current, data.disk.total); - this.loads = data.loads.map(load => toFixed(load, 2)); + this.loads = data.loads.map(load => NumberFormatter.toFixed(load, 2)); this.mem = new CurTotal(data.mem.current, data.mem.total); this.netIO = data.netIO; this.netTraffic = data.netTraffic; diff --git a/web/html/xui/settings.html b/web/html/xui/settings.html index 1cccd28d..58a1bf8a 100644 --- a/web/html/xui/settings.html +++ b/web/html/xui/settings.html @@ -832,7 +832,7 @@ if (host == this.oldAllSetting.webDomain) host = null; if (port == this.oldAllSetting.webPort) port = null; const isTLS = webCertFile !== "" || webKeyFile !== ""; - const url = buildURL({ host, port, isTLS, base, path: "panel/settings" }); + const url = URLBuilder.buildURL({ host, port, isTLS, base, path: "panel/settings" }); window.location.replace(url); } }, diff --git a/web/html/xui/warp_modal.html b/web/html/xui/warp_modal.html index 3acd49e8..467f9854 100644 --- a/web/html/xui/warp_modal.html +++ b/web/html/xui/warp_modal.html @@ -65,15 +65,15 @@ WARP+ Data - [[ sizeFormat(warpModal.warpConfig.account.premium_data) ]] + [[ SizeFormatter.sizeFormat(warpModal.warpConfig.account.premium_data) ]] Quota - [[ sizeFormat(warpModal.warpConfig.account.quota) ]] + [[ SizeFormatter.sizeFormat(warpModal.warpConfig.account.quota) ]] Usage - [[ sizeFormat(warpModal.warpConfig.account.usage) ]] + [[ SizeFormatter.sizeFormat(warpModal.warpConfig.account.usage) ]] diff --git a/web/html/xui/xray.html b/web/html/xui/xray.html index 288b69fc..6a367228 100644 --- a/web/html/xui/xray.html +++ b/web/html/xui/xray.html @@ -1177,10 +1177,10 @@ findOutboundTraffic(o) { for (const otraffic of this.outboundsTraffic) { if (otraffic.tag == o.tag) { - return sizeFormat(otraffic.up) + ' / ' + sizeFormat(otraffic.down); + return SizeFormatter.sizeFormat(otraffic.up) + ' / ' + SizeFormatter.sizeFormat(otraffic.down); } } - return sizeFormat(0) + ' / ' + sizeFormat(0); + return SizeFormatter.sizeFormat(0) + ' / ' + SizeFormatter.sizeFormat(0); }, findOutboundAddress(o) { serverObj = null; @@ -1929,7 +1929,7 @@ }, torrentSettings: { get: function () { - return doAllItemsExist(this.settingsData.protocols.bittorrent, this.blockedProtocols); + return ArrayUtils.doAllItemsExist(this.settingsData.protocols.bittorrent, this.blockedProtocols); }, set: function (newValue) { if (newValue) { @@ -1942,7 +1942,7 @@ familyProtectSettings: { get: function () { if (!this.templateSettings || !this.templateSettings.dns || !this.templateSettings.dns.servers) return false; - return doAllItemsExist(this.settingsData.familyProtectDNS.servers, this.templateSettings.dns.servers); + return ArrayUtils.doAllItemsExist(this.settingsData.familyProtectDNS.servers, this.templateSettings.dns.servers); }, set: function (newValue) { newTemplateSettings = this.templateSettings; -- cgit v1.2.3