优化:工具栏高度对齐+面板统一+远程连接架构+自动恢复预览
- 工具栏:面包屑与右侧组件像素级等高(:deep 34px)、合并重复search handler、统一分隔符样式、删除死代码 - 面板对齐:三面板header统一padding/font-size、文件列表分页固定底部(自定义紧凑)、表头默认隐藏、滚动条统一样式 - 预览区:始终显示空白预览面板、重启自动恢复上次打开文件 - 收藏夹:简化计数显示(共N项) - 远程连接:ConnectionIndicator自适应UI(无远程显示mini云图标)、ConnectionDialog支持编辑配置、transport抽象层(本地Wails/远程HTTP双模式)、agent后端模块
This commit is contained in:
37
internal/agent/handler/handler.go
Normal file
37
internal/agent/handler/handler.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
|
||||
"u-desk/internal/agent/config"
|
||||
"u-desk/internal/filesystem"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
type Handler struct {
|
||||
fsSvc *filesystem.FileSystemService
|
||||
cfg *config.Config
|
||||
fileProxy *httputil.ReverseProxy
|
||||
}
|
||||
|
||||
func New(fsSvc *filesystem.FileSystemService, cfg *config.Config) *Handler {
|
||||
fileTarget, _ := url.Parse(cfg.FileServerAddr() + "/localfs/")
|
||||
return &Handler{
|
||||
fsSvc: fsSvc,
|
||||
cfg: cfg,
|
||||
fileProxy: httputil.NewSingleHostReverseProxy(fileTarget),
|
||||
}
|
||||
}
|
||||
|
||||
// getPath 从 query 参数提取并规范化文件路径
|
||||
func getPath(c echo.Context) string {
|
||||
raw := c.QueryParam("path")
|
||||
if raw == "" {
|
||||
return ""
|
||||
}
|
||||
// URL 已被 Echo 自动 decode,只需转换路径分隔符
|
||||
return filepath.FromSlash(raw)
|
||||
}
|
||||
Reference in New Issue
Block a user