Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorShishkevich D. <135337715+shishkevichd@users.noreply.github.com>2025-06-20 15:30:46 +0300
committerGitHub <noreply@github.com>2025-06-20 15:30:46 +0300
commit2e6faf69e62274a35611eb20b0e0a05251c4a8cd (patch)
tree4d4d66fe8901bdc20d9776bfa928c95ec32b8a1b /web
parentf88b7b07f008470fb46c280a3cbedf7a5c838126 (diff)
fix: generate correct keys for shadowsocks inbounds
Diffstat (limited to 'web')
-rw-r--r--web/assets/js/model/inbound.js4
-rw-r--r--web/assets/js/util/index.js10
-rw-r--r--web/html/form/client.html2
-rw-r--r--web/html/form/protocol/shadowsocks.html2
4 files changed, 12 insertions, 6 deletions
diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js
index 2a5fb6d6..5228001c 100644
--- a/web/assets/js/model/inbound.js
+++ b/web/assets/js/model/inbound.js
@@ -2150,7 +2150,7 @@ Inbound.TrojanSettings.Fallback = class extends XrayCommonClass {
Inbound.ShadowsocksSettings = class extends Inbound.Settings {
constructor(protocol,
method = SSMethods.BLAKE3_AES_256_GCM,
- password = RandomUtil.randomShadowsocksPassword(),
+ password = '',
network = 'tcp,udp',
shadowsockses = [new Inbound.ShadowsocksSettings.Shadowsocks()],
ivCheck = false,
@@ -2188,7 +2188,7 @@ Inbound.ShadowsocksSettings = class extends Inbound.Settings {
Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
constructor(
method = '',
- password = RandomUtil.randomShadowsocksPassword(),
+ password = '',
email = RandomUtil.randomLowerAndNum(8),
limitIp = 0,
totalGB = 0,
diff --git a/web/assets/js/util/index.js b/web/assets/js/util/index.js
index 0d869af6..c40e02c4 100644
--- a/web/assets/js/util/index.js
+++ b/web/assets/js/util/index.js
@@ -138,8 +138,14 @@ class RandomUtil {
}
}
- static randomShadowsocksPassword() {
- const array = new Uint8Array(32);
+ static randomShadowsocksPassword(method = SSMethods.BLAKE3_AES_256_GCM) {
+ let length = 32;
+
+ if ([SSMethods.BLAKE3_AES_128_GCM].includes(method)) {
+ length = 16;
+ }
+
+ const array = new Uint8Array(length);
window.crypto.getRandomValues(array);
diff --git a/web/html/form/client.html b/web/html/form/client.html
index c67f1470..846bbd13 100644
--- a/web/html/form/client.html
+++ b/web/html/form/client.html
@@ -22,7 +22,7 @@
<span>{{ i18n "reset" }}</span>
</template>
{{ i18n "password" }}
- <a-icon v-if="inbound.protocol === Protocols.SHADOWSOCKS"@click="client.password = RandomUtil.randomShadowsocksPassword()" type="sync"></a-icon>
+ <a-icon v-if="inbound.protocol === Protocols.SHADOWSOCKS" @click="client.password = RandomUtil.randomShadowsocksPassword(inbound.settings.method)" type="sync"></a-icon>
<a-icon v-if="inbound.protocol === Protocols.TROJAN" @click="client.password = RandomUtil.randomSeq(10)"type="sync"> </a-icon>
</a-tooltip>
</template>
diff --git a/web/html/form/protocol/shadowsocks.html b/web/html/form/protocol/shadowsocks.html
index b9813afb..06e12075 100644
--- a/web/html/form/protocol/shadowsocks.html
+++ b/web/html/form/protocol/shadowsocks.html
@@ -31,7 +31,7 @@
<a-tooltip>
<template slot="title">
<span>{{ i18n "reset" }}</span>
- </template> Password <a-icon @click="inbound.settings.password = RandomUtil.randomShadowsocksPassword()" type="sync"></a-icon>
+ </template> Password <a-icon @click="inbound.settings.password = RandomUtil.randomShadowsocksPassword(inbound.settings.method)" type="sync"></a-icon>
</a-tooltip>
</template>
<a-input v-model.trim="inbound.settings.password"></a-input>