feat: 兼容更多 TUIC URI 字段

This commit is contained in:
xream 2025-02-14 23:27:01 +08:00
parent 5058662651
commit 4ef4431c2c
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
3 changed files with 12 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "sub-store", "name": "sub-store",
"version": "2.16.41", "version": "2.16.42",
"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": {

View File

@ -869,12 +869,14 @@ function URI_TUIC() {
value = decodeURIComponent(value); value = decodeURIComponent(value);
if (['alpn'].includes(key)) { if (['alpn'].includes(key)) {
proxy[key] = value ? value.split(',') : undefined; 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); proxy['skip-cert-verify'] = /(TRUE)|1/i.test(value);
} else if (['disable-sni', 'reduce-rtt'].includes(key)) { } else if (['fast_open'].includes(key)) {
proxy[key] = /(TRUE)|1/i.test(value); proxy.tfo = true;
} else if (['disable_sni', 'reduce_rtt'].includes(key)) {
proxy[key.replace(/_/g, '-')] = /(TRUE)|1/i.test(value);
} else { } else {
proxy[key] = value; proxy[key.replace(/_/g, '-')] = value;
} }
} }

View File

@ -521,10 +521,13 @@ export default function URI_Producer() {
['disable-sni', 'reduce-rtt'].includes(key) && ['disable-sni', 'reduce-rtt'].includes(key) &&
proxy[key] proxy[key]
) { ) {
tuicParams.push(`${i}=1`); tuicParams.push(`${i.replace(/-/g, '_')}=1`);
} else if (proxy[key]) { } else if (proxy[key]) {
tuicParams.push( tuicParams.push(
`${i}=${encodeURIComponent(proxy[key])}`, `${i.replace(
/-/g,
'_',
)}=${encodeURIComponent(proxy[key])}`,
); );
} }
} }