feat: Support hide group

#214
This commit is contained in:
MystiPanda 2024-01-11 12:34:05 +08:00
parent a46f3a31e1
commit cbccdf5d93
5 changed files with 22 additions and 6 deletions

View File

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

View File

@ -104,6 +104,10 @@ export const ProxyItem = (props: Props) => {
)} )}
{showType && <TypeBox component="span">{proxy.type}</TypeBox>} {showType && <TypeBox component="span">{proxy.type}</TypeBox>}
{showType && proxy.udp && <TypeBox component="span">UDP</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>}
</> </>
} }
/> />

View File

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

View File

@ -119,7 +119,14 @@ export const getProxies = async () => {
const generateItem = (name: string) => { const generateItem = (name: string) => {
if (proxyRecord[name]) return proxyRecord[name]; if (proxyRecord[name]) return proxyRecord[name];
if (providerMap[name]) return providerMap[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; const { GLOBAL: global, DIRECT: direct, REJECT: reject } = proxyRecord;

View File

@ -44,12 +44,15 @@ interface IProxyItem {
name: string; name: string;
type: string; type: string;
udp: boolean; udp: boolean;
xudp: boolean;
tfo: boolean;
history: { history: {
time: string; time: string;
delay: number; delay: number;
}[]; }[];
all?: string[]; all?: string[];
now?: string; now?: string;
hidden?: boolean;
provider?: string; // 记录是否来自provider provider?: string; // 记录是否来自provider
} }