diff --git a/src/components/ProxyNodeCard.tsx b/src/components/ProxyNodeCard.tsx index c2a14d2..1e3cdb8 100644 --- a/src/components/ProxyNodeCard.tsx +++ b/src/components/ProxyNodeCard.tsx @@ -1,7 +1,7 @@ import { createMemo } from 'solid-js' import { twMerge } from 'tailwind-merge' import { Latency } from '~/components' -import { formatProxyType } from '~/helpers' +import { filterGroupType, formatProxyType } from '~/helpers' import { useProxies } from '~/signals' export const ProxyNodeCard = (props: { @@ -32,7 +32,15 @@ export const ProxyNodeCard = (props: { )} > {formatProxyType(proxyNode()?.type)} - {proxyNode()?.udp && ' :: udp'} + {filterGroupType(proxyNode()?.type) ? ( + + {' :: '} + {proxyNode()?.xudp && 'x'} + {proxyNode()?.udp && 'udp'} + + ) : ( + {proxyNode()?.now} + )}
diff --git a/src/helpers/proxies.ts b/src/helpers/proxies.ts index e29381e..0d2958a 100644 --- a/src/helpers/proxies.ts +++ b/src/helpers/proxies.ts @@ -28,12 +28,27 @@ export const formatProxyType = (type = '') => { const t = type.toLowerCase() if (t.includes('shadowsocks')) { - return t.replace('shadowsocks', 'ss') + return 'ss' } return t } +export const filterGroupType = (type = '') => { + const t = type.toLowerCase() + const conditions = [ + 'selector', + 'direct', + 'reject', + 'urltest', + 'loadbalance', + 'fallback', + 'relay', + ] + + return !conditions.includes(t) +} + export const sortProxiesByOrderingType = ( proxyNames: string[], proxyLatencyMap: Record, diff --git a/src/pages/Proxies.tsx b/src/pages/Proxies.tsx index abcaa3d..0b7e069 100644 --- a/src/pages/Proxies.tsx +++ b/src/pages/Proxies.tsx @@ -71,7 +71,7 @@ export default () => {
- {proxy.type} :: {proxy.now} + {proxy.type} {proxy.now?.length > 0 && ` :: ${proxy.now}`}
{ newProxyNodeMap[proxy.name] = { udp: proxy.udp, + xudp: proxy.xudp, type: proxy.type, + now: proxy.now, name: proxy.name, } newLatencyMap[proxy.name] = latency diff --git a/src/types/index.d.ts b/src/types/index.d.ts index 338ebf0..bda0cf1 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -28,6 +28,7 @@ export type ProxyNode = { tfo: boolean udp: boolean xudp: boolean + now: string id: string extra: Record history: {