feat: 支持主分组隐藏节点并保留排序

This commit is contained in:
2026-10-05 10:00:06 +08:00
parent b6aa2bf30d
commit 6ed0307ea9
8 changed files with 124 additions and 14 deletions
+7
View File
@@ -107,6 +107,13 @@ test("mixed subscriptions preserve order, names, group references, credentials a
assert.equal(result["proxy-groups"][0].name, settings.profileName);
assert.equal(result["proxy-groups"][1].name, settings.proxyGroups[0].name);
assert.equal(result.proxies.length, 2);
const hiddenResult = parse(buildSubscriptionConfig({user, nodes: [hy2, custom], settings: {...settings, mainProxyGroupHiddenSlugs: ["hy2"]}}));
assert.deepEqual(hiddenResult["proxy-groups"][0].proxies, [proxy.name]);
assert.deepEqual(hiddenResult["proxy-groups"][1].proxies, [proxy.name, hy2.client_name]);
assert.equal(hiddenResult.proxies.length, 2);
const emptyResult = parse(buildSubscriptionConfig({user, nodes: [hy2, custom], settings: {...settings, mainProxyGroupHiddenSlugs: ["hy2", "custom"]}}));
assert.deepEqual(emptyResult["proxy-groups"][0].proxies, ["DIRECT"]);
// Custom-only subscriptions do not require HY2 credentials.
assert.deepEqual(
parse(
+8
View File
@@ -47,6 +47,14 @@ test("existing v4 boots and custom nodes stay outside HY2 polling/auth while ret
[91],
);
assert.equal((await store.listSubscriptionNodes()).length, 2);
assert.deepEqual((await store.getSubscriptionSettings()).mainProxyGroupHiddenSlugs, []);
await store.saveMainProxyGroupMemberSlugs(["existing-hy2"], ["existing-hy2"]);
assert.deepEqual((await store.getSubscriptionSettings()).mainProxyGroupHiddenSlugs, ["existing-hy2"]);
await store.saveMainProxyGroupMemberSlugs(["existing-custom"]);
assert.deepEqual((await store.getSubscriptionSettings()).mainProxyGroupHiddenSlugs, ["existing-hy2"]);
await store.saveMainProxyGroupMemberSlugs([], []);
assert.deepEqual((await store.getSubscriptionSettings()).mainProxyGroupHiddenSlugs, []);
assert.equal(
(await verifyNodeToken("existing-custom", "test-original-auth")).reason,
"node_not_hy2",