Files
MeBox/web/src/api/download_clients.ts
T
ShukeBta 9be81222cc fix: 修复三个空白页面 + 许可证页面重构
- 修复发现页空白:后端 discover.go nil→[] Match,前端 discover.ts 加 ?? []
- 修复下载客户端页空白:后端 download_clients.go nil→[]model.DownloadClient,前端加 ?? []
- 修复通知渠道页空白:后端 notify_channels.go nil→[]struct{},前端加 ?? []
- 许可证页面重构:移除生成密钥功能,对接 LicenseServer 绑定/状态模式
- 所有变更通过 Go build + npm run build 零错误验证
2026-05-17 00:54:40 +08:00

54 lines
1.3 KiB
TypeScript

import { api } from './client'
export type DownloadClientType = 'qbittorrent' | 'aria2' | 'transmission'
export interface DownloadClient {
id: string
name: string
type: DownloadClientType
url: string
username?: string
save_path?: string
is_default: boolean
enabled: boolean
created_at: string
updated_at: string
}
export interface DownloadClientInput {
name: string
type: DownloadClientType
url: string
username?: string
password?: string
save_path?: string
is_default: boolean
enabled: boolean
}
export const downloadClientsAPI = {
list: () =>
api.get<DownloadClient[]>('/admin/download/clients').then((r) => r.data ?? []),
create: (input: DownloadClientInput) =>
api.post<DownloadClient>('/admin/download/clients', input).then((r) => r.data),
update: (id: string, input: DownloadClientInput) =>
api
.put<DownloadClient>(`/admin/download/clients/${id}`, input)
.then((r) => r.data),
remove: (id: string) =>
api.delete(`/admin/download/clients/${id}`).then((r) => r.data),
test: (id: string) =>
api
.post<{ ok: boolean; error?: string }>(`/admin/download/clients/${id}/test`)
.then((r) => r.data),
aria2Stats: (clientID: string) =>
api
.get('/admin/download/aria2/stats', { params: { client_id: clientID } })
.then((r) => r.data),
}