From 3d4b87d72fc1119f69dff7dd2423b9ed9bb7e432 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Sat, 18 Mar 2023 17:02:40 +0100 Subject: [PATCH] v0.4.1 --- web/assets/js/model/xray.js | 56 ++++++++++++------------------- web/html/common/qrcode_modal.html | 16 ++++----- web/html/xui/setting.html | 2 +- web/service/inbound.go | 2 -- 4 files changed, 30 insertions(+), 46 deletions(-) diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index 9359a789..7f28e9aa 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -1093,12 +1093,6 @@ class Inbound extends XrayCommonClass { const params = new Map(); params.set("type", this.stream.network); params.set("security", this.stream.security); - if (this.xtls) { - params.set("security", "xtls"); - address = this.stream.tls.server; - } else { - params.set("security", this.stream.security); - } switch (type) { case "tcp": const tcp = this.stream.tcp; @@ -1144,30 +1138,25 @@ class Inbound extends XrayCommonClass { break; } - if (this.stream.security === 'tls') { + if (this.tls) { + params.set("fp" , this.stream.tls.settings[0]['fingerprint']); + params.set("alpn", this.stream.tls.alpn[0]); if (!ObjectUtil.isEmpty(this.stream.tls.server)) { address = this.stream.tls.server; - params.set("fp" , this.stream.tls.settings[0]['fingerprint']); - params.set("alpn", this.stream.tls.alpn[0]); - if (this.stream.tls.settings[0]['serverName'] !== ''){ - params.set("sni", this.stream.tls.settings[0]['serverName']); - } - else{ - params.set("sni", address); - } - if (type === "tcp" && this.settings.vlesses[clientIndex].flow.length > 0) { - params.set("flow", this.settings.vlesses[clientIndex].flow); - } } + if (this.stream.tls.settings[0]['serverName'] !== ''){ + params.set("sni", this.stream.tls.settings[0]['serverName']); + } + if (type === "tcp" && this.settings.vlesses[clientIndex].flow.length > 0) { + params.set("flow", this.settings.vlesses[clientIndex].flow); + } } if (this.xtls) { - if (this.stream.security === 'xtls') { - if (!ObjectUtil.isEmpty(this.stream.tls.server)) { - address = this.stream.tls.server; - if (type === "tcp") { - params.set("flow", this.settings.vlesses[clientIndex].flow); - } + if (!ObjectUtil.isEmpty(this.stream.tls.server)) { + address = this.stream.tls.server; + if (type === "tcp") { + params.set("flow", this.settings.vlesses[clientIndex].flow); } } } @@ -1200,6 +1189,8 @@ class Inbound extends XrayCommonClass { const port = this.port; const type = this.stream.network; const params = new Map(); + params.set("type", this.stream.network); + params.set("security", this.stream.security); switch (type) { case "tcp": const tcp = this.stream.tcp; @@ -1245,21 +1236,18 @@ class Inbound extends XrayCommonClass { break; } - if (this.stream.security === 'tls') { + if (this.tls) { + params.set("fp" , this.stream.tls.settings[0]['fingerprint']); + params.set("alpn", this.stream.tls.alpn[0]); if (!ObjectUtil.isEmpty(this.stream.tls.server)) { address = this.stream.tls.server; - params.set("fp" , this.stream.tls.settings[0]['fingerprint']); - params.set("alpn", this.stream.tls.alpn[0]); - if (this.stream.tls.settings[0]['serverName'] !== ''){ - params.set("sni", this.stream.tls.settings[0]['serverName']); - } - else{ - params.set("sni", address); - } + } + if (this.stream.tls.settings[0]['serverName'] !== ''){ + params.set("sni", this.stream.tls.settings[0]['serverName']); } } - if (this.stream.security === 'xtls') { + if (this.xtls) { if (!ObjectUtil.isEmpty(this.stream.tls.server)) { address = this.stream.tls.server; if (type === "tcp" && this.settings.trojans[clientIndex].flow.length > 0) { diff --git a/web/html/common/qrcode_modal.html b/web/html/common/qrcode_modal.html index 6c9afbb3..e535b401 100644 --- a/web/html/common/qrcode_modal.html +++ b/web/html/common/qrcode_modal.html @@ -32,15 +32,13 @@ } this.visible = true; qrModalApp.$nextTick(() => { - if (this.clipboard === null) { - this.clipboard = new ClipboardJS('#qr-modal-ok-btn', { - text: () => this.copyText, - }); - this.clipboard.on('success', () => { - app.$message.success('{{ i18n "copied" }}') - this.clipboard.destroy(); - }); - } + 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'), diff --git a/web/html/xui/setting.html b/web/html/xui/setting.html index 17f76cb0..f9f6179b 100644 --- a/web/html/xui/setting.html +++ b/web/html/xui/setting.html @@ -117,7 +117,7 @@ - + diff --git a/web/service/inbound.go b/web/service/inbound.go index 3eb6ff57..2169fa28 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -402,7 +402,6 @@ func (s *InboundService) AddClientTraffic(traffics []*xray.ClientTraffic) (err e if err != nil { if err == gorm.ErrRecordNotFound { logger.Warning(err, traffic.Email) - } continue } @@ -430,7 +429,6 @@ func (s *InboundService) AddClientTraffic(traffics []*xray.ClientTraffic) (err e logger.Warning("AddClientTraffic update data ", err) continue } - } return }