feat: 支持 Shadowsocks 2022 的 URI 输入/输出

This commit is contained in:
xream
2024-12-15 23:03:41 +08:00
parent bd87e9231e
commit 06f3e97af2
3 changed files with 26 additions and 10 deletions

View File

@@ -29,9 +29,13 @@ export default function URI_Producer() {
switch (proxy.type) {
case 'ss':
const userinfo = `${proxy.cipher}:${proxy.password}`;
result = `ss://${Base64.encode(userinfo)}@${proxy.server}:${
proxy.port
}${proxy.plugin ? '/' : ''}`;
result = `ss://${
proxy.cipher?.startsWith('2022-blake3-')
? `${encodeURIComponent(
proxy.cipher,
)}:${encodeURIComponent(proxy.password)}`
: Base64.encode(userinfo)
}@${proxy.server}:${proxy.port}${proxy.plugin ? '/' : ''}`;
if (proxy.plugin) {
result += '?plugin=';
const opts = proxy['plugin-opts'];