npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-static-token

v1.1.0

Published

Configurable static launch token for DeepSeek Harness Web GUI

Readme

dsh-static-token

为 DeepSeek Harness (DSH) Web GUI 配置一个固定的持久化启动令牌 (launch token),防止因反向代理配置或远程设备访问导致的会话过期和认证问题。


问题背景

默认情况下,DSH 在每次服务启动时都会生成一个瞬态、仅存在于内存中的启动令牌。在无头 (headless)、反向代理 (reverse-proxy) 或容器化部署(如 Kubernetes 集成 Traefik/Authentik)环境下,重启进程会导致当前令牌失效。同时,从其他设备(如手机)访问看板时,通常需要从服务器日志中手动获取新令牌。

解决方案

dsh-static-token 通过钩子接入 connection 服务,使用通过环境变量或插件配置定义的固定令牌,覆盖系统自动生成的随机令牌。


核心功能

  • 固定启动令牌: 在服务重启或主机重启后,依然保持令牌不变。
  • 最小长度校验: 强制要求令牌至少 16 字符,避免弱口令导致弱认证。
  • 高优先级环境变量: 优先读取进程环境变量 DSH_WEB_TOKEN,支持配置文件作为降级方案。
  • 无缝集成反向代理: 简化书签管理或 Forward-auth 配置,无需频繁查看服务器日志。
  • 零开销: 纯 ESM 实现,无外部运行时依赖,资源占用极小。

安全与架构注意事项

  1. 口令强度: 启动时会校验令牌长度,少于 16 字符将报错拒绝启动。建议使用长随机字符(如 openssl rand -hex 24)。
  2. 反向代理与 Host 校验: 在反向代理(如 Traefik、Nginx、Caddy)场景下,宿主 DSH 原生 connection 服务要求将代理域名配置在宿主的 trustedHosts 中。本插件仅负责令牌配置,不负责 Host 头部鉴权设置。
  3. 宿主私有字段说明: 本插件通过改写宿主内部字段(ctx.connection.browserAuth.launchToken)实现。若上游 DSH 对 connection 内部架构进行大版本重构,可能需要适配更新。

安装说明

使用 DSH CLI 安装

dsh plugin --profile web add dsh-static-token

从本地源码安装

git clone https://github.com/mdalboni/dsh-static-token.git
dsh plugin --profile web add link:./dsh-static-token

配置方式

你可以通过以下两种方式提供固定令牌:

1. 环境变量(推荐:Systemd / 容器部署)

在环境或服务定义中设置 DSH_WEB_TOKEN:

export DSH_WEB_TOKEN="your-custom-secure-token-here"

在 systemd 服务 (如 /etc/systemd/system/dsh.service) 中:

[Service]
Environment="DSH_WEB_TOKEN=your-custom-secure-token-here"

2. 插件配置

直接在 DSH 配置文件中定义:

# cordis.patch.yml 或 profile 配置文件
dsh-static-token:
  token: "your-custom-secure-token-here"

使用

配置生效并重启服务后,通过以下 URL 即可完成新设备或浏览器的认证:

https://your-dsh-domain.com/?token=your-custom-secure-token-here

DSH 将设置标准的 30 天会话 Cookie,并重定向至干净的 URL。


测试

使用 Node.js 运行内置测试:

node test.js

许可协议

MIT © Maxwell Dalboni