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
+11 -1
View File
@@ -78,11 +78,21 @@ test("compact management flows, drag persistence, filters and mobile layout", as
await page.mouse.move(to!.x + 15, to!.y + 15, { steps: 12 });
await page.mouse.up();
await expect.poll(labels).toEqual([initial[1], initial[2], initial[0]]);
await main.getByRole("button", { name: "保存顺序", exact: true }).click();
await main.getByRole("button", { name: "保存主分组", exact: true }).click();
await expect(main.locator(".action-row [role=status]")).toHaveText("已保存");
await page.reload();
await expect.poll(labels).toEqual([initial[1], initial[2], initial[0]]);
const hidden = main.getByRole("checkbox", { name: `主分组隐藏 ${initial[0]}`, exact: true });
await hidden.check();
await main.getByRole("button", { name: "保存主分组", exact: true }).click();
await expect(main.locator(".action-row [role=status]")).toHaveText("已保存");
await page.reload();
await expect(hidden).toBeChecked();
await hidden.uncheck();
await main.getByRole("button", { name: "撤销修改" }).click();
await expect(hidden).toBeChecked();
const newGroup = page
.locator("details")
.filter({ has: page.locator("summary", { hasText: "新建分组" }) });
+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",