feat: 新增服务器配置管理功能
- 新增 SQLite 服务器表结构及 Rust 后端 CRUD 命令 - 新增前端 API 接口、类型定义及国际化文案 - 新增服务器卡片组件及表单弹窗组件 - 实现服务器列表展示、新增、编辑、删除、置顶、启用等功能 - 处理启用服务器互斥逻辑及前端表单校验
This commit is contained in:
Vendored
+19
@@ -13,17 +13,36 @@ declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
AButton: typeof import('ant-design-vue/es')['Button']
|
||||
ACard: typeof import('ant-design-vue/es')['Card']
|
||||
ACol: typeof import('ant-design-vue/es')['Col']
|
||||
AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
|
||||
ADivider: typeof import('ant-design-vue/es')['Divider']
|
||||
ADropdown: typeof import('ant-design-vue/es')['Dropdown']
|
||||
AEmpty: typeof import('ant-design-vue/es')['Empty']
|
||||
AForm: typeof import('ant-design-vue/es')['Form']
|
||||
AFormItem: typeof import('ant-design-vue/es')['FormItem']
|
||||
AInput: typeof import('ant-design-vue/es')['Input']
|
||||
AInputNumber: typeof import('ant-design-vue/es')['InputNumber']
|
||||
AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
|
||||
AMenu: typeof import('ant-design-vue/es')['Menu']
|
||||
AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
|
||||
AModal: typeof import('ant-design-vue/es')['Modal']
|
||||
APopconfirm: typeof import('ant-design-vue/es')['Popconfirm']
|
||||
AProgress: typeof import('ant-design-vue/es')['Progress']
|
||||
AResult: typeof import('ant-design-vue/es')['Result']
|
||||
ARow: typeof import('ant-design-vue/es')['Row']
|
||||
ASegmented: typeof import('ant-design-vue/es')['Segmented']
|
||||
ASelect: typeof import('ant-design-vue/es')['Select']
|
||||
ASpace: typeof import('ant-design-vue/es')['Space']
|
||||
ASpin: typeof import('ant-design-vue/es')['Spin']
|
||||
ASwitch: typeof import('ant-design-vue/es')['Switch']
|
||||
ATag: typeof import('ant-design-vue/es')['Tag']
|
||||
ATextarea: typeof import('ant-design-vue/es')['Textarea']
|
||||
ATooltip: typeof import('ant-design-vue/es')['Tooltip']
|
||||
MacTitleBar: typeof import('./../components/MacTitleBar.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
ServerCard: typeof import('./../components/server/ServerCard.vue')['default']
|
||||
ServerFormModal: typeof import('./../components/server/ServerFormModal.vue')['default']
|
||||
TitleBarActions: typeof import('./../components/TitleBarActions.vue')['default']
|
||||
WindowsTitleBar: typeof import('./../components/WindowsTitleBar.vue')['default']
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* 服务器相关的类型定义,字段与 Rust 端 `models::Server` / `models::ServerPayload` 一一对应。
|
||||
*/
|
||||
|
||||
/** 统一响应结构,对应 Rust 端 `models::ApiResponse<T>` */
|
||||
export interface ApiResponse<T = unknown> {
|
||||
success: boolean
|
||||
code: number
|
||||
msg: string
|
||||
data: T | null
|
||||
}
|
||||
|
||||
/** 传输协议,对应 frpc 的 transport.protocol */
|
||||
export type ServerProtocol = "tcp" | "kcp" | "quic" | "websocket"
|
||||
|
||||
/** 服务器配置 */
|
||||
export interface Server {
|
||||
id: number
|
||||
/** 名称(仅用于界面展示) */
|
||||
name: string
|
||||
/** 服务器地址 serverAddr,IP 或域名 */
|
||||
addr: string
|
||||
/** 服务器端口 serverPort */
|
||||
port: number
|
||||
/** 鉴权 Token auth.token */
|
||||
token: string | null
|
||||
/** 传输协议 transport.protocol */
|
||||
protocol: ServerProtocol
|
||||
/** 是否启用 TLS transport.tls.enable */
|
||||
tls_enable: boolean
|
||||
/** 备注 */
|
||||
remark: string | null
|
||||
/** 排序(越小越靠前) */
|
||||
sort: number
|
||||
/** 是否置顶 */
|
||||
pinned: boolean
|
||||
/** 是否启用(全局同时只能启用一个) */
|
||||
enabled: boolean
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
/** 新增 / 编辑服务器提交数据 */
|
||||
export interface ServerPayload {
|
||||
/** 编辑时携带,新增时省略 */
|
||||
id?: number
|
||||
name: string
|
||||
addr: string
|
||||
port: number
|
||||
token?: string | null
|
||||
protocol: ServerProtocol
|
||||
tls_enable: boolean
|
||||
remark?: string | null
|
||||
sort: number
|
||||
pinned: boolean
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
/** 协议下拉选项 */
|
||||
export const SERVER_PROTOCOLS: { value: ServerProtocol; label: string }[] = [
|
||||
{ value: "tcp", label: "TCP" },
|
||||
{ value: "kcp", label: "KCP" },
|
||||
{ value: "quic", label: "QUIC" },
|
||||
{ value: "websocket", label: "WebSocket" },
|
||||
]
|
||||
Reference in New Issue
Block a user