diff --git a/backend/package.json b/backend/package.json index 20db015..4beee97 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.14", + "version": "2.14.15", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/producers/clash.js b/backend/src/core/proxy-utils/producers/clash.js index 109c753..8b6519e 100644 --- a/backend/src/core/proxy-utils/producers/clash.js +++ b/backend/src/core/proxy-utils/producers/clash.js @@ -55,6 +55,26 @@ export default function Clash_Producer() { } } + if ( + ['vmess', 'vless'].includes(proxy.type) && + proxy.network === 'http' + ) { + let httpPath = proxy['http-opts']?.path; + if ( + isPresent(proxy, 'http-opts.path') && + !Array.isArray(httpPath) + ) { + proxy['http-opts'].path = [httpPath]; + } + let httpHost = proxy['http-opts']?.headers?.Host; + if ( + isPresent(proxy, 'http-opts.headers.Host') && + !Array.isArray(httpHost) + ) { + proxy['http-opts'].headers.Host = [httpHost]; + } + } + delete proxy['tls-fingerprint']; return ' - ' + JSON.stringify(proxy) + '\n'; }) diff --git a/backend/src/core/proxy-utils/producers/loon.js b/backend/src/core/proxy-utils/producers/loon.js index 57d0e3c..48fa029 100644 --- a/backend/src/core/proxy-utils/producers/loon.js +++ b/backend/src/core/proxy-utils/producers/loon.js @@ -144,12 +144,14 @@ function vmess(proxy) { ); } else if (proxy.network === 'http') { result.append(`,transport=http`); + let httpPath = proxy['http-opts']?.path; + let httpHost = proxy['http-opts']?.headers?.Host; result.appendIfPresent( - `,path=${proxy['http-opts'].path}`, + `,path=${Array.isArray(httpPath) ? httpPath[0] : httpPath}`, 'http-opts.path', ); result.appendIfPresent( - `,host=${proxy['http-opts'].headers.Host}`, + `,host=${Array.isArray(httpHost) ? httpHost[0] : httpHost}`, 'http-opts.headers.Host', ); } else { @@ -206,12 +208,14 @@ function vless(proxy) { ); } else if (proxy.network === 'http') { result.append(`,transport=http`); + let httpPath = proxy['http-opts']?.path; + let httpHost = proxy['http-opts']?.headers?.Host; result.appendIfPresent( - `,path=${proxy['http-opts'].path}`, + `,path=${Array.isArray(httpPath) ? httpPath[0] : httpPath}`, 'http-opts.path', ); result.appendIfPresent( - `,host=${proxy['http-opts'].headers.Host}`, + `,host=${Array.isArray(httpHost) ? httpHost[0] : httpHost}`, 'http-opts.headers.Host', ); } else { diff --git a/backend/src/core/proxy-utils/producers/qx.js b/backend/src/core/proxy-utils/producers/qx.js index 55cbc63..b255147 100644 --- a/backend/src/core/proxy-utils/producers/qx.js +++ b/backend/src/core/proxy-utils/producers/qx.js @@ -206,12 +206,14 @@ function vmess(proxy) { } else { throw new Error(`network ${proxy.network} is unsupported`); } + let httpPath = proxy[`${proxy.network}-opts`]?.path; + let httpHost = proxy[`${proxy.network}-opts`]?.headers?.Host; appendIfPresent( - `,obfs-uri=${proxy[`${proxy.network}-opts`].path}`, + `,obfs-uri=${Array.isArray(httpPath) ? httpPath[0] : httpPath}`, `${proxy.network}-opts.path`, ); appendIfPresent( - `,obfs-host=${proxy[`${proxy.network}-opts`].headers.Host}`, + `,obfs-host=${Array.isArray(httpHost) ? httpHost[0] : httpHost}`, `${proxy.network}-opts.headers.Host`, ); } else { diff --git a/backend/src/core/proxy-utils/producers/stash.js b/backend/src/core/proxy-utils/producers/stash.js index 30c3555..0174bff 100644 --- a/backend/src/core/proxy-utils/producers/stash.js +++ b/backend/src/core/proxy-utils/producers/stash.js @@ -58,6 +58,26 @@ export default function Stash_Producer() { } } + if ( + ['vmess', 'vless'].includes(proxy.type) && + proxy.network === 'http' + ) { + let httpPath = proxy['http-opts']?.path; + if ( + isPresent(proxy, 'http-opts.path') && + !Array.isArray(httpPath) + ) { + proxy['http-opts'].path = [httpPath]; + } + let httpHost = proxy['http-opts']?.headers?.Host; + if ( + isPresent(proxy, 'http-opts.headers.Host') && + !Array.isArray(httpHost) + ) { + proxy['http-opts'].headers.Host = [httpHost]; + } + } + delete proxy['tls-fingerprint']; return ' - ' + JSON.stringify(proxy) + '\n'; })