Skip to content

dsh-stop-server

Verified

dsh-stop-server · v0.0.1 · MIT · Web UI

DSH web plugin: a 'Stop server & close' button in the Settings panel header + a POST /api/__shutdown host route. Dual-face bundle (host half + browser half).

Install

dsh plugin add dsh-stop-server

Confirm the layer applied with dsh --profile default --dump-config — see the install guide.

Source

Published to npm without a public repository. Inspect the package contents before installing.

Creators

Readme

dsh-stop-server

DSH web profile 插件:在侧边栏底部添加一个「关闭服务」按钮,点击后优雅关闭 dsh web 服务器并尝试关闭窗口。

工作原理

双面 bundle(宿主端 + 浏览器端),不修改任何 DSH 发行版文件:

  • 宿主端 (lib/index.js):注入 webServer + appExit,注册 POST /api/__shutdown 精确路由。点击后调用 ctx.appExit(0) 优雅销毁整棵插件树(关闭 HTTP 服务器、断开所有连接),3 秒兜底强制退出。
  • 浏览器端 (lib/client.js):注入 sidebar.footer.action 插槽,在侧边栏底部(设置齿轮上方)渲染一个带 ✕ 图标的按钮。点击后 fetch(POST /api/__shutdown),然后尝试 window.close()

文件

文件 作用
package.json dsh.bundle.patch(声明为 profile 层)+ dsh.client(浏览器端)+ exports["./client"]
cordis.patch.yml 一行 insert,将插件加入 profile 树
lib/index.js 宿主端:注册 POST /api/__shutdown 路由 + 优雅关机
lib/client.js 浏览器端:侧边栏「关闭服务」✕ 按钮

安装

# 从本目录安装:
dsh plugin --profile web add .

# 或从 npm 安装(发布后):
dsh plugin --profile web add dsh-stop-server

安装后重启 dsh web 生效。打开界面后,侧边栏底部(设置齿轮上方)会出现「关闭服务」按钮。

依赖

零外部 npm 依赖。inject 声明的 4 个包全部是 DSH 内置包:

  • @deepseek-ai/dsh-client-runtime(插槽服务)
  • @deepseek-ai/dsh-client-ui-settings(设置插槽声明)
  • @deepseek-ai/dsh-client-ui-settings-general(设置外壳)
  • @deepseek-ai/dsh-client-ui-primitives(Button、图标等 UI 组件)

前提条件

  • 已安装 dshnpm i -g @deepseek-ai/dsh
  • 已启用 pnpm(corepack enable pnpm
  • 使用 dsh web 运行

许可证

MIT