fix: 修复 Loon Shadow TLS

This commit is contained in:
xream 2025-01-09 09:30:16 +08:00
parent 128353a7f3
commit 797ba6f601
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.16.6",
"version": "2.16.7",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {

View File

@ -66,6 +66,8 @@ function shadowsocks(proxy, includeUnsupportedProxy) {
`${proxy.name}=shadowsocks,${proxy.server},${proxy.port},${proxy.cipher},"${proxy.password}"`,
);
let isShadowTLS;
// obfs
if (isPresent(proxy, 'plugin')) {
if (proxy.plugin === 'obfs') {
@ -97,6 +99,7 @@ function shadowsocks(proxy, includeUnsupportedProxy) {
);
// udp-port
result.appendIfPresent(`,udp-port=${proxy['udp-port']}`, 'udp-port');
isShadowTLS = true;
} else if (['shadow-tls'].includes(proxy.plugin) && proxy['plugin-opts']) {
const password = proxy['plugin-opts'].password;
const host = proxy['plugin-opts'].host;
@ -119,6 +122,7 @@ function shadowsocks(proxy, includeUnsupportedProxy) {
`,udp-port=${proxy['udp-port']}`,
'udp-port',
);
isShadowTLS = true;
}
}
@ -130,7 +134,7 @@ function shadowsocks(proxy, includeUnsupportedProxy) {
result.append(`,udp=true`);
}
if (!includeUnsupportedProxy && result.includes(',shadow-tls-password=')) {
if (!includeUnsupportedProxy && isShadowTLS) {
throw new Error(
`shadow-tls is not supported(请使用 includeUnsupportedProxy 参数)`,
);