mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-14 18:35:34 +08:00
fix: Encode name to prevent request failure due to '/' in URL (#734)
This commit is contained in:
parent
ce4f67d650
commit
c121167407
@ -135,14 +135,14 @@ export const fetchProxiesAPI = () => {
|
|||||||
export const updateProxyProviderAPI = (providerName: string) => {
|
export const updateProxyProviderAPI = (providerName: string) => {
|
||||||
const request = useRequest()
|
const request = useRequest()
|
||||||
|
|
||||||
return request.put(`providers/proxies/${providerName}`)
|
return request.put(`providers/proxies/${encodeURIComponent(providerName)}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const proxyProviderHealthCheckAPI = (providerName: string) => {
|
export const proxyProviderHealthCheckAPI = (providerName: string) => {
|
||||||
const request = useRequest()
|
const request = useRequest()
|
||||||
|
|
||||||
return request
|
return request
|
||||||
.get(`providers/proxies/${providerName}/healthcheck`, {
|
.get(`providers/proxies/${encodeURIComponent(providerName)}/healthcheck`, {
|
||||||
timeout: 5 * 1000,
|
timeout: 5 * 1000,
|
||||||
})
|
})
|
||||||
.json<Record<string, number>>()
|
.json<Record<string, number>>()
|
||||||
@ -151,7 +151,7 @@ export const proxyProviderHealthCheckAPI = (providerName: string) => {
|
|||||||
export const selectProxyInGroupAPI = (groupName: string, proxyName: string) => {
|
export const selectProxyInGroupAPI = (groupName: string, proxyName: string) => {
|
||||||
const request = useRequest()
|
const request = useRequest()
|
||||||
|
|
||||||
return request.put(`proxies/${groupName}`, {
|
return request.put(`proxies/${encodeURIComponent(groupName)}`, {
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
name: proxyName,
|
name: proxyName,
|
||||||
}),
|
}),
|
||||||
@ -173,7 +173,7 @@ export const proxyLatencyTestAPI = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return request
|
return request
|
||||||
.get(`proxies/${proxyName}/delay`, {
|
.get(`proxies/${encodeURIComponent(proxyName)}/delay`, {
|
||||||
searchParams: {
|
searchParams: {
|
||||||
url,
|
url,
|
||||||
timeout,
|
timeout,
|
||||||
@ -190,7 +190,7 @@ export const proxyGroupLatencyTestAPI = (
|
|||||||
const request = useRequest()
|
const request = useRequest()
|
||||||
|
|
||||||
return request
|
return request
|
||||||
.get(`group/${groupName}/delay`, {
|
.get(`group/${encodeURIComponent(groupName)}/delay`, {
|
||||||
searchParams: {
|
searchParams: {
|
||||||
url,
|
url,
|
||||||
timeout,
|
timeout,
|
||||||
@ -216,7 +216,7 @@ export const fetchRuleProvidersAPI = () => {
|
|||||||
export const updateRuleProviderAPI = (providerName: string) => {
|
export const updateRuleProviderAPI = (providerName: string) => {
|
||||||
const request = useRequest()
|
const request = useRequest()
|
||||||
|
|
||||||
return request.put(`providers/rules/${providerName}`)
|
return request.put(`providers/rules/${encodeURIComponent(providerName)}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReleaseAPIResponse = {
|
type ReleaseAPIResponse = {
|
||||||
|
Loading…
Reference in New Issue
Block a user