dsh-any-background 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -13
- package/README.zh.md +38 -12
- package/lib/client.js +1290 -1247
- package/lib/client.js.map +1 -1
- package/lib/index.js +176 -12
- package/package.json +106 -102
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ A **DeepSeek Harness** appearance plugin that lets you fully customize the Web U
|
|
|
16
16
|
- **Background Wallpaper** — Choose any image as your wallpaper. Drag to pan, scroll to zoom inside a viewport-proportional editor. What you see is what you get.
|
|
17
17
|
- **Opacity Controls** — Separate sliders for main interface background opacity, settings panel opacity, and wallpaper opacity.
|
|
18
18
|
- **Blur Effect** — Adjustable wallpaper blur (0–60 px) for a frosted-glass look.
|
|
19
|
-
- **Persistent** — All settings (color, wallpaper, opacity, blur, editor position) are
|
|
19
|
+
- **Persistent** — All settings (color, wallpaper, opacity, blur, editor position) are stored on the **filesystem** under `~/.dsh/.dsh-any-background-data/` via the node half, and restored on next launch. No more `localStorage` quota worries.
|
|
20
20
|
- **Bilingual** — Full Chinese / English UI with automatic locale detection.
|
|
21
21
|
- **Theme Watchdog** — A background watchdog re-asserts the custom theme if the host resets it, so your pick never silently disappears.
|
|
22
22
|
|
|
@@ -29,7 +29,7 @@ dsh-any-background/
|
|
|
29
29
|
├── cordis.yml # Patch overlay for dev usage (pnpm dsh web --patch)
|
|
30
30
|
├── tsdown.config.ts # Build config: node-half (ESM) + client-half (CJS browser bundle)
|
|
31
31
|
├── src/
|
|
32
|
-
│ ├── index.ts # Node half —
|
|
32
|
+
│ ├── index.ts # Node half — file-backed persistence (RPC file store)
|
|
33
33
|
│ ├── invariant.ts # Invariant companion (registers package ownership)
|
|
34
34
|
│ └── client/
|
|
35
35
|
│ └── index.tsx # Browser half — ALL UI logic lives here
|
|
@@ -45,7 +45,24 @@ dsh-any-background/
|
|
|
45
45
|
|
|
46
46
|
## Implementation
|
|
47
47
|
|
|
48
|
-
The plugin is a
|
|
48
|
+
The plugin is a Cordis plugin split into two halves:
|
|
49
|
+
|
|
50
|
+
- **Node half** (`src/index.ts`) — owns file-backed persistence. It manages the `.dsh-any-background-data/` store under the DSH data home (`~/.dsh/`) and exposes a small RPC surface over the shared `/api` channel.
|
|
51
|
+
- **Browser half** (`src/client/index.tsx`) — all UI logic lives here. The browser cannot touch the filesystem, so it reads/writes the store through the node half's RPC endpoints.
|
|
52
|
+
|
|
53
|
+
### Persistence
|
|
54
|
+
|
|
55
|
+
Since the plugin surfaces in the browser, persisted data is stored on disk by the **node half**:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
~/.dsh/.dsh-any-background-data/
|
|
59
|
+
├── theme-config.json # color, main/settings/wallpaper opacity, blur, bg edit state
|
|
60
|
+
└── wallpaper.jpg # the chosen background image (deleted when removed)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- On startup the client calls `read`, which returns the config and (if present) the wallpaper as a data URL.
|
|
64
|
+
- Every setting change is written back synchronously to `theme-config.json`; changing the wallpaper writes `wallpaper.jpg`, removing it deletes the file.
|
|
65
|
+
- The store is created automatically if missing; a missing or malformed config falls back to defaults (with a warning), and all writes are error-guarded to avoid data loss.
|
|
49
66
|
|
|
50
67
|
### Architecture
|
|
51
68
|
|
|
@@ -93,7 +110,7 @@ The plugin is a **pure client-side** Cordis plugin. The node half is an empty sh
|
|
|
93
110
|
### Background Wallpaper
|
|
94
111
|
|
|
95
112
|
- A `<div>` with `position:fixed; z-index:-1` is prepended to `<body>`.
|
|
96
|
-
- Image is compressed via Canvas API (max 1600px side, JPEG quality 0.75) and
|
|
113
|
+
- Image is compressed via Canvas API (max 1600px side, JPEG quality 0.75); the node half writes it to `~/.dsh/.dsh-any-background-data/wallpaper.jpg`, and the client keeps the data URL in memory for display.
|
|
97
114
|
- The editor modal shows a viewport-proportional rectangle; drag to pan, scroll to zoom (0.1×–10×).
|
|
98
115
|
- Committed position is stored as fractional center coordinates + natural image size, so the layout survives viewport changes.
|
|
99
116
|
- Wallpaper opacity is applied directly to the `<div>` element; background color opacity is applied via inline token overrides.
|
|
@@ -117,13 +134,13 @@ The plugin is a **pure client-side** Cordis plugin. The node half is an empty sh
|
|
|
117
134
|
|
|
118
135
|
### Opacity System
|
|
119
136
|
|
|
120
|
-
Three independent opacity layers, each with its own slider and
|
|
137
|
+
Three independent opacity layers, each with its own slider and a persisted config field:
|
|
121
138
|
|
|
122
|
-
| Layer |
|
|
123
|
-
|
|
124
|
-
| Main interface | `
|
|
125
|
-
| Settings panel | `
|
|
126
|
-
| Wallpaper | `
|
|
139
|
+
| Layer | Config field | Default | Mechanism |
|
|
140
|
+
|-------|--------------|---------|-----------|
|
|
141
|
+
| Main interface | `opacity` | 85% | Inline CSS variable on `<body>` |
|
|
142
|
+
| Settings panel | `settingsOpacity` | 100% | CSS variable on `<html>` via `[aria-modal]` selector |
|
|
143
|
+
| Wallpaper | `wallpaperOpacity` | 100% | Direct `style.opacity` on wallpaper `<div>` |
|
|
127
144
|
|
|
128
145
|
#### Settings Opacity
|
|
129
146
|
|
|
@@ -203,24 +220,33 @@ editing `src/`, run the bundle script (needs Node + pnpm):
|
|
|
203
220
|
git clone https://github.com/Tkingxiao/dsh-any-background.git
|
|
204
221
|
cd dsh-any-background
|
|
205
222
|
|
|
206
|
-
# 2. Install the build tool
|
|
223
|
+
# 2. Install the build tool (also pulls the @deepseek-ai/dsh-home-paths runtime dep)
|
|
207
224
|
pnpm install
|
|
208
225
|
|
|
209
226
|
# 3. Rebuild lib/
|
|
210
227
|
pnpm run bundle
|
|
211
228
|
|
|
212
|
-
# 4. Install the plugin into the web profile
|
|
213
|
-
dsh plugin
|
|
229
|
+
# 4. Install the plugin into the web profile from the local checkout
|
|
230
|
+
# (`dsh plugin add` wraps `pnpm add <dir>`, so point it at this directory)
|
|
231
|
+
dsh plugin --profile web add .
|
|
214
232
|
|
|
215
233
|
# 5. Launch
|
|
216
234
|
dsh web
|
|
217
235
|
```
|
|
218
236
|
|
|
237
|
+
## Compatibility
|
|
238
|
+
|
|
239
|
+
The plugin works on both the **Web UI** and the **desktop client**:
|
|
240
|
+
|
|
241
|
+
- **[`dsh web`](https://github.com/deepseek-ai/deepseek-harness)** — Web profile, full support.
|
|
242
|
+
- **[deepseek-harness-desktop](https://github.com/anywhere-labs/deepseek-harness-desktop)** — supported, but there is a known Electron packaging issue: the **left sidebar and the center area opacity are inverted** (the sidebar looks more transparent than the center and vice versa). This is a client-side packaging bug, not a plugin bug — we are waiting for the desktop client to be updated to fix it.
|
|
243
|
+
|
|
219
244
|
## Dependencies
|
|
220
245
|
|
|
221
246
|
| Package | Purpose |
|
|
222
247
|
|---------|---------|
|
|
223
248
|
| `@deepseek-ai/cordis` | Plugin framework (Cordis) |
|
|
249
|
+
| `@deepseek-ai/dsh-home-paths` | Resolve the DSH data home for the persistence store |
|
|
224
250
|
| `@deepseek-ai/dsh-client-runtime` | Client runtime + `defineStore` |
|
|
225
251
|
| `@deepseek-ai/dsh-client-locale` | i18n (Chinese/English) |
|
|
226
252
|
| `@deepseek-ai/dsh-client-ui-theme` | Theme service (register/setTheme/overrideTokens) |
|
package/README.zh.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
- **背景壁纸** — 选择任意图片作为壁纸。在视口比例的编辑器中拖动平移、滚轮缩放,所见即所得。
|
|
17
17
|
- **透明度控制** — 主界面背景透明度、设置面板透明度、壁纸透明度各自独立滑块控制。
|
|
18
18
|
- **模糊效果** — 可调壁纸模糊(0–60 px),打造毛玻璃质感。
|
|
19
|
-
- **持久化存储** —
|
|
19
|
+
- **持久化存储** — 所有设置(颜色、壁纸、透明度、模糊、编辑器位置)由 Node 端保存到 **文件系统** 的 `~/.dsh/.dsh-any-background-data/`,下次启动自动恢复。不再受 `localStorage` 容量限制。
|
|
20
20
|
- **中英双语** — 完整的中英文界面,自动跟随语言设置。
|
|
21
21
|
- **主题守护** — 后台看门狗定期重新激活自定义主题,即使宿主重置也不会丢失你的选择。
|
|
22
22
|
|
|
@@ -29,7 +29,7 @@ dsh-any-background/
|
|
|
29
29
|
├── cordis.yml # 开发用补丁覆盖层(pnpm dsh web --patch)
|
|
30
30
|
├── tsdown.config.ts # 构建配置:Node 端(ESM)+ 客户端(CJS 浏览器包)
|
|
31
31
|
├── src/
|
|
32
|
-
│ ├── index.ts # Node 端 —
|
|
32
|
+
│ ├── index.ts # Node 端 — 文件持久化(RPC 文件存储)
|
|
33
33
|
│ ├── invariant.ts # 不变量 companion(注册包所有权)
|
|
34
34
|
│ └── client/
|
|
35
35
|
│ └── index.tsx # 浏览器端 — 所有 UI 逻辑都在这里
|
|
@@ -45,7 +45,24 @@ dsh-any-background/
|
|
|
45
45
|
|
|
46
46
|
## 实现原理
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
本插件是一个 Cordis 插件,分为两个部分:
|
|
49
|
+
|
|
50
|
+
- **Node 端**(`src/index.ts`)— 负责文件持久化。管理 DSH 数据主目录(`~/.dsh/`)下的 `.dsh-any-background-data/` 存储,并在共享 `/api` 通道上暴露一组小的 RPC 接口。
|
|
51
|
+
- **浏览器端**(`src/client/index.tsx`)— 所有 UI 逻辑都在这里。浏览器无法直接读写文件系统,因此通过 Node 端的 RPC 接口读写存储。
|
|
52
|
+
|
|
53
|
+
### 持久化
|
|
54
|
+
|
|
55
|
+
由于插件运行在浏览器中,持久化数据由 **Node 端** 写入磁盘:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
~/.dsh/.dsh-any-background-data/
|
|
59
|
+
├── theme-config.json # 主题色、主界面/设置面板/壁纸透明度、模糊、壁纸编辑状态
|
|
60
|
+
└── wallpaper.jpg # 选中的背景图片(移除时删除)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- 启动时客户端调用 `read`,返回配置以及(如果存在)壁纸的 data URL。
|
|
64
|
+
- 每次设置变更都会同步写回 `theme-config.json`;更换壁纸写入 `wallpaper.jpg`,移除壁纸则删除文件。
|
|
65
|
+
- 存储目录不存在时会自动创建;配置缺失或损坏时回退默认值(并记录警告),所有写入都有错误保护以避免数据丢失。
|
|
49
66
|
|
|
50
67
|
### 架构
|
|
51
68
|
|
|
@@ -93,7 +110,7 @@ dsh-any-background/
|
|
|
93
110
|
### 背景壁纸
|
|
94
111
|
|
|
95
112
|
- 一个 `position:fixed; z-index:-1` 的 `<div>` 被插入到 `<body>` 最前面。
|
|
96
|
-
- 图片通过 Canvas API 压缩(最大边 1600px,JPEG 质量 0.75
|
|
113
|
+
- 图片通过 Canvas API 压缩(最大边 1600px,JPEG 质量 0.75);Node 端写入 `~/.dsh/.dsh-any-background-data/wallpaper.jpg`,客户端在内存中保留 data URL 用于显示。
|
|
97
114
|
- 编辑器弹窗显示视口比例的矩形区域;拖动平移,滚轮缩放(0.1×–10×)。
|
|
98
115
|
- 提交的位置以分数中心坐标 + 原始图片尺寸存储,布局在视口变化时保持一致。
|
|
99
116
|
- 壁纸透明度直接作用于 `<div>` 元素;背景色透明度通过内联令牌覆盖实现。
|
|
@@ -117,13 +134,13 @@ dsh-any-background/
|
|
|
117
134
|
|
|
118
135
|
### 透明度体系
|
|
119
136
|
|
|
120
|
-
|
|
137
|
+
三个独立的透明度层,各有独立滑块和一个持久化的配置字段:
|
|
121
138
|
|
|
122
|
-
| 层 |
|
|
123
|
-
|
|
124
|
-
| 主界面 | `
|
|
125
|
-
| 设置面板 | `
|
|
126
|
-
| 壁纸 | `
|
|
139
|
+
| 层 | 配置字段 | 默认值 | 实现方式 |
|
|
140
|
+
|----|----------|--------|---------|
|
|
141
|
+
| 主界面 | `opacity` | 85% | `<body>` 上的内联 CSS 变量 |
|
|
142
|
+
| 设置面板 | `settingsOpacity` | 100% | `<html>` 上的 CSS 变量,通过 `[aria-modal]` 选择器定位 |
|
|
143
|
+
| 壁纸 | `wallpaperOpacity` | 100% | 壁纸 `<div>` 上的 `style.opacity` |
|
|
127
144
|
|
|
128
145
|
#### 设置透明度
|
|
129
146
|
|
|
@@ -202,24 +219,33 @@ npx @deepseek-ai/dsh web
|
|
|
202
219
|
git clone https://github.com/Tkingxiao/dsh-any-background.git
|
|
203
220
|
cd dsh-any-background
|
|
204
221
|
|
|
205
|
-
# 2.
|
|
222
|
+
# 2. 安装构建工具(同时拉取 @deepseek-ai/dsh-home-paths 运行时依赖)
|
|
206
223
|
pnpm install
|
|
207
224
|
|
|
208
225
|
# 3. 重新构建 lib/
|
|
209
226
|
pnpm run bundle
|
|
210
227
|
|
|
211
228
|
# 4. 从本地安装到 web profile
|
|
212
|
-
dsh plugin
|
|
229
|
+
# (`dsh plugin add` 是 `pnpm add <dir>` 的封装,传入本目录即可)
|
|
230
|
+
dsh plugin --profile web add .
|
|
213
231
|
|
|
214
232
|
# 5. 启动
|
|
215
233
|
dsh web
|
|
216
234
|
```
|
|
217
235
|
|
|
236
|
+
## 兼容性
|
|
237
|
+
|
|
238
|
+
插件同时支持 **Web 界面** 和 **桌面客户端**:
|
|
239
|
+
|
|
240
|
+
- **[`dsh web`](https://github.com/deepseek-ai/deepseek-harness)** — Web profile,完整支持。
|
|
241
|
+
- **[deepseek-harness-desktop](https://github.com/anywhere-labs/deepseek-harness-desktop)** — 已支持,但存在一个已知的 Electron 打包问题:**左侧边栏与主区域的透明度相反**(侧边栏看起来比主区域更透明,反之亦然)。这是客户端侧打包问题,并非插件缺陷 —— 我们正在等待桌面客户端更新修复。
|
|
242
|
+
|
|
218
243
|
## 依赖
|
|
219
244
|
|
|
220
245
|
| 包名 | 用途 |
|
|
221
246
|
|------|------|
|
|
222
247
|
| `@deepseek-ai/cordis` | 插件框架(Cordis) |
|
|
248
|
+
| `@deepseek-ai/dsh-home-paths` | 解析 DSH 数据主目录,用于持久化存储 |
|
|
223
249
|
| `@deepseek-ai/dsh-client-runtime` | 客户端运行时 + `defineStore` |
|
|
224
250
|
| `@deepseek-ai/dsh-client-locale` | 国际化(中/英) |
|
|
225
251
|
| `@deepseek-ai/dsh-client-ui-theme` | 主题服务(register/setTheme/overrideTokens) |
|