dsh-remote-access

August 15, 2026 · View on GitHub

让 dsh Web GUI 支持远程访问:将 webserver 绑定到 0.0.0.0,让同一网络内(或 VPN 内)的其他设备也能通过浏览器访问;同时注入 crypto.randomUUID polyfill,修复浏览器在非安全上下文(普通 HTTP 的局域网/IP 来源)下无法运行客户端 bundle 的问题。

Warning

当前版本存在 DeepSeek Harness 兼容性限制

当前 DeepSeek Harness 暂未自动向 Web GUI 暴露第三方插件注册的 Settings namespace,因此安装本插件后,「远程访问」配置卡片默认无法正常显示。

在 DeepSeek Harness 上游解决该限制之前,如需使用本插件,需要先执行下方的「临时兼容方案」。

该问题属于当前 DeepSeek Harness 的插件配置暴露机制限制,并非本插件自身配置错误。

Caution

安全性说明:本插件面向可信网络(局域网 / 私有 VPN)。开启后 Web GUI 不再只绑定 loopback,切勿直接暴露到公网。公网安全访问请配合 Tailscale / Cloudflare Tunnel / WireGuard 等网络层隔离方案。

安装

两种方式任选其一:

# 从 GitHub
dsh plugin --profile web add github:KongXiangning/dsh-remote-access

# 从 npm
dsh plugin --profile web add dsh-remote-access

临时兼容方案

当前 DeepSeek Harness 的 dsh-host-apiproxy 使用固定的 Web Settings 白名单,第三方插件无法自行将 remote-access namespace 暴露给 Web GUI。

安装插件后,在运行 dsh 的 Linux / WSL 环境中执行:

f="$(npm root -g)/@deepseek-ai/dsh/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/index.js"; [ -f "$f" ] || { echo "dsh-host-apiproxy not found: $f"; exit 1; }; grep -q '"remote-access"' "$f" || { cp "$f" "$f.bak" && perl -0pi -e 's/("web-search-deepseek"\s*\n\s*\]\;)/"web-search-deepseek",\n\t"remote-access"\n\t];/' "$f"; }; grep -n "remote-access" "$f"

该命令会:

  • 根据当前 Node / npm 环境自动定位 dsh-host-apiproxy
  • 修改前备份原文件为 index.js.bak
  • remote-access 加入 Web Settings 白名单
  • 已经修改过时不会重复添加
  • 最后输出包含 remote-access 的位置用于确认修改成功

Note

这是针对当前 DeepSeek Harness 限制的临时兼容方案。更新或重新安装 dsh 后,该修改可能被覆盖,需要重新执行。

当 DeepSeek Harness 上游正式支持第三方插件暴露 Settings namespace 后,本步骤将不再需要。

用法

完成安装和上述临时兼容处理后:

  1. 启动或重启 dsh web
  2. 打开 Web GUI → 设置 → 插件 → 插件配置 → 「远程访问」卡片
  3. 打开「允许远程访问」开关
  4. 再次重启 dsh web 后生效(web profile 未启用 HMR,patch 变更需重启应用)

重启后,其他设备通过:

http://<本机局域网IP>:<端口>

访问。

关闭「允许远程访问」并重启后,恢复仅本机访问。

原理

  • 开关开启时,插件把 profile 的 cordis.patch.yml 改写为:webserver 行绑定 0.0.0.0connection 行把 /api 浏览器信任围栏指向本机局域网 IPv4 地址
  • crypto.randomUUID polyfill 始终注入(安全来源下无副作用,LAN HTTP 下必需),无需单独配置
  • 端口跟随启动参数 dsh web --port <N>,插件不改变端口

开发

dsh-remote-access/
├── package.json       # dsh.bundle + dsh.client 声明
├── cordis.patch.yml   # 插入 remote-access 插件行
├── index.js           # host 半:settings 命名空间 + patch 改写 + polyfill
└── lib/client.js      # browser 半:设置卡片(手写 bundle,无构建步骤)

License

MIT