mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-12-27 07:34:12 +08:00
fix(proxies): group type does not show UDP
This commit is contained in:
parent
9973c2042c
commit
f0fbe09838
@ -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) ? (
|
||||
<span>
|
||||
{' :: '}
|
||||
{proxyNode()?.xudp && 'x'}
|
||||
{proxyNode()?.udp && 'udp'}
|
||||
</span>
|
||||
) : (
|
||||
<span>{proxyNode()?.now}</span>
|
||||
)}
|
||||
</div>
|
||||
<div class="text-xs">
|
||||
<Latency name={props.proxyName} />
|
||||
|
@ -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<string, number>,
|
||||
|
@ -71,7 +71,7 @@ export default () => {
|
||||
</Button>
|
||||
</div>
|
||||
<div class="text-sm text-slate-500">
|
||||
{proxy.type} :: {proxy.now}
|
||||
{proxy.type} {proxy.now?.length > 0 && ` :: ${proxy.now}`}
|
||||
</div>
|
||||
<Show when={!collapsedMap()[`group-${proxy.name}`]}>
|
||||
<ProxyNodePreview
|
||||
|
@ -5,6 +5,8 @@ import type { Proxy, ProxyNode, ProxyProvider } from '~/types'
|
||||
type ProxyInfo = {
|
||||
name: string
|
||||
udp: boolean
|
||||
now: string
|
||||
xudp: boolean
|
||||
type: string
|
||||
}
|
||||
// these signals should be global state
|
||||
@ -25,7 +27,9 @@ const setProxiesInfo = (proxies: (Proxy | ProxyNode)[]) => {
|
||||
|
||||
newProxyNodeMap[proxy.name] = {
|
||||
udp: proxy.udp,
|
||||
xudp: proxy.xudp,
|
||||
type: proxy.type,
|
||||
now: proxy.now,
|
||||
name: proxy.name,
|
||||
}
|
||||
newLatencyMap[proxy.name] = latency
|
||||
|
1
src/types/index.d.ts
vendored
1
src/types/index.d.ts
vendored
@ -28,6 +28,7 @@ export type ProxyNode = {
|
||||
tfo: boolean
|
||||
udp: boolean
|
||||
xudp: boolean
|
||||
now: string
|
||||
id: string
|
||||
extra: Record<string, unknown>
|
||||
history: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user