diff --git a/sub/subService.go b/sub/subService.go index d344fcfa..5de64d33 100644 --- a/sub/subService.go +++ b/sub/subService.go @@ -657,7 +657,10 @@ func (s *SubService) genShadowsocksLink(inbound *model.Inbound, email string) st } } - encPart := fmt.Sprintf("%s:%s:%s", method, inboundPassword, clients[clientIndex].Password) + encPart := fmt.Sprintf("%s:%s", method, clients[clientIndex].Password) + if method[0] == '2' { + encPart = fmt.Sprintf("%s:%s:%s", method, inboundPassword, clients[clientIndex].Password) + } link := fmt.Sprintf("ss://%s@%s:%d", base64.StdEncoding.EncodeToString([]byte(encPart)), address, inbound.Port) url, _ := url.Parse(link) q := url.Query() diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index c9eab40c..5ae0a865 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -16,9 +16,10 @@ const VmessMethods = { }; const SSMethods = { - CHACHA20_POLY1305: 'chacha20-poly1305', AES_256_GCM: 'aes-256-gcm', AES_128_GCM: 'aes-128-gcm', + CHACHA20_POLY1305: 'chacha20-poly1305', + XCHACHA20_POLY1305: 'xchacha20-poly1305', BLAKE3_AES_128_GCM: '2022-blake3-aes-128-gcm', BLAKE3_AES_256_GCM: '2022-blake3-aes-256-gcm', BLAKE3_CHACHA20_POLY1305: '2022-blake3-chacha20-poly1305', @@ -873,7 +874,10 @@ class Inbound extends XrayCommonClass { } } get isSSMultiUser() { - return [SSMethods.BLAKE3_AES_128_GCM,SSMethods.BLAKE3_AES_256_GCM].includes(this.method); + return this.method != SSMethods.BLAKE3_CHACHA20_POLY1305; + } + get isSS2022(){ + return this.method.substring(0,4) === "2022"; } get serverName() { @@ -1274,9 +1278,11 @@ class Inbound extends XrayCommonClass { break; } - let clientPassword = this.isSSMultiUser ? ':' + settings.shadowsockses[clientIndex].password : ''; + let password = new Array(); + if (this.isSSMultiUser) password.push(settings.shadowsockses[clientIndex].password); + if (this.isSS2022) password.push(settings.password); - let link = `ss://${safeBase64(settings.method + ':' + settings.password + clientPassword)}@${address}:${this.port}`; + let link = `ss://${safeBase64(settings.method + ':' + password.join(':'))}@${address}:${this.port}`; const url = new URL(link); for (const [key, value] of params) { url.searchParams.set(key, value) @@ -1872,8 +1878,9 @@ Inbound.ShadowsocksSettings = class extends Inbound.Settings { }; Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass { - constructor(password=RandomUtil.randomShadowsocksPassword(), email=RandomUtil.randomText(), totalGB=0, expiryTime=0, enable=true, tgId='', subId=RandomUtil.randomText(16,16)) { + constructor(method='', password=RandomUtil.randomShadowsocksPassword(), email=RandomUtil.randomText(), totalGB=0, expiryTime=0, enable=true, tgId='', subId=RandomUtil.randomText(16,16)) { super(); + this.method = method; this.password = password; this.email = email; this.totalGB = totalGB; @@ -1885,6 +1892,7 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass { toJson() { return { + method: this.method, password: this.password, email: this.email, totalGB: this.totalGB, @@ -1897,6 +1905,7 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass { static fromJson(json = {}) { return new Inbound.ShadowsocksSettings.Shadowsocks( + json.method, json.password, json.email, json.totalGB, diff --git a/web/html/xui/client_modal.html b/web/html/xui/client_modal.html index dcd6537b..ef4003c4 100644 --- a/web/html/xui/client_modal.html +++ b/web/html/xui/client_modal.html @@ -69,7 +69,7 @@ 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()); + case Protocols.SHADOWSOCKS: return clients.push(new Inbound.ShadowsocksSettings.Shadowsocks(clients[0].method)); default: return null; } }, diff --git a/web/html/xui/form/protocol/shadowsocks.html b/web/html/xui/form/protocol/shadowsocks.html index ef266507..808eed7d 100644 --- a/web/html/xui/form/protocol/shadowsocks.html +++ b/web/html/xui/form/protocol/shadowsocks.html @@ -125,7 +125,7 @@ -