mozhi5795/dsh-kill-restart ↗★ 0
dsh-kill-restart
One-click kill button for the DSH Web GUI – kill the server process so you can restart without taskkill.
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:mozhi5795/dsh-kill-restart说明文档
阅读完整 README ↗dsh-kill-restart ☠
DSH Web GUI 的一键杀死按钮。
无需 taskkill 或翻找 PID,一键终止 DSH 服务器进程,方便重启。
工作原理
- 一个 ☠ 骷髅按钮出现在 DSH Web GUI 右下角。
- 点击 → 确认弹窗。
- 浏览器发送
POST /api/kill-dsh。 - 服务器先响应
{ "ok": true },等 200 毫秒让浏览器收到确认,然后调用process.exit(0)。 - 页面显示"DSH 服务器进程已终止 — 请重启 DSH"。
安装
从 npm 安装(推荐)
dsh plugin --profile web add dsh-kill-restart
从 GitHub 安装
dsh plugin --profile web add github:mozhi5795/dsh-kill-restart
注意:Git 安装拉取的是源码而非构建产物。你必须:
- 使用包含预构建
lib/文件的 tag,或- 在 profile 的
pnpm-workspace.yaml中允许prepare脚本:allowBuilds: dsh-kill-restart: true
从本地目录安装
# 在包含 dsh-kill-restart 的目录中执行
dsh plugin --profile web add ./dsh-kill-restart
使用
- 启动包含此组合包的 DSH profile。
- 打开 Web GUI(默认
http://127.0.0.1:3080)。 - 点击右下角的 ☠ 按钮。
- 确认弹窗。
- 服务器退出,手动重启 DSH。
项目结构
dsh-kill-restart/
├── package.json # 组合包清单(dsh.bundle + dsh.client)
├── cordis.patch.yml # Cordis 补丁层 — 插入插件行
├── README.md # 本文件
├── .gitignore
└── lib/
├── index.js # 服务端 — POST /api/kill-dsh 路由
└── client.js # 客户端 — ☠ 按钮 UI
架构
这是一个 DSH 组合包(bundle) — 一个可安装的 npm 包,附带配置层。
| 概念 | 文件 | 作用 |
|---|---|---|
| 组合包清单 | package.json | 声明 dsh.bundle.patch(补丁文件)和 dsh.client(客户端模块注入) |
| 补丁层 | cordis.patch.yml | 当 profile 列出此组合包时被插入;添加 kill-dsh-restart 插件行 |
| 服务端插件 | lib/index.js | 注入 webServer,注册 POST /api/kill-dsh,响应后调用 process.exit(0) |