Workspace file tree for the Web UI: multi-tab preview (text/DOCX/PDF/Markdown/CSV/images), inline Markdown editing, a Git changes panel, and file operations (rename/delete/copy/move/create) via context menu.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:Nothree-code/folder-tree-sh
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time. Only install sources you trust, and pin a commit (github:owner/repo#sha).
README
DSH Web GUI 的工作区文件树插件(dsh-ftree):文件浏览、多格式预览、内联编辑、Git 变更面板与完整文件操作,零核心修改、热插拔(profile bundle)。
功能
文件树
- 目录展开/折叠,5 秒自动刷新 + 手动刷新
- 过滤框:按文件名实时过滤
- 排序:名称 / 大小 / 修改时间(目录始终置顶)
- 隐藏文件开关:默认隐藏
.git/node_modules/.DS_Store - 宽度拖拽调整 + 面板开关状态持久化(localStorage)
预览(多标签)
- Markdown:渲染 + 编辑双模式(工具栏、实时预览、自动保存、Ctrl+S),支持工作区相对路径图片(
经 host raw 路由渲染) - 代码:30+ 语言轻量高亮
- CSV:自动分隔符检测(
,;Tab)+ 表格渲染 - 图片:缩放(Ctrl+滚轮)/ 双击复位
- PDF:浏览器原生渲染(
no-cache字节流) - DOCX:mammoth → HTML 真渲染(含图片),无 mammoth 时自动降级为 PowerShell 提取纯文本
- 文本:分块加载(1MB/块,100MB 上限),GBK 编码自动检测回退
- 多标签同时打开多个文件,切换即时
编辑
- Markdown 内联编辑:自动保存(800ms 防抖)+ 手动 Ctrl+S,保存前滚动备份
.dshbak.1~3
Git 变更面板
- 分支显示 + 变更列表(未跟踪 / 已暂存 / 已修改)
- 操作:暂存(add)、取消暂存(restore --staged)、丢弃更改(checkout --,未跟踪文件走回收站删除)、查看差异(diff / diff --cached)
文件操作(右键菜单)
- 刷新、新建文件、新建文件夹、重命名、删除(回收站)、复制/剪切/粘贴、原地复制、打开源文件夹(资源管理器定位)、复制路径、添加到聊天(图片)
安全模型
- Origin 白名单:从
webStartup动态派生(127.0.0.1 / localhost / [::1] / 配置的 host / trustedHosts),跨站请求一律 403;监听0.0.0.0(LAN)时退化为仅靠 CSRF token - 每进程 anti-CSRF token:所有变更路由(op / write / git-op)必须携带
/dsh-ftree-token颁发的 token - 工作区白名单:所有路径必须位于已注册 workspace 根(deny by default)
- 删除进回收站,不永久删除;写入前滚动备份
.dshbak.1~3 - Shell 注入防护:所有 PowerShell 命令经单引号转义(
'→'') - 预览缓存:按文件 size 校验自动失效,写入后主动清除
开发
# 同步修改到 node_modules 实体拷贝(改完 lib/ 后执行)
powershell -ExecutionPolicy Bypass -File sync.ps1
# 若 package.json 有改动(名称/版本/dsh.client)
cd ..\.. && pnpm add "file:./packages/dsh-ftree"
# 重启 dsh web 生效
版本号以 package.json 为准(host 启动时读取,/dsh-ftree-meta 暴露给客户端做 stale-cache 检测)。
路由一览(host)
| 路由 | 方法 | 说明 |
|---|---|---|
/dsh-ftree-meta |
GET | 版本信息 |
/dsh-ftree-token |
GET | CSRF token |
/dsh-ftree-list |
GET | 列目录(withMtime=1 时附修改时间) |
/dsh-ftree-read |
GET | 分块读文件(text/image/pdf/docx) |
/dsh-ftree-op |
POST | rename / delete / paste / open / mkdir / newfile |
/dsh-ftree-write |
POST | 保存文本(带 .dshbak 备份) |
/dsh-ftree-pdf |
GET | PDF 字节流 |
/dsh-ftree-raw |
GET | 工作区原始字节(markdown 图片) |
/dsh-ftree-git |
GET | git status(branch + 变更) |
/dsh-ftree-git-op |
POST | stage / unstage / discard / diff |
许可
MIT
Links
More in this category
zhu1090093659/dsh-web-ui#packages/dsh-web-ui-all★ 2622
Plugin and skin collection for the DSH Web UI: task board, Git graph, right-side panel, remote mobile UI, pet, live token stats, and a skin center.
ccch1mneyyy/dsh-TUI★ 1231
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
omdsh-dev/DSH-better-sidebar★ 1198
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
omdsh-dev/dsh-at-file★ 214
Codex-style `@file` mentions: search workspace files in the composer and attach their contents to prompts.
huiliyi37/dsh-tianshu-tui★ 159
A terminal UI (TUI) for DeepSeek Harness.
Nagi-ovo/dsh-visualize★ 114
In-conversation generative UI: the model renders interactive HTML cards into the chat stream, with streaming preview and sandboxed rendering.