mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-12-28 07:54:13 +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 { createMemo } from 'solid-js'
|
||||||
import { twMerge } from 'tailwind-merge'
|
import { twMerge } from 'tailwind-merge'
|
||||||
import { Latency } from '~/components'
|
import { Latency } from '~/components'
|
||||||
import { formatProxyType } from '~/helpers'
|
import { filterGroupType, formatProxyType } from '~/helpers'
|
||||||
import { useProxies } from '~/signals'
|
import { useProxies } from '~/signals'
|
||||||
|
|
||||||
export const ProxyNodeCard = (props: {
|
export const ProxyNodeCard = (props: {
|
||||||
@ -32,7 +32,15 @@ export const ProxyNodeCard = (props: {
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{formatProxyType(proxyNode()?.type)}
|
{formatProxyType(proxyNode()?.type)}
|
||||||
{proxyNode()?.udp && ' :: udp'}
|
{filterGroupType(proxyNode()?.type) ? (
|
||||||
|
<span>
|
||||||
|
{' :: '}
|
||||||
|
{proxyNode()?.xudp && 'x'}
|
||||||
|
{proxyNode()?.udp && 'udp'}
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span>{proxyNode()?.now}</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xs">
|
<div class="text-xs">
|
||||||
<Latency name={props.proxyName} />
|
<Latency name={props.proxyName} />
|
||||||
|
@ -28,12 +28,27 @@ export const formatProxyType = (type = '') => {
|
|||||||
const t = type.toLowerCase()
|
const t = type.toLowerCase()
|
||||||
|
|
||||||
if (t.includes('shadowsocks')) {
|
if (t.includes('shadowsocks')) {
|
||||||
return t.replace('shadowsocks', 'ss')
|
return 'ss'
|
||||||
}
|
}
|
||||||
|
|
||||||
return t
|
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 = (
|
export const sortProxiesByOrderingType = (
|
||||||
proxyNames: string[],
|
proxyNames: string[],
|
||||||
proxyLatencyMap: Record<string, number>,
|
proxyLatencyMap: Record<string, number>,
|
||||||
|
@ -71,7 +71,7 @@ export default () => {
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm text-slate-500">
|
<div class="text-sm text-slate-500">
|
||||||
{proxy.type} :: {proxy.now}
|
{proxy.type} {proxy.now?.length > 0 && ` :: ${proxy.now}`}
|
||||||
</div>
|
</div>
|
||||||
<Show when={!collapsedMap()[`group-${proxy.name}`]}>
|
<Show when={!collapsedMap()[`group-${proxy.name}`]}>
|
||||||
<ProxyNodePreview
|
<ProxyNodePreview
|
||||||
|
@ -5,6 +5,8 @@ import type { Proxy, ProxyNode, ProxyProvider } from '~/types'
|
|||||||
type ProxyInfo = {
|
type ProxyInfo = {
|
||||||
name: string
|
name: string
|
||||||
udp: boolean
|
udp: boolean
|
||||||
|
now: string
|
||||||
|
xudp: boolean
|
||||||
type: string
|
type: string
|
||||||
}
|
}
|
||||||
// these signals should be global state
|
// these signals should be global state
|
||||||
@ -25,7 +27,9 @@ const setProxiesInfo = (proxies: (Proxy | ProxyNode)[]) => {
|
|||||||
|
|
||||||
newProxyNodeMap[proxy.name] = {
|
newProxyNodeMap[proxy.name] = {
|
||||||
udp: proxy.udp,
|
udp: proxy.udp,
|
||||||
|
xudp: proxy.xudp,
|
||||||
type: proxy.type,
|
type: proxy.type,
|
||||||
|
now: proxy.now,
|
||||||
name: proxy.name,
|
name: proxy.name,
|
||||||
}
|
}
|
||||||
newLatencyMap[proxy.name] = latency
|
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
|
tfo: boolean
|
||||||
udp: boolean
|
udp: boolean
|
||||||
xudp: boolean
|
xudp: boolean
|
||||||
|
now: string
|
||||||
id: string
|
id: string
|
||||||
extra: Record<string, unknown>
|
extra: Record<string, unknown>
|
||||||
history: {
|
history: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user