mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 05:09:01 +08:00
feat: 支持更多不规范的 VLESS/SS URI
This commit is contained in:
parent
6564d9497a
commit
64117c50c7
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.14.189",
|
||||
"version": "2.14.190",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
@ -32,8 +32,18 @@ function URI_SS() {
|
||||
// handle IPV4 and IPV6
|
||||
let serverAndPortArray = content.match(/@([^/]*)(\/|$)/);
|
||||
let userInfoStr = Base64.decode(content.split('@')[0]);
|
||||
let query = '';
|
||||
if (!serverAndPortArray) {
|
||||
// 暂时先这样处理 目前够用
|
||||
if (content.includes('?plugin=')) {
|
||||
const parsed = content.match(/^(.*)(\?plugin=.*)$/);
|
||||
content = parsed[1];
|
||||
query = parsed[2];
|
||||
}
|
||||
content = Base64.decode(content);
|
||||
if (query) {
|
||||
content = `${content}${query}`;
|
||||
}
|
||||
userInfoStr = content.split('@')[0];
|
||||
serverAndPortArray = content.match(/@([^/]*)(\/|$)/);
|
||||
}
|
||||
@ -47,7 +57,6 @@ function URI_SS() {
|
||||
const userInfo = userInfoStr.split(':');
|
||||
proxy.cipher = userInfo[0];
|
||||
proxy.password = userInfo[1];
|
||||
|
||||
// handle obfs
|
||||
const idx = content.indexOf('?plugin=');
|
||||
if (idx !== -1) {
|
||||
@ -84,6 +93,9 @@ function URI_SS() {
|
||||
);
|
||||
}
|
||||
}
|
||||
if (/(&|\?)uot=(1|true)/i.test(query)) {
|
||||
proxy['udp-over-tcp'] = true;
|
||||
}
|
||||
return proxy;
|
||||
};
|
||||
return { name, test, parse };
|
||||
@ -416,16 +428,31 @@ function URI_VLESS() {
|
||||
if (!proxy.network && isShadowrocket && params.obfs) {
|
||||
proxy.network = params.obfs;
|
||||
}
|
||||
if (['websocket'].includes(proxy.network)) {
|
||||
proxy.network = 'ws';
|
||||
}
|
||||
if (proxy.network && !['tcp', 'none'].includes(proxy.network)) {
|
||||
const opts = {};
|
||||
if (params.host) {
|
||||
opts.headers = { Host: params.host };
|
||||
const host = params.host ?? params.obfsParam;
|
||||
if (host) {
|
||||
if (params.obfsParam) {
|
||||
try {
|
||||
const parsed = JSON.parse(host);
|
||||
opts.headers = parsed;
|
||||
} catch (e) {
|
||||
opts.headers = { Host: host };
|
||||
}
|
||||
} else {
|
||||
opts.headers = { Host: host };
|
||||
}
|
||||
}
|
||||
if (params.serviceName) {
|
||||
opts[`${proxy.network}-service-name`] = params.serviceName;
|
||||
} else if (isShadowrocket && params.path) {
|
||||
opts[`${proxy.network}-service-name`] = params.path;
|
||||
delete params.path;
|
||||
if (!['ws', 'http'].includes(proxy.network)) {
|
||||
opts[`${proxy.network}-service-name`] = params.path;
|
||||
delete params.path;
|
||||
}
|
||||
}
|
||||
if (params.path) {
|
||||
opts.path = params.path;
|
||||
|
@ -39,6 +39,9 @@ export default function URI_Producer() {
|
||||
);
|
||||
}
|
||||
}
|
||||
if (proxy['udp-over-tcp']) {
|
||||
result = `${result}${proxy.plugin ? '&' : '?'}uot=1`;
|
||||
}
|
||||
result += `#${encodeURIComponent(proxy.name)}`;
|
||||
break;
|
||||
case 'ssr':
|
||||
|
Loading…
x
Reference in New Issue
Block a user