mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
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:
@@ -197,8 +197,9 @@ export const CurrentProxyCard = () => {
|
|||||||
if (!proxies) return;
|
if (!proxies) return;
|
||||||
|
|
||||||
setState((prev) => {
|
setState((prev) => {
|
||||||
|
// 只保留 Selector 类型的组用于选择
|
||||||
const filteredGroups = proxies.groups
|
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 }> }) => ({
|
.map((g: { name: string; now: string; all: Array<{ name: string }> }) => ({
|
||||||
name: g.name,
|
name: g.name,
|
||||||
now: g.now || "",
|
now: g.now || "",
|
||||||
@@ -225,7 +226,7 @@ export const CurrentProxyCard = () => {
|
|||||||
|
|
||||||
// 如果当前组不存在或为空,自动选择第一个 selector 类型的组
|
// 如果当前组不存在或为空,自动选择第一个 selector 类型的组
|
||||||
if (!currentGroup && filteredGroups.length > 0) {
|
if (!currentGroup && filteredGroups.length > 0) {
|
||||||
const selectorGroup = filteredGroups.find((g: { type: string }) => g.type === "Selector");
|
const selectorGroup = filteredGroups[0];
|
||||||
if (selectorGroup) {
|
if (selectorGroup) {
|
||||||
newGroup = selectorGroup.name;
|
newGroup = selectorGroup.name;
|
||||||
newProxy = selectorGroup.now || selectorGroup.all[0] || "";
|
newProxy = selectorGroup.now || selectorGroup.all[0] || "";
|
||||||
|
|||||||
Reference in New Issue
Block a user