dsh-external-links
DSH desktop (Deepseek Harness EAC) plugin: open http/https/mailto/tel/file links in the default browser/app, bypassing the broken shell.open-external bridge
- Stars
- 0
- Language
- JavaScript
- Created
- Aug 30, 2026
- Updated
- Aug 31, 2026
Introduction
dsh-external-links
DSH 桌面端(Deepseek Harness EAC,Windows WebView2 壳)外部链接修复插件。
点击应用里的 http/https/mailto/tel/file 链接时,自动在系统默认浏览器 / 默认应用中打开,而不是在 WebView2 内部导航失败、或弹出 Windows 找不到 "\" 文件 之类的错误。
为什么需要它
DSH 桌面端壳层(dsh-eac-shell.exe,Tauri 2.11.5)提供的 window.dshDesktop.openExternal() 桥接是坏的:
Rust 侧用 cmd start 包装 URL 且引号处理有缺陷。实测任何 URL(包括纯 https://example.com)都返回
{"error":"cmd start exited with exit code: 1","ok":false}——这就是「点击外部链接失败 / 弹对话框」的根因。
本插件绕开该桥接:
点击链接 / window.open()
↓(客户端拦截器,capture 阶段)
POST /api/dsh-external-links/open { target }
↓(插件宿主路由,仅回环来源)
PowerShell Start-Process '<url>' → 默认浏览器(URL)
PowerShell Invoke-Item -LiteralPath → 默认应用(绝对路径)
功能
http:///https://→ 默认浏览器;mailto:/tel:→ 系统处理程序;file://→ 解码为 Windows 绝对路径后用默认应用打开;- 应用内链(同源、
127.0.0.1/localhost、#hash、下载、javascript:)不受影响; - 右键复制、中键、Ctrl/Shift 点击不被破坏;
- 宿主路由仅接受回环请求,target 严格校验(拒绝控制字符,只放行 URL 或绝对路径), PowerShell 参数用单引号字面量转义——不引入新的命令注入面。
安装
方式一:GitHub 安装(推荐)
# 在 DSH 桌面端所在机器上执行(dsh CLI 随应用内置,也可用全局 dsh)
dsh plugin --profile web-desktop add github:Lion-Li-git/dsh-external-links
该命令会:pnpm 安装依赖 → 检测到包声明了 dsh.bundle 后自动追加进
dsh.profile.bundles → 启动时自动应用插件自带的 cordis.patch.yml(无需手改任何文件)。
重启 DSH 桌面端(完全退出再打开)即可生效。
手动安装(等价):在
~/.dsh/profiles/web-desktop/package.json的dependencies中加入"dsh-external-links": "github:Lion-Li-git/dsh-external-links", 执行pnpm install,并在该目录cordis.patch.yml末尾追加:- insert: - id: dsh-external-links name: 'dsh-external-links'然后重启。
方式二:本地目录 / tarball
"dsh-external-links": "file:./dsh-external-links"
(或 file:./dsh-external-links-0.1.0.tgz,tarball 用 npm pack 生成),其余步骤同上。
验证
- 重启后打开任意会话,点击消息里的外链 → 应在默认浏览器打开;
- 应用内导航、设置页、下载等不受影响;
- 若想确认路由已挂载:访问
http://127.0.0.1:<webPort>/api/dsh-external-links/open(POST)应返回 400 而非 404。
兼容性
- 目标:DSH 桌面端 Windows 版(
dsh-eac-shell.exe); - 宿主侧要求 Node ≥ 22 与 Windows PowerShell(
powershell.exe,系统自带); - 客户端侧为纯 DOM/
fetch实现,无框架依赖; - 插件安装在用户 profile(
~/.dsh),不修改应用安装目录, 因此 DSH 桌面端版本更新不会覆盖本插件。
License
MIT