Prechádzať zdrojové kódy

feat: Support hide group

#214
MystiPanda 1 rok pred
rodič
commit
6f03b72368

+ 2 - 0
src/components/proxy/proxy-item-mini.tsx

@@ -98,6 +98,8 @@ export const ProxyItemMini = (props: Props) => {
             )}
             <TypeBox component="span">{proxy.type}</TypeBox>
             {proxy.udp && <TypeBox component="span">UDP</TypeBox>}
+            {proxy.xudp && <TypeBox component="span">XUDP</TypeBox>}
+            {proxy.tfo && <TypeBox component="span">TFO</TypeBox>}
           </Box>
         )}
       </Box>

+ 4 - 0
src/components/proxy/proxy-item.tsx

@@ -104,6 +104,10 @@ export const ProxyItem = (props: Props) => {
               )}
               {showType && <TypeBox component="span">{proxy.type}</TypeBox>}
               {showType && proxy.udp && <TypeBox component="span">UDP</TypeBox>}
+              {showType && proxy.xudp && (
+                <TypeBox component="span">XUDP</TypeBox>
+              )}
+              {showType && proxy.tfo && <TypeBox component="span">TFO</TypeBox>}
             </>
           }
         />

+ 5 - 5
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 (
       <ListItemButton
         dense
@@ -61,7 +61,7 @@ export const ProxyRender = (props: RenderProps) => {
     );
   }
 
-  if (type === 1) {
+  if (type === 1 && !group.hidden) {
     return (
       <ProxyHead
         sx={{ pl: indent ? 4.5 : 2.5, pr: 3, mt: indent ? 1 : 0.5, mb: 1 }}
@@ -74,7 +74,7 @@ export const ProxyRender = (props: RenderProps) => {
     );
   }
 
-  if (type === 2) {
+  if (type === 2 && !group.hidden) {
     return (
       <ProxyItem
         groupName={group.name}
@@ -87,7 +87,7 @@ export const ProxyRender = (props: RenderProps) => {
     );
   }
 
-  if (type === 3) {
+  if (type === 3 && !group.hidden) {
     return (
       <Box
         sx={{
@@ -105,7 +105,7 @@ export const ProxyRender = (props: RenderProps) => {
     );
   }
 
-  if (type === 4) {
+  if (type === 4 && !group.hidden) {
     return (
       <Box
         sx={{

+ 8 - 1
src/services/api.ts

@@ -119,7 +119,14 @@ export const getProxies = async () => {
   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;

+ 3 - 0
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
 }