mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-27 22:54:03 +08:00
feat: config for delay test
This commit is contained in:
parent
40ae24f5fe
commit
e92ce75225
@ -38,4 +38,5 @@ export default {
|
|||||||
bar: 'Bar',
|
bar: 'Bar',
|
||||||
auto: 'Auto',
|
auto: 'Auto',
|
||||||
proxiesPreviewType: 'Proxies preview type',
|
proxiesPreviewType: 'Proxies preview type',
|
||||||
|
urlForDelayTest: 'Url for delay test',
|
||||||
}
|
}
|
||||||
|
@ -38,4 +38,5 @@ export default {
|
|||||||
bar: '条形',
|
bar: '条形',
|
||||||
auto: '自适应',
|
auto: '自适应',
|
||||||
proxiesPreviewType: '节点组预览样式',
|
proxiesPreviewType: '节点组预览样式',
|
||||||
|
urlForDelayTest: '测速链接',
|
||||||
}
|
}
|
||||||
|
@ -132,36 +132,52 @@ export const [proxiesPreviewType, setProxiesPreviewType] = makePersisted(
|
|||||||
createSignal(PROXIES_PREVIEW_TYPE.BAR),
|
createSignal(PROXIES_PREVIEW_TYPE.BAR),
|
||||||
{ name: 'proxiesPreviewType', storage: localStorage },
|
{ name: 'proxiesPreviewType', storage: localStorage },
|
||||||
)
|
)
|
||||||
|
export const [urlForDelayTest, setUrlForDelayTest] = makePersisted(
|
||||||
|
createSignal('https://www.gstatic.com/generate_204'),
|
||||||
|
{ name: 'urlForDelayTest', storage: localStorage },
|
||||||
|
)
|
||||||
|
|
||||||
export default () => {
|
const ConfigForXd = () => {
|
||||||
const [t] = useI18n()
|
const [t] = useI18n()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div>{t('proxiesPreviewType')}</div>
|
||||||
|
<div class="flex">
|
||||||
|
<For each={Object.values(PROXIES_PREVIEW_TYPE)}>
|
||||||
|
{(value) => (
|
||||||
|
<label class="flex items-center">
|
||||||
|
{t(value)}
|
||||||
|
<input
|
||||||
|
class="radio m-4"
|
||||||
|
aria-label={value}
|
||||||
|
type="radio"
|
||||||
|
name="proxiesPreviewType"
|
||||||
|
checked={value === proxiesPreviewType()}
|
||||||
|
onChange={() => setProxiesPreviewType(value)}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
)}
|
||||||
|
</For>
|
||||||
|
</div>
|
||||||
|
<div>{t('urlForDelayTest')}</div>
|
||||||
|
<div>
|
||||||
|
<input
|
||||||
|
class="input input-bordered w-96"
|
||||||
|
value={urlForDelayTest()}
|
||||||
|
onChange={(e) => setUrlForDelayTest(e.target?.value!)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default () => {
|
||||||
return (
|
return (
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<DNSQueryForm />
|
<DNSQueryForm />
|
||||||
|
|
||||||
<ConfigForm />
|
<ConfigForm />
|
||||||
|
<ConfigForXd />
|
||||||
<div>
|
|
||||||
<div>{t('proxiesPreviewType')}</div>
|
|
||||||
<div class="flex">
|
|
||||||
<For each={Object.values(PROXIES_PREVIEW_TYPE)}>
|
|
||||||
{(value) => (
|
|
||||||
<label class="flex items-center">
|
|
||||||
{t(value)}
|
|
||||||
<input
|
|
||||||
class="radio m-4"
|
|
||||||
aria-label={value}
|
|
||||||
type="radio"
|
|
||||||
name="proxiesPreviewType"
|
|
||||||
checked={value === proxiesPreviewType()}
|
|
||||||
onChange={() => setProxiesPreviewType(value)}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
)}
|
|
||||||
</For>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { createSignal } from 'solid-js'
|
import { createSignal } from 'solid-js'
|
||||||
|
import { urlForDelayTest } from '~/pages/Config'
|
||||||
import { useRequest } from '~/signals'
|
import { useRequest } from '~/signals'
|
||||||
import type { Proxy, ProxyNode, ProxyProvider } from '~/types'
|
import type { Proxy, ProxyNode, ProxyProvider } from '~/types'
|
||||||
|
|
||||||
@ -86,7 +87,7 @@ export function useProxies() {
|
|||||||
const data: Record<string, number> = await request
|
const data: Record<string, number> = await request
|
||||||
.get(`group/${proxyGroupName}/delay`, {
|
.get(`group/${proxyGroupName}/delay`, {
|
||||||
searchParams: {
|
searchParams: {
|
||||||
url: 'https://www.gstatic.com/generate_204',
|
url: urlForDelayTest(),
|
||||||
timeout: 2000,
|
timeout: 2000,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user