Skip to content

Commit

Permalink
feat: 兼容更多 TUIC URI 字段
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Feb 14, 2025
1 parent 5058662 commit 4ef4431
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.16.41",
"version": "2.16.42",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {
Expand Down
10 changes: 6 additions & 4 deletions backend/src/core/proxy-utils/parsers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,12 +869,14 @@ function URI_TUIC() {
value = decodeURIComponent(value);
if (['alpn'].includes(key)) {
proxy[key] = value ? value.split(',') : undefined;
} else if (['allow-insecure'].includes(key)) {
} else if (['allow_insecure'].includes(key)) {
proxy['skip-cert-verify'] = /(TRUE)|1/i.test(value);
} else if (['disable-sni', 'reduce-rtt'].includes(key)) {
proxy[key] = /(TRUE)|1/i.test(value);
} else if (['fast_open'].includes(key)) {
proxy.tfo = true;
} else if (['disable_sni', 'reduce_rtt'].includes(key)) {
proxy[key.replace(/_/g, '-')] = /(TRUE)|1/i.test(value);
} else {
proxy[key] = value;
proxy[key.replace(/_/g, '-')] = value;
}
}

Expand Down
7 changes: 5 additions & 2 deletions backend/src/core/proxy-utils/producers/uri.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,13 @@ export default function URI_Producer() {
['disable-sni', 'reduce-rtt'].includes(key) &&
proxy[key]
) {
tuicParams.push(`${i}=1`);
tuicParams.push(`${i.replace(/-/g, '_')}=1`);
} else if (proxy[key]) {
tuicParams.push(
`${i}=${encodeURIComponent(proxy[key])}`,
`${i.replace(
/-/g,
'_',
)}=${encodeURIComponent(proxy[key])}`,
);
}
}
Expand Down

0 comments on commit 4ef4431

Please sign in to comment.