diff options
| author | MHSanaei <mc.sanaei@gmail.com> | 2023-02-12 16:50:09 +0300 |
|---|---|---|
| committer | MHSanaei <mc.sanaei@gmail.com> | 2023-02-12 16:50:09 +0300 |
| commit | 6d28c39ae845cb0ac6e35562aaa52d8219b95bc8 (patch) | |
| tree | bb80e5bffe67919a772694196dc80e1a99b47077 /web/assets | |
| parent | 920259b6f8345f30c6a4bd40205c18a37b867f0f (diff) | |
en lang edit, new designed
Diffstat (limited to 'web/assets')
| -rw-r--r-- | web/assets/js/model/models.js | 4 | ||||
| -rw-r--r-- | web/assets/js/model/xray.js | 21 | ||||
| -rw-r--r-- | web/assets/js/util/common.js | 14 |
3 files changed, 30 insertions, 9 deletions
diff --git a/web/assets/js/model/models.js b/web/assets/js/model/models.js index c2404d3b..9fa5e7fc 100644 --- a/web/assets/js/model/models.js +++ b/web/assets/js/model/models.js @@ -151,9 +151,9 @@ class DBInbound { } } - genLink() { + genLink(clientIndex) { const inbound = this.toInbound(); - return inbound.genLink(this.address, this.remark); + return inbound.genLink(this.address, this.remark, clientIndex); } } diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index f5cbb1e0..ccddc591 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -1040,7 +1040,6 @@ class Inbound extends XrayCommonClass { } } - remark = this.settings.vmesses[clientIndex].email ?? remark; let obj = { v: '2', ps: remark, @@ -1063,7 +1062,6 @@ class Inbound extends XrayCommonClass { const port = this.port; const type = this.stream.network; const params = new Map(); - remark = settings.vlesses[clientIndex].email ?? remark; params.set("type", this.stream.network); if (this.xtls) { params.set("security", "xtls"); @@ -1156,7 +1154,6 @@ class Inbound extends XrayCommonClass { const port = this.port; const type = this.stream.network; const params = new Map(); - remark = settings.trojans[clientIndex].email ?? remark; params.set("type", this.stream.network); if (this.xtls) { params.set("security", "xtls"); @@ -1229,10 +1226,22 @@ class Inbound extends XrayCommonClass { genLink(address='', remark='', clientIndex=0) { switch (this.protocol) { - case Protocols.VMESS: return this.genVmessLink(address, remark, clientIndex); - case Protocols.VLESS: return this.genVLESSLink(address, remark, clientIndex); + case Protocols.VMESS: + if (this.settings.vmesses[clientIndex].email != ""){ + remark += '-' + this.settings.vmesses[clientIndex].email + } + return this.genVmessLink(address, remark, clientIndex); + case Protocols.VLESS: + if (this.settings.vlesses[clientIndex].email != ""){ + remark += '-' + this.settings.vlesses[clientIndex].email + } + return this.genVLESSLink(address, remark, clientIndex); case Protocols.SHADOWSOCKS: return this.genSSLink(address, remark); - case Protocols.TROJAN: return this.genTrojanLink(address, remark, clientIndex); + case Protocols.TROJAN: + if (this.settings.trojans[clientIndex].email != ""){ + remark += '-' + this.settings.trojans[clientIndex].email + } + return this.genTrojanLink(address, remark, clientIndex); default: return ''; } } diff --git a/web/assets/js/util/common.js b/web/assets/js/util/common.js index 7225e4ba..b3ebc0bd 100644 --- a/web/assets/js/util/common.js +++ b/web/assets/js/util/common.js @@ -54,4 +54,16 @@ function addZero(num) { function toFixed(num, n) { n = Math.pow(10, n); return Math.round(num * n) / n; -}
\ No newline at end of file +} + +function debounce (fn, delay) { + var timeoutID = null + return function () { + clearTimeout(timeoutID) + var args = arguments + var that = this + timeoutID = setTimeout(function () { + fn.apply(that, args) + }, delay) + } + }
\ No newline at end of file |
