import { For, createSignal, onMount } from 'solid-js' import { twMerge } from 'tailwind-merge' import { useRequest } from '~/signals' import type { Proxy, ProxyProvider } from '~/types' export const Proxies = () => { const request = useRequest() const [proxies, setProxies] = createSignal([]) const [delayMap, setDelayMap] = createSignal>({}) const [proxyProviders, setProxyProviders] = createSignal([]) const renderDelay = (proxyname: string) => { const delay = delayMap()[proxyname] if (typeof delay !== 'number' || delay === 0) { return '' } return {delay}ms } onMount(async () => { const { providers } = await request .get('providers/proxies') .json<{ providers: Record }>() const delay = delayMap() Object.values(providers).forEach((provider) => { provider.proxies.forEach((proxy) => { delay[proxy.name] = proxy.history[proxy.history.length - 1]?.delay }) }) setDelayMap(delay) setProxyProviders(Object.values(providers)) const { proxies } = await request .get('proxies') .json<{ proxies: Record }>() setProxies(Object.values(proxies)) }) return (

Proxies

{(proxy) => (
{proxy.name} {proxy.type}
{(proxyPoint) => (
{proxyPoint} {renderDelay(proxyPoint)}
)}
)}

Proxy Providers

{(proxy) => (
{proxy.name}
{(proxyPoint) => (
{proxyPoint.name} {renderDelay(proxyPoint.name)}
)}
)}
) }