From b4ef2af4c96210d31d424b9d1d4168f82cd2f306 Mon Sep 17 00:00:00 2001 From: "Shishkevich D." <135337715+shishkevichd@users.noreply.github.com> Date: Sun, 6 Jul 2025 15:20:41 +0700 Subject: [PATCH] chore: return automatic generation of shadowsocks keys --- web/assets/js/model/inbound.js | 4 ++-- web/html/modals/client_modal.html | 8 ++++---- web/html/modals/inbound_modal.html | 5 +++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index ff30ef1b..cbdeaa8a 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -2149,7 +2149,7 @@ Inbound.TrojanSettings.Fallback = class extends XrayCommonClass { Inbound.ShadowsocksSettings = class extends Inbound.Settings { constructor(protocol, method = SSMethods.BLAKE3_AES_256_GCM, - password = '', + password = RandomUtil.randomShadowsocksPassword(), network = 'tcp,udp', shadowsockses = [new Inbound.ShadowsocksSettings.Shadowsocks()], ivCheck = false, @@ -2187,7 +2187,7 @@ Inbound.ShadowsocksSettings = class extends Inbound.Settings { Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass { constructor( method = '', - password = '', + password = RandomUtil.randomShadowsocksPassword(), email = RandomUtil.randomLowerAndNum(8), limitIp = 0, totalGB = 0, diff --git a/web/html/modals/client_modal.html b/web/html/modals/client_modal.html index eba3c2c1..623e720d 100644 --- a/web/html/modals/client_modal.html +++ b/web/html/modals/client_modal.html @@ -47,7 +47,7 @@ } this.oldClientId = this.getClientId(dbInbound.protocol, clients[index]); } else { - this.addClient(this.inbound.protocol, this.clients); + this.addClient(this.inbound, this.clients); } this.clientStats = this.dbInbound.clientStats.find(row => row.email === this.clients[this.index].email); this.confirm = confirm; @@ -59,12 +59,12 @@ default: return client.id; } }, - addClient(protocol, clients) { - switch (protocol) { + addClient(inbound, clients) { + switch (inbound.protocol) { case Protocols.VMESS: return clients.push(new Inbound.VmessSettings.VMESS()); case Protocols.VLESS: return clients.push(new Inbound.VLESSSettings.VLESS()); case Protocols.TROJAN: return clients.push(new Inbound.TrojanSettings.Trojan()); - case Protocols.SHADOWSOCKS: return clients.push(new Inbound.ShadowsocksSettings.Shadowsocks(clients[0].method)); + case Protocols.SHADOWSOCKS: return clients.push(new Inbound.ShadowsocksSettings.Shadowsocks(clients[0].method, RandomUtil.randomShadowsocksPassword(inbound.settings.method))); default: return null; } }, diff --git a/web/html/modals/inbound_modal.html b/web/html/modals/inbound_modal.html index 99d182b9..8be213a8 100644 --- a/web/html/modals/inbound_modal.html +++ b/web/html/modals/inbound_modal.html @@ -104,6 +104,8 @@ } }, SSMethodChange() { + this.inModal.inbound.settings.password = RandomUtil.randomShadowsocksPassword(this.inModal.inbound.settings.method) + if (this.inModal.inbound.isSSMultiUser) { if (this.inModal.inbound.settings.shadowsockses.length ==0){ this.inModal.inbound.settings.shadowsockses = [new Inbound.ShadowsocksSettings.Shadowsocks()]; @@ -117,6 +119,9 @@ client.method = ""; }) } + this.inModal.inbound.settings.shadowsockses.forEach(client => { + client.password = RandomUtil.randomShadowsocksPassword(this.inModal.inbound.settings.method) + }) } else { if (this.inModal.inbound.settings.shadowsockses.length > 0){ this.inModal.inbound.settings.shadowsockses = [];