From 3152d5f1910de3019a7b06e9f45bb4466e1c3483 Mon Sep 17 00:00:00 2001 From: MHSanaei <33454419+MHSanaei@users.noreply.github.com> Date: Fri, 24 Mar 2023 16:47:14 +0330 Subject: [PATCH 1/9] Remove ugly-bugy qrCode footer --- web/html/common/qrcode_modal.html | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/web/html/common/qrcode_modal.html b/web/html/common/qrcode_modal.html index e535b401..f492dabb 100644 --- a/web/html/common/qrcode_modal.html +++ b/web/html/common/qrcode_modal.html @@ -1,9 +1,10 @@ {{define "qrcodeModal"}} - {{ i18n "pages.inbounds.clickOnQRcode" }} + :footer="null" + width="300px"> + {{ i18n "pages.inbounds.clickOnQRcode" }} @@ -14,17 +15,15 @@ content: '', inbound: new Inbound(), dbInbound: new DBInbound(), - okText: '', copyText: '', qrcode: null, clipboard: null, visible: false, - show: function (title='', content='', dbInbound=new DBInbound(),okText='{{ i18n "copy" }}', copyText='') { + show: function (title='', content='', dbInbound=new DBInbound(), copyText='') { this.title = title; this.content = content; this.dbInbound = dbInbound; this.inbound = dbInbound.toInbound(); - this.okText = okText; if (ObjectUtil.isEmpty(copyText)) { this.copyText = content; } else { @@ -32,13 +31,6 @@ } this.visible = true; qrModalApp.$nextTick(() => { - this.clipboard = new ClipboardJS('#qr-modal-ok-btn', { - text: () => this.copyText, - }); - this.clipboard.on('success', () => { - app.$message.success('{{ i18n "copied" }}') - this.clipboard.destroy(); - }); if (this.qrcode === null) { this.qrcode = new QRious({ element: document.querySelector('#qrCode'), From f0d4dbf8382f42c9189f606ac8520d6405ee8f05 Mon Sep 17 00:00:00 2001 From: MHSanaei <33454419+MHSanaei@users.noreply.github.com> Date: Fri, 24 Mar 2023 16:50:10 +0330 Subject: [PATCH 2/9] [tgbot] fix exhausted report --- web/service/tgbot.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/web/service/tgbot.go b/web/service/tgbot.go index 63aa86ac..e88edbdf 100644 --- a/web/service/tgbot.go +++ b/web/service/tgbot.go @@ -473,7 +473,7 @@ func (t *Tgbot) getExhausted() string { } ExpireThreshold, err := t.settingService.GetTgExpireDiff() if err == nil && ExpireThreshold > 0 { - exDiff = int64(ExpireThreshold) * 84600 + exDiff = int64(ExpireThreshold) * 84600000 } inbounds, err := t.inboundService.GetAllInbounds() if err != nil { @@ -481,14 +481,14 @@ func (t *Tgbot) getExhausted() string { } for _, inbound := range inbounds { if inbound.Enable { - if (inbound.ExpiryTime > 0 && (now-inbound.ExpiryTime < exDiff)) || + if (inbound.ExpiryTime > 0 && (inbound.ExpiryTime-now < exDiff)) || (inbound.Total > 0 && (inbound.Total-inbound.Up+inbound.Down < trDiff)) { exhaustedInbounds = append(exhaustedInbounds, *inbound) } if len(inbound.ClientStats) > 0 { for _, client := range inbound.ClientStats { if client.Enable { - if (client.ExpiryTime > 0 && (now-client.ExpiryTime < exDiff)) || + if (client.ExpiryTime > 0 && (client.ExpiryTime-now < exDiff)) || (client.Total > 0 && (client.Total-client.Up+client.Down < trDiff)) { exhaustedClients = append(exhaustedClients, client) } @@ -502,7 +502,7 @@ func (t *Tgbot) getExhausted() string { } } output += fmt.Sprintf("Exhausted Inbounds count:\r\n🛑 Disabled: %d\r\n🔜 Exhaust soon: %d\r\n \r\n", len(disabledInbounds), len(exhaustedInbounds)) - if len(disabledInbounds)+len(exhaustedInbounds) > 0 { + if len(exhaustedInbounds) > 0 { output += "Exhausted Inbounds:\r\n" for _, inbound := range exhaustedInbounds { output += fmt.Sprintf("📍Inbound:%s\r\nPort:%d\r\nTraffic: %s (↑%s,↓%s)\r\n", inbound.Remark, inbound.Port, common.FormatTraffic((inbound.Up + inbound.Down)), common.FormatTraffic(inbound.Up), common.FormatTraffic(inbound.Down)) @@ -514,7 +514,7 @@ func (t *Tgbot) getExhausted() string { } } output += fmt.Sprintf("Exhausted Clients count:\r\n🛑 Disabled: %d\r\n🔜 Exhaust soon: %d\r\n \r\n", len(disabledClients), len(exhaustedClients)) - if len(disabledClients)+len(exhaustedClients) > 0 { + if len(exhaustedClients) > 0 { output += "Exhausted Clients:\r\n" for _, traffic := range exhaustedClients { expiryTime := "" @@ -529,7 +529,7 @@ func (t *Tgbot) getExhausted() string { } else { total = common.FormatTraffic((traffic.Total)) } - output += fmt.Sprintf("💡 Active: %t\r\n📧 Email: %s\r\n🔼 Upload↑: %s\r\n🔽 Download↓: %s\r\n🔄 Total: %s / %s\r\n📅 Expire in: %s\r\n", + output += fmt.Sprintf("💡 Active: %t\r\n📧 Email: %s\r\n🔼 Upload↑: %s\r\n🔽 Download↓: %s\r\n🔄 Total: %s / %s\r\n📅 Expire date: %s\r\n \r\n", traffic.Enable, traffic.Email, common.FormatTraffic(traffic.Up), common.FormatTraffic(traffic.Down), common.FormatTraffic((traffic.Up + traffic.Down)), total, expiryTime) } From 8dad9a4338142a566de038ee409bf3ce9b4ab949 Mon Sep 17 00:00:00 2001 From: MHSanaei <33454419+MHSanaei@users.noreply.github.com> Date: Fri, 24 Mar 2023 16:51:43 +0330 Subject: [PATCH 3/9] [tgbot] fix admins input --- web/html/xui/setting.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/html/xui/setting.html b/web/html/xui/setting.html index 0c0f9682..f8f873e6 100644 --- a/web/html/xui/setting.html +++ b/web/html/xui/setting.html @@ -117,7 +117,7 @@ - + From 03a6c131f994e0d7984b07b153acc6a6ca943f10 Mon Sep 17 00:00:00 2001 From: MHSanaei <33454419+MHSanaei@users.noreply.github.com> Date: Fri, 24 Mar 2023 16:54:21 +0330 Subject: [PATCH 4/9] [infoModal] better display --- web/html/xui/inbound_info_modal.html | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/web/html/xui/inbound_info_modal.html b/web/html/xui/inbound_info_modal.html index 0e1b1415..6de729f9 100644 --- a/web/html/xui/inbound_info_modal.html +++ b/web/html/xui/inbound_info_modal.html @@ -59,13 +59,11 @@ - [[ status.xray.version ]] - {{ i18n "pages.index.stopXray" }} - {{ i18n "pages.index.restartXray" }} - {{ i18n "pages.index.xraySwitch" }} + [[ status.xray.version ]] + {{ i18n "pages.index.stopXray" }} + {{ i18n "pages.index.restartXray" }} + {{ i18n "pages.index.xraySwitch" }} + x-ui: {{ .cur_ver }} + Logs {{ i18n "pages.index.operationHours" }}: - [[ formatSecond(status.uptime) ]] + [[ formatSecond(status.uptime) ]]