feat: restrict proxy group selection to Selector type in home node card

- Only Selector-type groups are available for selection in the group dropdown on the home page node card.
- Node (proxy) selection remains unrestricted.
- Improves user experience and avoids confusion with non-selector groups.
This commit is contained in:
Tunglies
2025-05-22 11:38:26 +08:00
parent b1c31f7a6f
commit 5b2f946828

View File

@@ -197,8 +197,9 @@ export const CurrentProxyCard = () => {
if (!proxies) return;
setState((prev) => {
// 只保留 Selector 类型的组用于选择
const filteredGroups = proxies.groups
.filter((g: { name: string }) => g.name !== "DIRECT" && g.name !== "REJECT")
.filter((g: { name: string; type?: string }) => g.type === "Selector")
.map((g: { name: string; now: string; all: Array<{ name: string }> }) => ({
name: g.name,
now: g.now || "",
@@ -225,7 +226,7 @@ export const CurrentProxyCard = () => {
// 如果当前组不存在或为空,自动选择第一个 selector 类型的组
if (!currentGroup && filteredGroups.length > 0) {
const selectorGroup = filteredGroups.find((g: { type: string }) => g.type === "Selector");
const selectorGroup = filteredGroups[0];
if (selectorGroup) {
newGroup = selectorGroup.name;
newProxy = selectorGroup.now || selectorGroup.all[0] || "";