Private
Public Access
1
0
Files
u-desk/internal/agent/handler/handler.go
绝尘 3d5a1e5892 优化:工具栏高度对齐+面板统一+远程连接架构+自动恢复预览
- 工具栏:面包屑与右侧组件像素级等高(:deep 34px)、合并重复search handler、统一分隔符样式、删除死代码
- 面板对齐:三面板header统一padding/font-size、文件列表分页固定底部(自定义紧凑)、表头默认隐藏、滚动条统一样式
- 预览区:始终显示空白预览面板、重启自动恢复上次打开文件
- 收藏夹:简化计数显示(共N项)
- 远程连接:ConnectionIndicator自适应UI(无远程显示mini云图标)、ConnectionDialog支持编辑配置、transport抽象层(本地Wails/远程HTTP双模式)、agent后端模块
2026-04-30 22:25:27 +08:00

38 lines
817 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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)
}