mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-12-27 07:34:12 +08:00
fix(config): speedtest timeout config
This commit is contained in:
parent
6c1f49480d
commit
5f1e77320d
@ -66,6 +66,6 @@ export default {
|
|||||||
lg: 'Large size',
|
lg: 'Large size',
|
||||||
switchEndpoint: 'Switch Endpoint',
|
switchEndpoint: 'Switch Endpoint',
|
||||||
switchLanguage: 'Switch Language',
|
switchLanguage: 'Switch Language',
|
||||||
requestTimeoutDuration: 'Request Timeout Duration',
|
speedtestTimeoutDuration: 'Speedtest Timeout Duration',
|
||||||
closedConnections: 'Closed Connections',
|
closedConnections: 'Closed Connections',
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,6 @@ export default {
|
|||||||
lg: '超大尺寸',
|
lg: '超大尺寸',
|
||||||
switchEndpoint: '切换后端',
|
switchEndpoint: '切换后端',
|
||||||
switchLanguage: '切换语言',
|
switchLanguage: '切换语言',
|
||||||
requestTimeoutDuration: '请求超时时间',
|
speedtestTimeoutDuration: '测速超时时间',
|
||||||
closedConnections: '已关闭连接',
|
closedConnections: '已关闭连接',
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ import {
|
|||||||
proxiesPreviewType,
|
proxiesPreviewType,
|
||||||
renderInTwoColumn,
|
renderInTwoColumn,
|
||||||
renderProxiesInSamePage,
|
renderProxiesInSamePage,
|
||||||
requestTimeoutDuration,
|
|
||||||
setAutoCloseConns,
|
setAutoCloseConns,
|
||||||
setAutoSwitchTheme,
|
setAutoSwitchTheme,
|
||||||
setFavDayTheme,
|
setFavDayTheme,
|
||||||
@ -39,11 +38,12 @@ import {
|
|||||||
setProxiesPreviewType,
|
setProxiesPreviewType,
|
||||||
setRenderInTwoColumn,
|
setRenderInTwoColumn,
|
||||||
setRenderProxiesInSamePage,
|
setRenderProxiesInSamePage,
|
||||||
setRequestTimeoutDuration,
|
|
||||||
setSelectedEndpoint,
|
setSelectedEndpoint,
|
||||||
|
setSpeedtestTimeoutDuration,
|
||||||
setTableSize,
|
setTableSize,
|
||||||
setTwemoji,
|
setTwemoji,
|
||||||
setUrlForLatencyTest,
|
setUrlForLatencyTest,
|
||||||
|
speedtestTimeoutDuration,
|
||||||
tableSize,
|
tableSize,
|
||||||
urlForLatencyTest,
|
urlForLatencyTest,
|
||||||
useRequest,
|
useRequest,
|
||||||
@ -234,14 +234,14 @@ const ConfigForm = () => {
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ConfigTitle>
|
<ConfigTitle>
|
||||||
{t('requestTimeoutDuration')} ({t('ms')})
|
{t('speedtestTimeoutDuration')} ({t('ms')})
|
||||||
</ConfigTitle>
|
</ConfigTitle>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
class="input input-bordered w-full max-w-md"
|
class="input input-bordered w-full max-w-md"
|
||||||
value={requestTimeoutDuration()}
|
value={speedtestTimeoutDuration()}
|
||||||
onChange={(e) => setRequestTimeoutDuration(Number(e.target.value))}
|
onChange={(e) => setSpeedtestTimeoutDuration(Number(e.target.value))}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -76,9 +76,9 @@ export const tableSizeClassName = (size: TAILWINDCSS_SIZE) => {
|
|||||||
return className
|
return className
|
||||||
}
|
}
|
||||||
|
|
||||||
export const [requestTimeoutDuration, setRequestTimeoutDuration] =
|
export const [speedtestTimeoutDuration, setSpeedtestTimeoutDuration] =
|
||||||
makePersisted(createSignal(10000), {
|
makePersisted(createSignal(2000), {
|
||||||
name: 'requestTimeoutDuration',
|
name: 'speedtestTimeoutDuration',
|
||||||
storage: localStorage,
|
storage: localStorage,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
import { createSignal } from 'solid-js'
|
import { createSignal } from 'solid-js'
|
||||||
import { autoCloseConns, urlForLatencyTest, useRequest } from '~/signals'
|
import {
|
||||||
|
autoCloseConns,
|
||||||
|
speedtestTimeoutDuration,
|
||||||
|
urlForLatencyTest,
|
||||||
|
useRequest,
|
||||||
|
} from '~/signals'
|
||||||
import type { Proxy, ProxyNode, ProxyProvider } from '~/types'
|
import type { Proxy, ProxyNode, ProxyProvider } from '~/types'
|
||||||
|
|
||||||
type ProxyInfo = {
|
type ProxyInfo = {
|
||||||
@ -93,7 +98,7 @@ export const useProxies = () => {
|
|||||||
.get(`group/${proxyGroupName}/delay`, {
|
.get(`group/${proxyGroupName}/delay`, {
|
||||||
searchParams: {
|
searchParams: {
|
||||||
url: urlForLatencyTest(),
|
url: urlForLatencyTest(),
|
||||||
timeout: 2000,
|
timeout: speedtestTimeoutDuration(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.json()
|
.json()
|
||||||
@ -121,7 +126,9 @@ export const useProxies = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const healthCheckByProviderName = async (providerName: string) => {
|
const healthCheckByProviderName = async (providerName: string) => {
|
||||||
await request.get(`providers/proxies/${providerName}/healthcheck`)
|
await request.get(`providers/proxies/${providerName}/healthcheck`, {
|
||||||
|
timeout: 20 * 1000,
|
||||||
|
})
|
||||||
await updateProxies()
|
await updateProxies()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { makePersisted } from '@solid-primitives/storage'
|
import { makePersisted } from '@solid-primitives/storage'
|
||||||
import ky from 'ky'
|
import ky from 'ky'
|
||||||
import { createSignal } from 'solid-js'
|
import { createSignal } from 'solid-js'
|
||||||
import { requestTimeoutDuration } from '~/signals/config'
|
|
||||||
|
|
||||||
export const [selectedEndpoint, setSelectedEndpoint] = makePersisted(
|
export const [selectedEndpoint, setSelectedEndpoint] = makePersisted(
|
||||||
createSignal(''),
|
createSignal(''),
|
||||||
@ -27,7 +26,6 @@ export const useRequest = () => {
|
|||||||
|
|
||||||
return ky.create({
|
return ky.create({
|
||||||
prefixUrl: e?.url,
|
prefixUrl: e?.url,
|
||||||
timeout: requestTimeoutDuration(),
|
|
||||||
headers: { Authorization: e?.secret ? `Bearer ${e.secret}` : '' },
|
headers: { Authorization: e?.secret ? `Bearer ${e.secret}` : '' },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user