feat: 过滤掉缺少 obfs-password 的 hysteria2

This commit is contained in:
xream committed 2026-04-08 20:45:20 +08:00
1 parent d412db1c2c
commit a8afff161a
3 files changed
+17 -2

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.21.82",
"version": "2.21.83",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {
+7
View File
@@ -88,6 +88,13 @@ function parse(raw) {
$.info(`UUID may be invalid: ${proxy.name} ${proxy.uuid}`);
}
// return isProxyUUIDValid;
} else if (['hysteria2'].includes(proxy.type)) {
if (proxy.obfs && !proxy['obfs-password']) {
$.error(
`Proxy ${proxy.name} has obfs ${proxy.obfs} but missing obfs-password`,
);
return false;
}
}
return true;
});
+9 -1
View File
@@ -2,7 +2,7 @@ import { Base64 } from 'js-base64';
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { UUID, parseOne, expectSubset } from './helpers';
import { UUID, parseAll, parseOne, expectSubset } from './helpers';
describe('Proxy URI parser coverage', function () {
describe('generic URIs', function () {
@@ -297,6 +297,14 @@ describe('Proxy URI parser coverage', function () {
});
});
it('rejects Hysteria2 salamander obfs without obfs-password', function () {
const proxies = parseAll(
'hy2://hy2-secret@hy2.example.com:443?obfs=salamander#Hy2%20Missing%20Password',
);
expect(proxies).to.deep.equal([]);
});
it('parses TUIC URIs with colon-containing passwords and booleans', function () {
const proxy = parseOne(
`tuic://${UUID}:pass%3Aword@tuic.example.com?alpn=h3,hq-29&allow-insecure=1&fast-open=1&disable-sni=1&reduce-rtt=1&congestion-control=bbr#TUIC`,