From cbccdf5d937cf22b084f9d9fae87f0e4a53b1d9e Mon Sep 17 00:00:00 2001 From: MystiPanda Date: Thu, 11 Jan 2024 12:34:05 +0800 Subject: [PATCH] feat: Support hide group #214 --- src/components/proxy/proxy-item-mini.tsx | 2 ++ src/components/proxy/proxy-item.tsx | 4 ++++ src/components/proxy/proxy-render.tsx | 10 +++++----- src/services/api.ts | 9 ++++++++- src/services/types.d.ts | 3 +++ 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/components/proxy/proxy-item-mini.tsx b/src/components/proxy/proxy-item-mini.tsx index c7e98bce..61d6f21a 100644 --- a/src/components/proxy/proxy-item-mini.tsx +++ b/src/components/proxy/proxy-item-mini.tsx @@ -98,6 +98,8 @@ export const ProxyItemMini = (props: Props) => { )} {proxy.type} {proxy.udp && UDP} + {proxy.xudp && XUDP} + {proxy.tfo && TFO} )} diff --git a/src/components/proxy/proxy-item.tsx b/src/components/proxy/proxy-item.tsx index d4c63c4a..ff3bc0b8 100644 --- a/src/components/proxy/proxy-item.tsx +++ b/src/components/proxy/proxy-item.tsx @@ -104,6 +104,10 @@ export const ProxyItem = (props: Props) => { )} {showType && {proxy.type}} {showType && proxy.udp && UDP} + {showType && proxy.xudp && ( + XUDP + )} + {showType && proxy.tfo && TFO} } /> diff --git a/src/components/proxy/proxy-render.tsx b/src/components/proxy/proxy-render.tsx index 012064a1..a987abc7 100644 --- a/src/components/proxy/proxy-render.tsx +++ b/src/components/proxy/proxy-render.tsx @@ -31,7 +31,7 @@ export const ProxyRender = (props: RenderProps) => { props; const { type, group, headState, proxy, proxyCol } = item; - if (type === 0) { + if (type === 0 && !group.hidden) { return ( { ); } - if (type === 1) { + if (type === 1 && !group.hidden) { return ( { ); } - if (type === 2) { + if (type === 2 && !group.hidden) { return ( { ); } - if (type === 3) { + if (type === 3 && !group.hidden) { return ( { ); } - if (type === 4) { + if (type === 4 && !group.hidden) { return ( { const generateItem = (name: string) => { if (proxyRecord[name]) return proxyRecord[name]; if (providerMap[name]) return providerMap[name]; - return { name, type: "unknown", udp: false, history: [] }; + return { + name, + type: "unknown", + udp: false, + xudp: false, + tfo: false, + history: [], + }; }; const { GLOBAL: global, DIRECT: direct, REJECT: reject } = proxyRecord; diff --git a/src/services/types.d.ts b/src/services/types.d.ts index e38c6f41..10da3a5f 100644 --- a/src/services/types.d.ts +++ b/src/services/types.d.ts @@ -44,12 +44,15 @@ interface IProxyItem { name: string; type: string; udp: boolean; + xudp: boolean; + tfo: boolean; history: { time: string; delay: number; }[]; all?: string[]; now?: string; + hidden?: boolean; provider?: string; // 记录是否来自provider }