dsh-any-background 0.4.1 → 0.4.2

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 CHANGED
@@ -95,19 +95,16 @@ controls (`z-index:-1`) and carries its own ink (`--dsh-any-caption-ink`), so th
95
95
 
96
96
  ## Changelog (latest two releases)
97
97
 
98
- ### v0.4.1 (fix: the "Every refresh" rotation cadence flipped the wallpaper every 30 seconds)
98
+ ### v0.4.2 (dsh-better-display's summary bar compatibility · fixes issue #32)
99
99
 
100
- - **What happened.** v0.4.0 taught the 30-second schedule tick to advance a due rotation so an `Hourly` cadence works while the page stays open. But the due-math says "always due" for the `Every refresh` cadence — that is how a page load earns a fresh pick (the server advances it inside the `read` RPC). Wired into the tick, it meant: rotation enabled + `Every refresh` selected → the wallpaper switched itself every 30 seconds, and again on every OS dark/light flip or enabling the day/night schedule (both also drive the tick).
101
- - **The fix.** Whether a cadence participates in live ticking is now a shared-math question: `rotationAdvancesLive()` in `src/shared/rotation.ts` (inlined into both bundles, like the rest of the cadence math) says only the time-based cadences — hourly / daily / weekly — do. `Every refresh` keeps its exact original semantics: one fresh pick per page load, plus the manual next button. Boot-time fallback and the enable-toggle behavior are unchanged.
100
+ - **The summary bar is no longer hollowed out.** Its plate reads the token our 「主界面」 opacity owns, so at 0 the conversation streamed straight through it. When [dsh-better-display](https://github.com/aa2246740/dsh-better-display) is detected the band is pinned at a **20% plate + 30px frost** — no slider moves it, the color still follows the theme — and the three separate bars merge into one box with the bottom corners rounded.
101
+ - **Third-party surface self-check + a compatibility switch.** At boot the plugin scans other plugins' stylesheets and names in the console whose surface reads a token this plugin owns: registered ones get protected automatically, unregistered ones log a note inviting that line to be reported. A card at the bottom of the Interface page switches the whole pin sheet off, leaving the other plugin to paint its own surfaces.
102
+ - **Issue #32 fixed.** The frosted sidebar column is lifted to `z-index:1`, so a tooltip overhanging the sidebar's right edge stays crisp; the modal exemption now resets `z-index` and `isolation` together.
103
+ - After installing or updating, **restart the host once** — the compatibility gate runs when the profile is assembled.
102
104
 
103
- ### v0.4.0 (persistence-integrity batch + rotation / export / profile features)
105
+ ### v0.4.1 (fixes the "Every refresh" cadence flipping the wallpaper every 30 seconds)
104
106
 
105
- - **Theme exports now carry the whole rotation pool (v3).** The old export carried the config and the active wallpaper only: the pool's metadata (file names + thumbnails) travelled with the config while the image bytes stayed on the source machine, so after an import on another machine every activation failed with `file missing`. A v3 export embeds each pool image's bytes (fetched from the new `/dsh-any-background/rotation/file` route, whose name goes through the same anti-traversal fence the config sanitizer uses) as `pool`; the import runs a new `rotationRestore` RPC that rebuilds the pool wholesale — bytes land under their exported file names, unreferenced files are dropped, and the cursor clamps into the new range. Dead entries in v2 files clear on import instead of failing on every activation.
106
- - **Rotation gains an hourly cadence — and advances while the page stays open.** Advancing used to happen only inside the `read` RPC on page load, so a long-lived window never changed wallpaper; the 30-second schedule tick now re-checks it too (pure math gate — a no-op when nothing is due). The due/pick math moved into a shared module inlined into both bundles at build time (`src/shared/rotation.ts`), so the two halves can never disagree on a day/week boundary again.
107
- - **Profiles can be renamed and duplicated.** Each row gains an inline rename (Enter commits) and a one-click duplicate (fresh id, `(2)` name suffix, same 20-entry oldest-eviction limit).
108
- - **Persistence correctness fixes — each matching a failure mode this repo has already hit.** `readConfig`'s failure path handed back a shallow copy whose nested arrays rotation add/remove mutated in place, leaving ghost pool items in the module-level defaults forever (now `structuredClone`); a failed config write left the mtime-keyed cache describing changes the disk never got (cache dropped before writing); the font slot's stray-file adoption mislabelled MIME by file name, serving woff2 bytes as ttf (now sniffed from real magic bytes and persisted); raw wallpaper uploads skipped byte validation (now the same magic-number fence as the URL download and the font upload); rotation file names could collide within one millisecond (random suffix added); manual activation did not persist the cursor, so a reload jumped back to the old image (server-side read-modify-write, the same semantics as the auto-advance).
109
- - **Structure & performance.** The browser half's four body-level MutationObservers merged into a single bus (`src/client/dom-watch.ts`, auto-disconnecting on the last unsubscribe); the parts pass moved from rAF to microtask coalescing — the v0.3.9 lesson (a queued frame never runs while the window is not painting), so a view or takeover card mounted in the background is styled immediately; `applyWp`'s fan-out deduplicated (the produced / header-popover passes ran twice per apply); a failed config write retries once (a transient Windows EBUSY from an antivirus scan) and then warns explicitly instead of being swallowed; `read` probes its three slots concurrently; a first run writes the config once, not twice; startup sweeps crash-leftover tmp files, excess `.corrupt-*` archives (keeping the newest 3) and orphaned pool files (10-minute grace); rotation advance/activate uses `copyFile`, so multi-MB wallpapers no longer pass through the heap whole.
110
- - **i18n cleanup.** Four dead keys removed and embedded Chinese quotes in the English copy replaced; zh/en at 197/197 key parity.
107
+ - Only the time-based cadences (hourly / daily / weekly) advance on the schedule tick; "Every refresh" keeps its original meaning: one fresh pick per page load, plus the manual next button.
111
108
 
112
109
  ## Installation
113
110
 
@@ -165,7 +162,7 @@ pnpm dsh web
165
162
  - **HTTP surface**: registers only `/dsh-any-background/{video,wallpaper,font}` (GET/HEAD streaming) with matching `*/upload` POST routes (100 MB cap) and the dedicated RPC channel `/dsh-any-background` under the local dsh web server; no extra listening ports.
166
163
  - **Restart requirements**: the first install needs a (re)start of `dsh web` to load the client bundle; settings changes afterwards apply live and persist automatically. Updating the plugin requires a restart to pick up the new `lib/client.js`.
167
164
  - **Tests & verification**: `pnpm run typecheck` (full tsc check) and `pnpm run bundle` (tsdown emits `lib/`); no automated unit tests — behavior is verified manually.
168
- - **Known limitations**: the styling relies on stable host DOM markers (`[data-sidebar-right-panel]`, `[data-dsh-bottom-panel]`, …) and CSS token names; a host restyle of those layers can leave a slider ineffective for its surface (cosmetic only — nothing breaks). The version-specific half of those selectors lives inside its own version folder, so a host revision normally means editing that one file. `-webkit-text-stroke` may clip about 1px at the edge of some single-line ellipsis containers.
165
+ - **Known limitations**: the styling relies on stable host DOM markers (`[data-sidebar-right-panel]`, `[data-dsh-bottom-panel]`, …) and CSS token names; a host restyle of those layers can leave a slider ineffective for its surface (cosmetic only — nothing breaks). The version-specific half of those selectors lives inside its own version folder, so a host revision normally means editing that one file. `-webkit-text-stroke` may clip about 1px at the edge of some single-line ellipsis containers. One rule is a deliberate cross-plugin accommodation: dsh-better-display paints its sticky reading lanes from the token our 「主界面」 opacity owns, so when that plugin is detected its lanes are pinned at 20% plate + 30px frost outside the sliders — if it ever renames those markers the rule stops matching and its lanes simply go back to being painted the way it paints them.
169
166
 
170
167
  ## Star History
171
168
 
package/README.zh.md CHANGED
@@ -93,19 +93,16 @@
93
93
 
94
94
  ## 更新日志(只保留最近两个版本)
95
95
 
96
- ### v0.4.1(修复:「每次刷新」档位壁纸每 30 秒自动切换)
96
+ ### v0.4.2(兼容 dsh-better-display 的吸顶总结栏 · 修掉 issue #32)
97
97
 
98
- - **发生了什么。** v0.4.0 让 30 秒一次的定时检查顺带推进到期的轮换,好让「每小时」档在页面长驻时也能换图。但到期数学对「每次刷新」档位是**恒为到期**——这正是页面加载能拿到新图的原因(服务端在 `read` RPC 里推进它)。把它接进定时器后就成了:轮换开启 + 选了「每次刷新」→ 壁纸每 30 秒自己换一张;系统明暗翻转、开启昼夜定时时也会跟着再切一次(这两处同样驱动该定时器)。
99
- - **怎么修的。** 「哪些档位参与活推进」现在是共享数学的一部分:`src/shared/rotation.ts` 新增 `rotationAdvancesLive()`(与其余到期数学一样构建时内联进两个 bundle),只有时间档位——每小时 / 每天 / 每周——参与活推进。「每次刷新」回到它原本的语义:每次页面加载换一张,外加手动「换一张」按钮。boot 回退与开启开关时的立即换图行为不变。
98
+ - **总结栏不再被掏空。** 它的底板用的是「主界面」透明度接管的那个令牌,被拉到 0 之后正文直接从总结栏底下透上来。现在认出 [dsh-better-display](https://github.com/aa2246740/dsh-better-display) 就把这条带子钉在 **20% 底板 + 30px 磨砂**(不随任何滑块调节,颜色仍跟主题走),并把原来分开的三条合并成一整块,底部两角倒圆。
99
+ - **第三方表面自检 + 兼容开关。** 开机扫一遍其它插件的样式表,在控制台点名「谁的表面吃了本插件接管的令牌」:已登记的自动保护,未登记的提示把这条日志发过来就能加钉。「界面」页底部新增「第三方插件兼容」卡片,关掉后整张钉表撤下,完全不介入另一个插件的画法。
100
+ - **修掉 issue #32。** 被磨砂的侧栏列提到 `z-index:1`,提示条悬出侧栏右缘的那一段重新清晰;模态豁免里 `z-index` 与 `isolation` 同进同退。
101
+ - 装完或更新后请**重启一次宿主**——兼容门禁在组装 profile 时才跑。
100
102
 
101
- ### v0.4.0(持久化正确性批次 + 轮换 / 导出 / 档案功能)
103
+ ### v0.4.1(修掉「每次刷新」档位每 30 秒自动换图)
102
104
 
103
- - **主题导出现在带上整个轮换池(v3)。** 旧导出只带配置与主壁纸:轮换池的元数据(文件名 + 缩略图)随配置走了,图片字节却留在原机器上,换机导入后每次切换都报 `file missing`。v3 导出把池内每张图的字节(从新路由 `/dsh-any-background/rotation/file` 取回,名称走与配置清洗相同的防穿越围栏)内嵌为 `pool`;导入走新的 `rotationRestore` RPC 整体重建——字节按导出时的原文件名落盘、清掉未被引用的旧文件、游标夹取进新范围。v2 旧文件里的死条目会在导入时清空,而不是留着每次激活都失败。
104
- - **轮换新增「每小时」档,且页面开着也会推进。** 到期推进原来只发生在页面加载时的 `read` RPC 里,长驻窗口永远不换图;现在 30 秒一次的定时检查也会过一遍轮换(纯数学门控,没到期就是空操作)。日 / 周 / 随机的到期与选图数学同时抽成双端共享的 `src/shared/rotation.ts`(构建时内联进两个 bundle),两端不会再在日 / 周边界上各自为政。
105
- - **配置档案支持重命名与复制。** 每条档案新增行内重命名(Enter 提交)与一键复制(新 id、`(2)` 名字后缀,沿用 20 条上限的最旧淘汰)。
106
- - **持久化正确性修复——每条都对应一个已发生过的故障模式。** 首启或读盘瞬时失败时 `readConfig` 返回的浅拷贝会被轮换增删原地污染,模块级默认配置从此带上幽灵池项(改 `structuredClone`);配置写失败后按 mtime 的内存缓存与磁盘分叉(改为写前丢缓存);字体槽收养杂散文件时按文件名错标 MIME,woff2 字节被当 ttf 服务(改为嗅探真实魔数并回写配置);壁纸裸字节上传不验内容(补上与 URL 下载、字体上传相同的魔数围栏);轮换池文件名毫秒碰撞(加随机后缀);手动激活轮换后游标不落盘、刷新回跳旧图(服务端按「合并进最新配置」回写,与自动推进同一套语义)。
107
- - **结构与性能。** 浏览器半侧四个 body 级 MutationObserver 合并为单一总线(`src/client/dom-watch.ts`,最后一个退订自动断开);parts 观察的合批从 rAF 挪到微任务——对齐 v0.3.9 的教训(不绘制的窗口里排队的帧根本不跑),后台挂载的视图与 takeover 卡现在立即补上样式;`applyWp` 扇出去重(产出物 / 顶栏浮层等 pass 从每次两遍降为一遍);配置写失败先重试一次(Windows 上杀软扫描文件造成的瞬时 EBUSY)再明确告警,不再静默吞掉;`read` 的三个槽位并行探测;首启只写一次配置;启动时清扫崩溃残留的 tmp 文件、超额的 `.corrupt-*` 归档(保留最近 3 份)与轮换池孤儿文件(10 分钟宽限期);轮换推进 / 激活改用 `copyFile`,多 MB 壁纸不再整块过内存。
108
- - **i18n 清理。** 删除四个无引用死键,英文文案里内嵌的中文引号改为英文写法;中英 197/197 键位对齐。
105
+ - 只有时间档位(每小时 / 每天 / 每周)参与定时推进;「每次刷新」回到原本语义:每次页面加载换一张,外加手动「换一张」按钮。
109
106
 
110
107
  ## 安装
111
108
 
@@ -161,7 +158,7 @@ pnpm dsh web
161
158
  - **HTTP 面**:仅在本机 dsh web 服务下注册 `/dsh-any-background/{video,wallpaper,font}`(GET/HEAD 流式服务)与对应 `*/upload`(POST,上限 100 MB)及专用 RPC 通道 `/dsh-any-background`;无新增对外监听端口。
162
159
  - **是否需要重启**:首次安装后需(重新)启动 `dsh web` 加载客户端 bundle;此后的设置变更实时生效、自动落盘。更换插件版本后需重启以加载新的 `lib/client.js`。
163
160
  - **测试与验证**:`pnpm run typecheck`(tsc 全量类型检查)与 `pnpm run bundle`(tsdown 产出 `lib/`);无自动化单测,接口行为以手动验证为准。
164
- - **已知限制**:依赖宿主 DOM 结构的稳定标记(如 `[data-sidebar-right-panel]`、`[data-dsh-bottom-panel]`)与 CSS 令牌名,宿主大版本重构样式层时选择器可能失效(表现为相关滑块不再作用于对应表面,不影响稳定性);版本相关的那部分选择器集中在对应的版本目录里,宿主改版通常只需改那一份;`-webkit-text-stroke` 在部分单行省略号容器边缘约有 1px 裁切。
161
+ - **已知限制**:依赖宿主 DOM 结构的稳定标记(如 `[data-sidebar-right-panel]`、`[data-dsh-bottom-panel]`)与 CSS 令牌名,宿主大版本重构样式层时选择器可能失效(表现为相关滑块不再作用于对应表面,不影响稳定性);版本相关的那部分选择器集中在对应的版本目录里,宿主改版通常只需改那一份;`-webkit-text-stroke` 在部分单行省略号容器边缘约有 1px 裁切。另有一条规则是对其它插件的有意让步:dsh-better-display 的吸顶车道用的正是「主界面」透明度接管的那个令牌,所以认出该插件后会把它的车道钉在 20% 底板 + 30px 磨砂上、不随滑块;它若改名,这条规则就匹配不到,车道回到它自己的画法。
165
162
 
166
163
  ## Star History
167
164