|
@@ -676,13 +676,8 @@ export interface GenShadowsocksLinkInput {
|
|
|
externalProxy?: ExternalProxyEntry | null;
|
|
externalProxy?: ExternalProxyEntry | null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// Shadowsocks 2022 share link. The userinfo portion is base64(method:pw)
|
|
|
|
|
-// for single-user and base64(method:settingsPw:clientPw) for multi-user
|
|
|
|
|
-// 2022-blake3. Legacy SS (non-2022) leaves the password out of the
|
|
|
|
|
-// userinfo entirely — matches the legacy class's password-array logic.
|
|
|
|
|
-// Note: legacy `isSSMultiUser` returns true for everything except
|
|
|
|
|
-// 2022-blake3-chacha20-poly1305 (a curious classification, but we
|
|
|
|
|
-// preserve it for byte-stable parity).
|
|
|
|
|
|
|
+// Shadowsocks share link: base64(method:clientPw) for legacy SS, and
|
|
|
|
|
+// percent-encoded method:serverPw:clientPw for 2022-blake3 (SIP022).
|
|
|
export function genShadowsocksLink(input: GenShadowsocksLinkInput): string {
|
|
export function genShadowsocksLink(input: GenShadowsocksLinkInput): string {
|
|
|
const {
|
|
const {
|
|
|
inbound,
|
|
inbound,
|
|
@@ -725,10 +720,9 @@ export function genShadowsocksLink(input: GenShadowsocksLinkInput): string {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const isSS2022 = settings.method.substring(0, 4) === '2022';
|
|
const isSS2022 = settings.method.substring(0, 4) === '2022';
|
|
|
- const isSSMultiUser = settings.method !== '2022-blake3-chacha20-poly1305';
|
|
|
|
|
const passwords: string[] = [];
|
|
const passwords: string[] = [];
|
|
|
if (isSS2022) passwords.push(settings.password);
|
|
if (isSS2022) passwords.push(settings.password);
|
|
|
- if (isSSMultiUser) passwords.push(clientPassword);
|
|
|
|
|
|
|
+ passwords.push(clientPassword);
|
|
|
|
|
|
|
|
if (isSS2022) {
|
|
if (isSS2022) {
|
|
|
// SIP022 (2022-blake3-*) forbids base64 userinfo: method and each key are
|
|
// SIP022 (2022-blake3-*) forbids base64 userinfo: method and each key are
|
|
@@ -1430,10 +1424,8 @@ export function getInboundClients(inbound: Inbound): ClientShape[] | null {
|
|
|
return (inbound.settings.clients ?? []) as ClientShape[];
|
|
return (inbound.settings.clients ?? []) as ClientShape[];
|
|
|
case 'tuic':
|
|
case 'tuic':
|
|
|
return (inbound.settings.clients ?? []) as ClientShape[];
|
|
return (inbound.settings.clients ?? []) as ClientShape[];
|
|
|
- case 'shadowsocks': {
|
|
|
|
|
- const isMultiUser = inbound.settings.method !== '2022-blake3-chacha20-poly1305';
|
|
|
|
|
- return isMultiUser ? ((inbound.settings.clients ?? []) as ClientShape[]) : null;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ case 'shadowsocks':
|
|
|
|
|
+ return (inbound.settings.clients ?? []) as ClientShape[];
|
|
|
default:
|
|
default:
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
@@ -1493,18 +1485,16 @@ export function genLink(input: GenLinkInput): string {
|
|
|
flow: client.flow,
|
|
flow: client.flow,
|
|
|
externalProxy,
|
|
externalProxy,
|
|
|
});
|
|
});
|
|
|
- case 'shadowsocks': {
|
|
|
|
|
- const isMultiUser = inbound.settings.method !== '2022-blake3-chacha20-poly1305';
|
|
|
|
|
|
|
+ case 'shadowsocks':
|
|
|
return genShadowsocksLink({
|
|
return genShadowsocksLink({
|
|
|
inbound,
|
|
inbound,
|
|
|
address,
|
|
address,
|
|
|
port,
|
|
port,
|
|
|
forceTls,
|
|
forceTls,
|
|
|
remark,
|
|
remark,
|
|
|
- clientPassword: isMultiUser ? (client.password ?? '') : '',
|
|
|
|
|
|
|
+ clientPassword: client.password ?? '',
|
|
|
externalProxy,
|
|
externalProxy,
|
|
|
});
|
|
});
|
|
|
- }
|
|
|
|
|
case 'trojan':
|
|
case 'trojan':
|
|
|
return genTrojanLink({
|
|
return genTrojanLink({
|
|
|
inbound,
|
|
inbound,
|