mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-11 17:48:58 +08:00
Fix trojan URI issues
This commit is contained in:
parent
e401a31b6c
commit
99946a8795
16
backend/dist/sub-store-parser.loon.min.js
vendored
16
backend/dist/sub-store-parser.loon.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.0.8",
|
||||
"version": "2.0.9",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
@ -241,15 +241,21 @@ function URI_Trojan() {
|
||||
const [server, port] = line.split('@')[1].split('?')[0].split(':');
|
||||
const name = decodeURIComponent(line.split('#')[1].trim());
|
||||
let paramArr = line.split('?');
|
||||
let sni = null;
|
||||
let scert = null;
|
||||
let params;
|
||||
if (paramArr.length > 1) {
|
||||
paramArr = paramArr[1].split('#')[0].split('&');
|
||||
const params = new Map(
|
||||
params = new Map(
|
||||
paramArr.map((item) => {
|
||||
return item.split('=');
|
||||
}),
|
||||
);
|
||||
sni = params.get('sni');
|
||||
if (
|
||||
params.get('allowInsecure') === '1' ||
|
||||
params.get('allowInsecure') === 'true'
|
||||
) {
|
||||
scert = true;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
@ -258,7 +264,8 @@ function URI_Trojan() {
|
||||
server,
|
||||
port,
|
||||
password: line.split('@')[0],
|
||||
sni,
|
||||
sni: getIfPresent(params.get('sni')),
|
||||
'skip-cert-verify': getIfPresent(scert),
|
||||
};
|
||||
};
|
||||
return { name, test, parse };
|
||||
|
@ -144,6 +144,11 @@ function trojan(proxy) {
|
||||
}
|
||||
}
|
||||
|
||||
// over tls
|
||||
if (proxy.network !== 'ws' && needTls(proxy)) {
|
||||
append(`,over-tls=true`);
|
||||
}
|
||||
|
||||
// tls fingerprint
|
||||
appendIfPresent(
|
||||
`,tls-cert-sha256=${proxy['tls-fingerprint']}`,
|
||||
@ -327,6 +332,7 @@ function needTls(proxy) {
|
||||
proxy.tls ||
|
||||
proxy.sni ||
|
||||
typeof proxy['skip-cert-verify'] !== 'undefined' ||
|
||||
typeof proxy['tls-fingerprint'] !== 'undefined' ||
|
||||
typeof proxy['tls-host'] !== 'undefined'
|
||||
);
|
||||
}
|
||||
|
@ -15,8 +15,7 @@ const { version } = packageJson;
|
||||
console.log(
|
||||
`
|
||||
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
|
||||
𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 © 𝑷𝒆𝒏𝒈-𝒀𝑴
|
||||
Version: ${version}
|
||||
Sub-Store © Peng-YM -- v${version}
|
||||
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
|
||||
`,
|
||||
);
|
||||
|
16
backend/sub-store.min.js
vendored
16
backend/sub-store.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user