Private
Public Access
1
0

新增:文件系统导航面包屑

功能:
- 新增 PathBreadcrumb 组件,支持路径快速跳转
- 新增 DropdownItem 通用下拉菜单组件

优化:
- 版本升级流程优化(Pinia 状态管理、进度节流、完整下载验证)
- 模块延迟初始化(数据库、文件系统按需启动)
- API 数据格式统一(蛇形转驼峰)
- CodeMirror 语言包按需动态加载
- Markdown 渲染增强(支持锚点跳转)

重构:
- 迁移到 Pinia 状态管理(stores/config.ts、stores/theme.ts、stores/update.ts)
- 简化 UpdatePanel、UpdateNotification、ThemeToggle 逻辑
- 优化表结构加载逻辑

清理:
- 删除测试组件 index-simple.vue
- 删除旧的 useTheme.ts
This commit is contained in:
2026-02-05 00:17:32 +08:00
parent ce2698f245
commit f7d648ea52
48 changed files with 3930 additions and 1380 deletions

32
app.go
View File

@@ -14,6 +14,7 @@ import (
"u-desk/internal/common"
"u-desk/internal/database"
"u-desk/internal/filesystem"
"u-desk/internal/service"
"u-desk/internal/storage"
"u-desk/internal/system"
@@ -59,7 +60,11 @@ func (a *App) Startup(ctx context.Context) {
// 2.5. 迁移旧配置
_ = a.configAPI.MigrateTabConfig()
// 3. 读取配置,获取可见的 Tabs
// 3. 初始化版本号(提前触发缓存,避免后续重复计算)
version := service.GetCurrentVersion()
fmt.Printf("[启动] 当前版本: %s\n", version)
// 4. 读取配置,获取可见的 Tabs
visibleTabs := a.getVisibleTabs()
fmt.Printf("[启动] 可用的模块: %v\n", visibleTabs)
@@ -173,28 +178,31 @@ func (a *App) startFileServer() {
return
}
// 创建一个占位服务器用于保持引用(实际服务器由 StartLocalFileServer 管理)
a.fileServer = &http.Server{
Addr: "localhost:18765",
}
fmt.Println("[文件服务器] 启动在 http://localhost:18765")
}
// Shutdown 应用关闭时调用
func (a *App) Shutdown(ctx context.Context) {
// 关闭文件系统服务(优雅关闭,释放资源
// 创建带超时的上下文5秒超时
shutdownCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
// 1. 关闭文件系统服务(优雅关闭,释放资源)
if a.filesystem != nil {
fmt.Println("[文件系统服务] 正在关闭...")
if err := a.filesystem.Close(ctx); err != nil {
if err := a.filesystem.Close(shutdownCtx); err != nil {
fmt.Printf("[文件系统服务] 关闭失败: %v\n", err)
} else {
fmt.Println("[文件系统服务] 已关闭")
}
}
// 停止文件服务器
if a.fileServer != nil {
fmt.Println("[文件服务器] 正在关闭...")
a.fileServer.Shutdown(ctx)
// 2. 停止文件服务器(使用全局服务器的关闭方法)
fmt.Println("[文件服务器] 正在关闭...")
if err := filesystem.ShutdownLocalFileServer(); err != nil {
fmt.Printf("[文件服务器] 关闭失败: %v\n", err)
} else {
fmt.Println("[文件服务器] 已关闭")
}
}