mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
Add proxy install session client API
This commit is contained in:
@@ -164,6 +164,20 @@ export interface ManualProxyNodeUpdateRequest {
|
|||||||
region?: string
|
region?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProxyNodeInstallSessionCreateRequest {
|
||||||
|
node_name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProxyNodeInstallSession {
|
||||||
|
install_code: string
|
||||||
|
expires_at_unix_secs: number
|
||||||
|
expires_in_seconds: number
|
||||||
|
node_name: string
|
||||||
|
aether_url: string
|
||||||
|
unix_command: string
|
||||||
|
powershell_command: string
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProxyNodeTestResult {
|
export interface ProxyNodeTestResult {
|
||||||
success: boolean
|
success: boolean
|
||||||
latency_ms: number | null
|
latency_ms: number | null
|
||||||
@@ -245,6 +259,11 @@ export const proxyNodesApi = {
|
|||||||
return response.data
|
return response.data
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async createInstallSession(data: ProxyNodeInstallSessionCreateRequest): Promise<ProxyNodeInstallSession> {
|
||||||
|
const response = await apiClient.post<ProxyNodeInstallSession>('/api/admin/proxy-nodes/install-sessions', data)
|
||||||
|
return response.data
|
||||||
|
},
|
||||||
|
|
||||||
async updateManualNode(nodeId: string, data: ManualProxyNodeUpdateRequest): Promise<{ node_id: string; node: ProxyNode }> {
|
async updateManualNode(nodeId: string, data: ManualProxyNodeUpdateRequest): Promise<{ node_id: string; node: ProxyNode }> {
|
||||||
const response = await apiClient.patch<{ node_id: string; node: ProxyNode }>(`/api/admin/proxy-nodes/${nodeId}`, data)
|
const response = await apiClient.patch<{ node_id: string; node: ProxyNode }>(`/api/admin/proxy-nodes/${nodeId}`, data)
|
||||||
return response.data
|
return response.data
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import {
|
|||||||
proxyNodesApi,
|
proxyNodesApi,
|
||||||
type ManualProxyNodeCreateRequest,
|
type ManualProxyNodeCreateRequest,
|
||||||
type ProxyNode,
|
type ProxyNode,
|
||||||
|
type ProxyNodeInstallSession,
|
||||||
|
type ProxyNodeInstallSessionCreateRequest,
|
||||||
type ProxyNodeUpgradeRolloutStatus,
|
type ProxyNodeUpgradeRolloutStatus,
|
||||||
} from '@/api/proxy-nodes'
|
} from '@/api/proxy-nodes'
|
||||||
import { parseApiError } from '@/utils/errorParser'
|
import { parseApiError } from '@/utils/errorParser'
|
||||||
@@ -68,6 +70,15 @@ export const useProxyNodesStore = defineStore('proxy-nodes', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function createInstallSession(data: ProxyNodeInstallSessionCreateRequest): Promise<ProxyNodeInstallSession> {
|
||||||
|
try {
|
||||||
|
return await proxyNodesApi.createInstallSession(data)
|
||||||
|
} catch (err: unknown) {
|
||||||
|
error.value = parseApiError(err, '生成代理节点安装命令失败')
|
||||||
|
throw err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function deleteNode(nodeId: string) {
|
async function deleteNode(nodeId: string) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
error.value = null
|
error.value = null
|
||||||
@@ -95,6 +106,7 @@ export const useProxyNodesStore = defineStore('proxy-nodes', () => {
|
|||||||
fetchNodes,
|
fetchNodes,
|
||||||
ensureLoaded,
|
ensureLoaded,
|
||||||
createManualNode,
|
createManualNode,
|
||||||
|
createInstallSession,
|
||||||
deleteNode,
|
deleteNode,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user