mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-10 05:15:35 +08:00
fix: better update provider all
This commit is contained in:
parent
419d3e33f3
commit
68ef377f4b
@ -14,6 +14,7 @@ export default () => {
|
|||||||
const {
|
const {
|
||||||
proxyProviders,
|
proxyProviders,
|
||||||
updateProviderByProviderName,
|
updateProviderByProviderName,
|
||||||
|
updateAllProvider,
|
||||||
healthCheckByProviderName,
|
healthCheckByProviderName,
|
||||||
} = useProxies()
|
} = useProxies()
|
||||||
|
|
||||||
@ -41,13 +42,10 @@ export default () => {
|
|||||||
|
|
||||||
const onUpdateAllProviderClick = async (e: MouseEvent) => {
|
const onUpdateAllProviderClick = async (e: MouseEvent) => {
|
||||||
const el = e.target as HTMLElement
|
const el = e.target as HTMLElement
|
||||||
const list = proxyProviders().map((provider) => {
|
|
||||||
return updateProviderByProviderName(provider.name)
|
|
||||||
})
|
|
||||||
|
|
||||||
el.classList.add('animate-spin')
|
el.classList.add('animate-spin')
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
await Promise.all(list)
|
await updateAllProvider()
|
||||||
el.classList.remove('animate-spin')
|
el.classList.remove('animate-spin')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,15 @@ export function useProxies() {
|
|||||||
await updateProxy()
|
await updateProxy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateAllProvider = async () => {
|
||||||
|
await Promise.all(
|
||||||
|
proxyProviders().map((provider) => {
|
||||||
|
return request.put(`providers/proxies/${provider.name}`)
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
await updateProxy()
|
||||||
|
}
|
||||||
|
|
||||||
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: 30 * 1000, // thie api was a little bit slow sometimes...
|
timeout: 30 * 1000, // thie api was a little bit slow sometimes...
|
||||||
@ -125,6 +134,7 @@ export function useProxies() {
|
|||||||
updateProxy,
|
updateProxy,
|
||||||
setProxyGroupByProxyName,
|
setProxyGroupByProxyName,
|
||||||
updateProviderByProviderName,
|
updateProviderByProviderName,
|
||||||
|
updateAllProvider,
|
||||||
healthCheckByProviderName,
|
healthCheckByProviderName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user