mirror of
https://github.com/fatedier/frp.git
synced 2026-07-16 17:29:16 +08:00
feat: add system prune API v2 (#5395)
This commit is contained in:
@@ -98,6 +98,13 @@ export const http = {
|
||||
request<T>(url, { ...options, method: 'GET' }),
|
||||
getV2: <T>(url: string, options?: RequestInit) =>
|
||||
requestV2<T>(url, { ...options, method: 'GET' }),
|
||||
postV2: <T>(url: string, body?: any, options?: RequestInit) =>
|
||||
requestV2<T>(url, {
|
||||
...options,
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
||||
body: JSON.stringify(body),
|
||||
}),
|
||||
post: <T>(url: string, body?: any, options?: RequestInit) =>
|
||||
request<T>(url, {
|
||||
...options,
|
||||
|
||||
@@ -8,6 +8,12 @@ import type {
|
||||
TrafficResponse,
|
||||
} from '../types/proxy'
|
||||
|
||||
export interface SystemPruneResponse {
|
||||
type: 'offline_proxies'
|
||||
cleared: number
|
||||
total: number
|
||||
}
|
||||
|
||||
export const getProxiesByType = (type: string) => {
|
||||
return http.get<GetProxyResponse>(`../api/proxy/${type}`)
|
||||
}
|
||||
@@ -66,5 +72,7 @@ export const getProxyTraffic = (name: string) => {
|
||||
}
|
||||
|
||||
export const clearOfflineProxies = () => {
|
||||
return http.delete('../api/proxies?status=offline')
|
||||
return http.postV2<SystemPruneResponse>(
|
||||
'../api/v2/system/prune?type=offline_proxies',
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user