dsh-ui-dafeng-customizer
v0.1.3
Published
DSH Web UI 界面美化插件:主题颜色 + 背景图片(URL / 本地上传 / 透明度),配置经 settings 持久化、跨重启保留。
Maintainers
Readme
dsh-ui-dafeng-customizer
DSH(DeepSeek Harness)Web UI 界面美化插件:
- 🎨 主题颜色:10 个预设色板 + 取色器 + 恢复默认;覆盖品牌 token 链与 DeepSeek 静态蓝,亮/暗模式同步
- 🖼️ 背景图片:粘贴 URL 或 📁 上传本地图片(JPG/PNG/WebP/GIF,大图自动压缩到 1920px 内)
- 🎚️ 透明度:0–100% 滑块实时调节,同时把各面板背景调为半透明让壁纸透出
- ✅ 生效自检:设置页内置自检框(
getComputedStyle真实计算值) - 💾 配置持久化:经
settings命名空间写入$DSH_HOME/settings.yaml,重启 DSH 自动恢复
安装
发布到 npm 后,一行命令安装到 web profile:
npx @deepseek-ai/dsh plugin --profile web add dsh-ui-dafeng-customizer重启 dsh web 后生效。使用入口:设置 → 界面美化。
包结构
dsh-ui-dafeng-customizer/
├── package.json # dsh.bundle.patch + dsh.client 清单(组合层声明)
├── cordis.patch.yml # 组合补丁:insert 本插件行
├── lib/
│ ├── index.js # Host 半区:注册 settings 命名空间(持久化)
│ └── client.js # Client 半区:设置页 + 主题色 + 壁纸 + 上传(__ModuleLoader__ bundle)
└── README.md工作原理
- 组合层:
package.json声明"dsh": { "bundle": { "patch": "./cordis.patch.yml" } }→dsh plugin识别为 profile 插件层;启动时组合器把cordis.patch.yml叠加进 web 组合。 - Client bundle:
"dsh": { "client": { "platform": "web", "inject": [...] } }→clientModules服务增量扫描,lib/client.js以window.__ModuleLoader__.load(...)格式加载 (require('react')取 React,导出{ apply, inject })。 - 持久化:Host 注册 settings 命名空间
dsh-ui-dafeng-customizer(schemastery 风格的可调用函数作为 schema, 不能直接传 zod 对象,否则运行时报schema is not a function); Client 通过connection.api.settings.describe / mutate读写,不依赖自定义 RPC。 - 主题色:
theme.overrideTokens(快照 → presenter → body 内联)为主通道, 另注入body { --x: <色值> !important }CSS 为辅助层(token 定义在 body 上, 覆盖必须作用在 body 才能生效)。 - 壁纸:
body::before固定层(z-index:-1; pointer-events:none)。
发布
方式 A:GitHub Actions(推荐)
仓库已带 .github/workflows/publish.yml:打 v* 标签自动发布。
# 1. 在 GitHub 仓库设置 → Secrets and variables → Actions 添加 NPM_TOKEN
# (npm 官网 → Access Tokens → Generate New Token,选 "Publish" 权限)
# 2. 发布新版本(自动打 tag 并推送,触发 CI)
npm version patch # 或 minor / major(同时把 version 写入 package.json)
git push --tags
# 3. 等 GitHub Action 跑完 → npm 上即出现新版本也支持在 Actions 页面手动运行(workflow_dispatch)。 前置步骤:把本目录推到一个 GitHub 仓库(
git init && git add . && git commit && git remote add origin <url> && git push -u origin main)。
方式 B:本地直接发布
npm login # 首次:输入 npm 用户名 / 密码 / OTP
npm version patch # 可选:版本 +1 并打 tag
npm publish # 自动执行 prepublishOnly 校验发布后安装
npx @deepseek-ai/dsh plugin --profile web add dsh-ui-dafeng-customizer(如需 scope:改 package.json 的 name 为 @<你的scope>/dsh-ui-dafeng-customizer。)
开发注意
- Client 半区是真实插件环境:没有动态包的
styles.insert/host.call内置, 样式用原生 DOM<style>实现,持久化走 settings Remote。 - 上传的图片以 data URL 存进 settings.yaml(大图会被自动压缩,注意体积)。
- 新增功能保持
ctx.effect清理所有副作用(样式标签、token 层、debounce)。
