前言¶
DeepSeek Harness Web 的登录态是一年有效的 HttpOnly 签名 cookie(dsh-auth-*),页面里的 JS 删不掉它,宿主也没有 logout 路由。在共享电脑上用完会话后想退出,只能手动清站点数据——这正是 dsh-logout-button 要做的事。
这是什么¶
dsh-logout-button 是 DeepSeek Harness Web 的「退出登录」按钮插件,由 ramwin 维护(MIT 许可证,v0.1.0)。它补上 DSH Web 缺失的「登出」能力:服务端删除登录 cookie,浏览器提供入口,让下一次页面加载回到 401 门。
核心功能¶
插件由两半组成:
- 宿主一半:新增
POST /__logout路由。它读取本次请求携带的所有 cookie,逐一下发删除(Set-Cookie: name=; Max-Age=0; Path=/),并附Clear-Site-Data: "cookies"。 - 浏览器一半:在会话页头部右侧放一个 28px 图标按钮,在「设置 → 通用」里放一行带说明的入口。点击后弹出确认 → 请求宿主
/__logout→ 整页重载 → 回到 401 门。
它只清 cookie,不动 localStorage / IndexedDB:草稿、主题、历史都不该被一次退出带走。
安装与启用¶
在 web profile 上有两种挂法,二选一。
A. 作为 bundle(推荐给别的机器 / 发布用)
在 profile 的 package.json 里加依赖和 bundles 条目:
{
"dependencies": { "dsh-logout-button": "link:/path/to/dsh-logout-button" },
"dsh": { "profile": { "bundles": ["dsh-logout-button"] } }
}
B. 只用 profile patch(本机现状,改完立即生效)
加依赖,再在 ~/.dsh/profiles/web/cordis.patch.yml 末尾追加:
- insert:
- id: logout-button
name: 'dsh-logout-button'
链接进 profile:
cd ~/.dsh/profiles/web
dsh plugin --profile web install
本机(patchReload: live)改完 cordis.patch.yml 后宿主会热加载,不用重启。其它机器(没有 live reload)重启一次 web 服务:
sudo launchctl kickstart -k system/<your-dsh-launchd-label>
页面刷新后,会话头部右侧多一个「退出」图标;设置 → 通用 里多一行「退出登录」。
典型用法¶
接口为 POST /__logout,必须带请求头 x-dsh-logout: 1。Origin 存在时要求它与 Host 同源。
curl -i -X POST http://127.0.0.1:3082/__logout \
-H 'x-dsh-logout: 1' \
-H 'Cookie: dsh-auth-abc=1; other=2'
返回示例:
HTTP/1.1 200
clear-site-data: "cookies"
set-cookie: dsh-auth-abc=; Path=/; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT
set-cookie: other=; Path=/; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT
{"ok":true,"cleared":["dsh-auth-abc","other"]}
适用场景与注意¶
适合需要在共享电脑上快速登出、让下一次访问回到 401 门的场景。插件以当前 DSH 进程权限运行,安装前应检查源码与许可证(MIT)。
结尾¶
dsh-logout-button 用服务端删 cookie 的方式补全了 DSH Web 的「登出」能力,方便在共享电脑上用完后一键退出。更多细节可访问:
- 目录页:https://www.skillhub.cn/plugins/ramwin/dsh-logout-button
- GitHub:https://github.com/ramwin/dsh-logout-button