From ddd1b71fa985c0d3886d629a164eee29eaa258f6 Mon Sep 17 00:00:00 2001 From: Hossin Asaadi Date: Wed, 9 Nov 2022 06:49:03 -0500 Subject: [PATCH] merge multi user with IP Limit --- web/assets/js/model/xray.js | 18 +++---- web/html/common/qrcode_modal.html | 64 +++++++++++++++++++++++- web/html/xui/component/inbound_info.html | 18 ++++--- web/html/xui/form/protocol/vless.html | 52 ++++++++++++++++--- web/html/xui/form/protocol/vmess.html | 56 ++++++++++++++++++--- web/html/xui/inbound_modal.html | 45 +++++++++++++++-- web/html/xui/inbounds.html | 2 +- 7 files changed, 216 insertions(+), 39 deletions(-) diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index 4526ef1a..cb15842b 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -881,7 +881,7 @@ class Inbound extends XrayCommonClass { this.sniffing = new Sniffing(); } - genVmessLink(address='', remark='') { + genVmessLink(address='', remark='', clientIndex=0) { if (this.protocol !== Protocols.VMESS) { return ''; } @@ -934,8 +934,8 @@ class Inbound extends XrayCommonClass { ps: remark, add: address, port: this.port, - id: this.settings.vmesses[0].id, - aid: this.settings.vmesses[0].alterId, + id: this.settings.vmesses[clientIndex].id, + aid: this.settings.vmesses[clientIndex].alterId, net: network, type: type, host: host, @@ -945,9 +945,9 @@ class Inbound extends XrayCommonClass { return 'vmess://' + base64(JSON.stringify(obj, null, 2)); } - genVLESSLink(address = '', remark='') { + genVLESSLink(address = '', remark='', clientIndex=0) { const settings = this.settings; - const uuid = settings.vlesses[0].id; + const uuid = settings.vlesses[clientIndex].id; const port = this.port; const type = this.stream.network; const params = new Map(); @@ -1009,7 +1009,7 @@ class Inbound extends XrayCommonClass { } if (this.xtls) { - params.set("flow", this.settings.vlesses[0].flow); + params.set("flow", this.settings.vlesses[clientIndex].flow); } const link = `vless://${uuid}@${address}:${port}`; @@ -1036,10 +1036,10 @@ class Inbound extends XrayCommonClass { return `trojan://${settings.clients[0].password}@${address}:${this.port}#${encodeURIComponent(remark)}`; } - genLink(address='', remark='') { + genLink(address='', remark='', clientIndex=0) { switch (this.protocol) { - case Protocols.VMESS: return this.genVmessLink(address, remark); - case Protocols.VLESS: return this.genVLESSLink(address, remark); + case Protocols.VMESS: return this.genVmessLink(address, remark, clientIndex); + case Protocols.VLESS: return this.genVLESSLink(address, remark, clientIndex); case Protocols.SHADOWSOCKS: return this.genSSLink(address, remark); case Protocols.TROJAN: return this.genTrojanLink(address, remark); default: return ''; diff --git a/web/html/common/qrcode_modal.html b/web/html/common/qrcode_modal.html index 9a3359d5..e071f46a 100644 --- a/web/html/common/qrcode_modal.html +++ b/web/html/common/qrcode_modal.html @@ -3,6 +3,20 @@ :closable="true" width="300px" :ok-text="qrModal.okText" cancel-text='{{ i18n "close" }}' :ok-button-props="{attrs:{id:'qr-modal-ok-btn'}}"> + click on QR Code to Copy + + + + + diff --git a/web/html/xui/component/inbound_info.html b/web/html/xui/component/inbound_info.html index b3eca115..cbf156d1 100644 --- a/web/html/xui/component/inbound_info.html +++ b/web/html/xui/component/inbound_info.html @@ -32,10 +32,10 @@

tls: {{ i18n "closure" }}

- tls {{ i18n "domainName" }}: [[ inbound.serverName ? inbound.serverName : '{{ i18n "none" }}' ]] + tls {{ i18n "domainName" }}: [[ inbound.serverName ? inbound.serverName : '' ]]

- xtls {{ i18n "domainName" }}: [[ inbound.serverName ? inbound.serverName : '{{ i18n "none" }}' ]] + xtls {{ i18n "domainName" }}: [[ inbound.serverName ? inbound.serverName : '' ]]

{{end}} @@ -46,14 +46,16 @@

{{ i18n "pages.inbounds.address"}}: [[ dbInbound.address ]]

{{ i18n "pages.inbounds.port"}}: [[ dbInbound.port ]]

-