web/frps: use API v2 for client and proxy details (#5386)
golangci-lint / lint (push) Has been cancelled

This commit is contained in:
fatedier
2026-06-30 01:33:57 +08:00
committed by GitHub
parent 7c343fc6e7
commit 7fe152e3aa
3 changed files with 14 additions and 6 deletions
+9 -2
View File
@@ -32,7 +32,7 @@ export const getProxiesV2 = async (params: ProxyListV2Params = {}) => {
}
}
const toLegacyProxyStats = (proxy: ProxyV2Info): ProxyStatsInfo => ({
export const toLegacyProxyStats = (proxy: ProxyV2Info): ProxyStatsInfo => ({
name: proxy.name,
type: proxy.type,
conf: proxy.spec,
@@ -43,13 +43,20 @@ const toLegacyProxyStats = (proxy: ProxyV2Info): ProxyStatsInfo => ({
curConns: proxy.status.curConns,
lastStartTime: proxy.status.lastStartTime,
lastCloseTime: proxy.status.lastCloseTime,
status: proxy.status.phase,
status: proxy.status.state || proxy.status.phase || '',
})
export const getProxy = (type: string, name: string) => {
return http.get<ProxyStatsInfo>(`../api/proxy/${type}/${name}`)
}
export const getProxyByNameV2 = async (name: string) => {
const proxy = await http.getV2<ProxyV2Info>(
`../api/v2/proxies/${encodeURIComponent(name)}`,
)
return toLegacyProxyStats(proxy)
}
export const getProxyByName = (name: string) => {
return http.get<ProxyStatsInfo>(`../api/proxies/${name}`)
}
+2 -1
View File
@@ -36,7 +36,8 @@ export interface ProxyV2Info {
}
export interface ProxyV2Status {
phase: string
state?: string
phase?: string
todayTrafficIn: number
todayTrafficOut: number
curConns: number
+3 -3
View File
@@ -241,7 +241,7 @@ import {
Tickets,
Location,
} from '@element-plus/icons-vue'
import { getProxyByName } from '../api/proxy'
import { getProxyByNameV2 } from '../api/proxy'
import { getServerInfo } from '../api/server'
import {
BaseProxy,
@@ -365,9 +365,9 @@ const fetchProxy = async () => {
}
try {
const data = await getProxyByName(name)
const data = await getProxyByNameV2(name)
const info = await fetchServerInfo()
const type = data.conf?.type || ''
const type = data.type || data.conf?.type || ''
if (type === 'tcp') {
proxy.value = new TCPProxy(data)