mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-12-05 02:37:50 +00:00
feat: Egern 支持 SSR; SSR 参数 protoparam 修正
This commit is contained in:
4 files changed
+36
-4
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.38.2",
|
||||
"version": "2.38.3",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
|
||||
"main": "src/main.js",
|
||||
"packageManager": "pnpm@11.0.9",
|
||||
@@ -62,4 +62,4 @@
|
||||
"peggy": "^2.0.1",
|
||||
"prettier": "2.6.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -596,7 +596,9 @@ function URI_SSR() {
|
||||
? Base64.decode(other_params.remarks)
|
||||
: proxy.server,
|
||||
'protocol-param': getIfNotBlank(
|
||||
Base64.decode(other_params.protoparam || '').replace(/\s/g, ''),
|
||||
Base64.decode(
|
||||
other_params.protoparam || other_params.protocolparam || '',
|
||||
).replace(/\s/g, ''),
|
||||
),
|
||||
'obfs-param': getIfNotBlank(
|
||||
Base64.decode(other_params.obfsparam || '').replace(/\s/g, ''),
|
||||
|
||||
@@ -1013,7 +1013,7 @@ export default function URI_Producer() {
|
||||
: ''
|
||||
}${
|
||||
proxy['protocol-param']
|
||||
? '&protocolparam=' +
|
||||
? '&protoparam=' +
|
||||
Base64.encode(proxy['protocol-param'])
|
||||
: ''
|
||||
}`;
|
||||
|
||||
@@ -2268,6 +2268,36 @@ describe('Proxy text producers', function () {
|
||||
expect(defaults).to.not.include('ipv6-cidr=');
|
||||
});
|
||||
|
||||
it('normalizes SSR protocol parameter aliases and preserves them on URI round-trips', function () {
|
||||
const canonical = Base64.encode('user:pass');
|
||||
const legacy = Base64.encode('legacy:pass');
|
||||
|
||||
for (const [query, expected] of [
|
||||
[`protoparam=${canonical}`, 'user:pass'],
|
||||
[`protocolparam=${legacy}`, 'legacy:pass'],
|
||||
[`protoparam=${canonical}&protocolparam=${legacy}`, 'user:pass'],
|
||||
[`protocolparam=${legacy}&protoparam=${canonical}`, 'user:pass'],
|
||||
[`protoparam=&protocolparam=${legacy}`, 'legacy:pass'],
|
||||
]) {
|
||||
const input = `ssr://${Base64.encode(
|
||||
`ssr.example.com:8899:auth_aes128_md5:aes-256-cfb:plain:${Base64.encode(
|
||||
'secret',
|
||||
)}/?remarks=${Base64.encode('SSR')}&${query}`,
|
||||
)}`;
|
||||
const [proxy] = ProxyUtils.parse(input);
|
||||
expect(proxy['protocol-param'], query).to.equal(expected);
|
||||
|
||||
const output = produceExternal('URI', proxy);
|
||||
const decoded = Base64.decode(output.slice(6));
|
||||
expect(decoded, query).to.include(
|
||||
`&protoparam=${Base64.encode(expected)}`,
|
||||
);
|
||||
expect(decoded, query).not.to.include('&protocolparam=');
|
||||
const [reparsed] = ProxyUtils.parse(output);
|
||||
expect(reparsed['protocol-param'], query).to.equal(expected);
|
||||
}
|
||||
});
|
||||
|
||||
it('produces URI shadowsocks links with v2ray-plugin mux and tls flags', function () {
|
||||
const plugin = encodeURIComponent(
|
||||
'v2ray-plugin;obfs=websocket;mode=websocket;obfs-host=cdn.example.com;host=cdn.example.com;path=/socket;tls;sni=sni.example.com;skip-cert-verify=true;mux=0',
|
||||
|
||||
Reference in new issue
Block a user