mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-07-31 01:52:04 +08:00
fix: 传输层 path 应为以 / 开头的字符串
This commit is contained in:
parent
bee1d62a1a
commit
7d0414f8ca
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.14.379",
|
||||
"version": "2.14.380",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
@ -313,6 +313,19 @@ function safeMatch(parser, line) {
|
||||
}
|
||||
}
|
||||
|
||||
function formatTransportPath(path) {
|
||||
if (typeof path === 'string' || typeof path === 'number') {
|
||||
path = String(path).trim();
|
||||
|
||||
if (path === '') {
|
||||
return '/';
|
||||
} else if (!path.startsWith('/')) {
|
||||
return '/' + path;
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
function lastParse(proxy) {
|
||||
if (proxy.interface) {
|
||||
proxy['interface-name'] = proxy.interface;
|
||||
@ -341,6 +354,17 @@ function lastParse(proxy) {
|
||||
delete proxy['ws-headers'];
|
||||
}
|
||||
|
||||
const transportPath = proxy[`${proxy.network}-opts`]?.path;
|
||||
|
||||
if (Array.isArray(transportPath)) {
|
||||
proxy[`${proxy.network}-opts`].path = transportPath.map((item) =>
|
||||
formatTransportPath(item),
|
||||
);
|
||||
} else if (transportPath != null) {
|
||||
proxy[`${proxy.network}-opts`].path =
|
||||
formatTransportPath(transportPath);
|
||||
}
|
||||
|
||||
if (proxy.type === 'trojan') {
|
||||
if (proxy.network === 'tcp') {
|
||||
delete proxy.network;
|
||||
@ -501,18 +525,6 @@ function lastParse(proxy) {
|
||||
proxy[`${proxy.network}-opts`].path = ['/'];
|
||||
}
|
||||
}
|
||||
const transportPath = proxy[`${proxy.network}-opts`]?.path;
|
||||
if (Array.isArray(transportPath)) {
|
||||
transportPath.forEach((path, index) => {
|
||||
if (!path.startsWith('/')) {
|
||||
proxy[`${proxy.network}-opts`].path[index] = `/${path}`;
|
||||
}
|
||||
});
|
||||
} else if (transportPath) {
|
||||
if (!transportPath.startsWith('/')) {
|
||||
proxy[`${proxy.network}-opts`].path = `/${transportPath}`;
|
||||
}
|
||||
}
|
||||
if (['', 'off'].includes(proxy.sni)) {
|
||||
proxy['disable-sni'] = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user