mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-07-31 23:31:59 +08:00
fix: 传输层 path 应为以 / 开头的字符串
This commit is contained in:
parent
bee1d62a1a
commit
7d0414f8ca
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.379",
|
"version": "2.14.380",
|
||||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"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) {
|
function lastParse(proxy) {
|
||||||
if (proxy.interface) {
|
if (proxy.interface) {
|
||||||
proxy['interface-name'] = proxy.interface;
|
proxy['interface-name'] = proxy.interface;
|
||||||
@ -341,6 +354,17 @@ function lastParse(proxy) {
|
|||||||
delete proxy['ws-headers'];
|
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.type === 'trojan') {
|
||||||
if (proxy.network === 'tcp') {
|
if (proxy.network === 'tcp') {
|
||||||
delete proxy.network;
|
delete proxy.network;
|
||||||
@ -501,18 +525,6 @@ function lastParse(proxy) {
|
|||||||
proxy[`${proxy.network}-opts`].path = ['/'];
|
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)) {
|
if (['', 'off'].includes(proxy.sni)) {
|
||||||
proxy['disable-sni'] = true;
|
proxy['disable-sni'] = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user