主界面修改及代理模块初始化
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
import type { Component } from 'vue'
|
||||
import type { SearchIndexItem } from '@/stores/searchIndex'
|
||||
|
||||
/** 模块分类 */
|
||||
export type ModuleCategory = 'network' | 'tool' | 'system' | 'media'
|
||||
|
||||
/** 模块进程配置 —— 需要管理外部子进程的模块填写 */
|
||||
export interface ModuleProcessConfig {
|
||||
/** 进程标识符(如 'mihomo'、'aria2') */
|
||||
name: string
|
||||
/** 可执行文件路径(运行时由模块自行确定) */
|
||||
executable: string
|
||||
/** 启动参数 */
|
||||
args?: string[]
|
||||
/** 工作目录 */
|
||||
cwd?: string
|
||||
/** 模块启用时是否自动启动进程 */
|
||||
autoStart?: boolean
|
||||
/** 进程崩溃后是否自动重启 */
|
||||
restartOnCrash?: boolean
|
||||
/** 最大重启次数(0 = 不限制) */
|
||||
maxRestarts?: number
|
||||
}
|
||||
|
||||
/** 模块生命周期钩子 */
|
||||
export interface ModuleLifecycle {
|
||||
/** 模块首次加载时调用 */
|
||||
onInit?: () => void | Promise<void>
|
||||
/** 模块组件挂载时调用 */
|
||||
onActivate?: () => void | Promise<void>
|
||||
/** 模块组件卸载时调用 */
|
||||
onDeactivate?: () => void | Promise<void>
|
||||
/** 模块被禁用时调用 */
|
||||
onDisable?: () => void | Promise<void>
|
||||
/** 模块被启用时调用 */
|
||||
onEnable?: () => void | Promise<void>
|
||||
}
|
||||
|
||||
/** 模块配置 —— 每个模块通过 index.ts 导出此结构 */
|
||||
export interface ModuleConfig {
|
||||
/** 模块唯一标识 */
|
||||
id: string
|
||||
/** 显示名称 */
|
||||
name: string
|
||||
/** 图标标识(对应 Sidebar / Settings 的 iconMap key) */
|
||||
icon: string
|
||||
/** 模块描述(显示在设置界面的模块管理中) */
|
||||
description: string
|
||||
/** 模块分类 */
|
||||
category: ModuleCategory
|
||||
/** 模块是否默认启用 */
|
||||
defaultEnabled?: boolean
|
||||
/** 是否为内置模块(不可禁用,如设置模块) */
|
||||
builtin?: boolean
|
||||
/** 懒加载组件的 loader 函数 */
|
||||
loader?: () => Promise<{ default: Component }>
|
||||
/** 直接组件引用(内置模块可用) */
|
||||
component?: Component
|
||||
/** 全局搜索项 */
|
||||
searchItems?: SearchIndexItem[]
|
||||
/** 进程配置(需要管理子进程的模块填写) */
|
||||
process?: ModuleProcessConfig
|
||||
/** 生命周期钩子 */
|
||||
lifecycle?: ModuleLifecycle
|
||||
/** 排序权重(数值越小越靠前) */
|
||||
order?: number
|
||||
}
|
||||
|
||||
/** 运行时模块元信息(去除了组件等不可序列化字段) */
|
||||
export interface ModuleMeta {
|
||||
id: string
|
||||
name: string
|
||||
icon: string
|
||||
description: string
|
||||
category: ModuleCategory
|
||||
enabled: boolean
|
||||
builtin: boolean
|
||||
hasProcess: boolean
|
||||
order: number
|
||||
}
|
||||
Reference in New Issue
Block a user