diff options
| author | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-05-23 02:45:34 +0300 |
|---|---|---|
| committer | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-05-23 02:45:34 +0300 |
| commit | 47ccc7b501faeac895e295e86fc4ae2aea3a31ed (patch) | |
| tree | 130dde164d6ab4341a336e0c2cd73907a992275d /web | |
| parent | c38e1e0cfe9fd95f1cd2ed5f6c6cb10bf820b9b6 (diff) | |
[feature] fallback link calculation
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web')
| -rw-r--r-- | web/html/common/qrcode_modal.html | 1 | ||||
| -rw-r--r-- | web/html/xui/inbounds.html | 29 |
2 files changed, 27 insertions, 3 deletions
diff --git a/web/html/common/qrcode_modal.html b/web/html/common/qrcode_modal.html index 3271f3ad..acef9811 100644 --- a/web/html/common/qrcode_modal.html +++ b/web/html/common/qrcode_modal.html @@ -39,6 +39,7 @@ this.client = settings.clients[clientIndex]; remark = this.dbInbound.remark + "-" + this.client.email; address = this.dbInbound.address; + this.subId = ''; this.qrcodes = []; if (this.inbound.tls && !ObjectUtil.isArrEmpty(this.inbound.stream.tls.settings.domains)) { this.inbound.stream.tls.settings.domains.forEach((domain) => { diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index b906fe00..7b9ba207 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -361,6 +361,7 @@ this.refreshing = true; const msg = await HttpUtil.post('/panel/inbound/list'); if (!msg.success) { + this.refreshing = false; return; } this.setInbounds(msg.obj); @@ -763,11 +764,32 @@ default: return client.id; } }, + checkFallback(dbInbound) { + newDbInbound = new DBInbound(dbInbound); + if (dbInbound.listen.startsWith("@")){ + rootInbound = this.inbounds.find((i) => + i.tls && + ['trojan','vless'].includes(i.protocol) && + i.settings.fallbacks.find(f => f.dest === dbInbound.listen) + ); + if (rootInbound) { + newDbInbound.listen = rootInbound.listen; + newDbInbound.port = rootInbound.port; + newInbound = newDbInbound.toInbound(); + newInbound.stream.security = 'tls'; + newInbound.stream.tls = rootInbound.stream.tls; + newDbInbound.streamSettings = newInbound.stream.toString(); + } + } + return newDbInbound; + }, showQrcode(dbInbound, clientIndex) { - qrModal.show('{{ i18n "qrCode"}}', dbInbound, clientIndex); + newDbInbound = this.checkFallback(dbInbound); + qrModal.show('{{ i18n "qrCode"}}', newDbInbound, clientIndex); }, showInfo(dbInbound, index) { - infoModal.show(dbInbound, index); + newDbInbound = this.checkFallback(dbInbound); + infoModal.show(newDbInbound, index); }, switchEnable(dbInboundId) { dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); @@ -868,7 +890,8 @@ }, inboundLinks(dbInboundId) { dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); - txtModal.show('{{ i18n "pages.inbounds.export"}}', dbInbound.genInboundLinks, dbInbound.remark); + newDbInbound = this.checkFallback(dbInbound); + txtModal.show('{{ i18n "pages.inbounds.export"}}', newDbInbound.genInboundLinks, newDbInbound.remark); }, exportAllLinks() { let copyText = ''; |
