Skip to content

Releases: HarmlessFunny/dsh-background-by-model

v0.10.0 — 配置原子写与逐图效果 / atomic writes and per-image effects

Choose a tag to compare

@HarmlessFunny HarmlessFunny released this 25 Oct 10:24

0.10.0 让配置写得安全、让三个画笔效果跟着图片走。配置改成原子写并留一份 .bak,主文件坏了从备份恢复;透明度、亮度与模糊从「每条规则」下沉到「每张图」。顺手修掉两个看得见的老问题:模糊会在视口四周画一圈黑边,以及三个数值不同的图之间切换没有过渡。

0.10.0 makes the config safe to write and moves the three paint effects onto the image. Saves are atomic with a .bak, and a corrupt live file is restored from it; opacity, brightness and blur now live on each image rather than on the rule. Two visible bugs went with it: a blurred wallpaper painted a dark rim around the viewport, and a switch between two different values had no transition.

  • 配置改成原子写,并留一份 .bak —— 保存先写临时文件再改名覆盖,覆盖前把当前能解析的那份留成备份。

  • 主文件读不出来时从备份恢复,而不是当新装 —— 两份都读不出时才是出厂默认。

  • resetStore 连 .bak 一起删 —— 留着它,下一次读取会把被替换掉的配置恢复回来。

  • 透明度、亮度与模糊改成逐图保存 —— 与布局模式、取景、主题色同一层。

  • SCHEMA_VERSION 升到 10 —— 字段搬了位置,旧宿主会静默丢掉它们。

  • 模糊的壁纸不再在视口四周画一圈黑边 —— 图层盒子向屏幕外各扩 2σ 再由容器裁掉,取景位置补回同样的距离。

  • 数值不同的两张图之间切换又会有过渡了 —— 每个图层记住自己那张图的滤镜,壁纸透明度也跟着过渡走。

  • 拖动滑块不再每帧整块重绘 —— 拖动只写那个字段自己的属性,松手才走一次完整重绘。

  • The config is written atomically, with a .bak — a save writes a temp file and renames it over the live one, keeping the last parseable copy.

  • A live file that will not parse is restored from the backup, not treated as a fresh install; only when neither parses does the factory default answer.

  • resetStore removes the .bak — leaving it behind would restore the very config the reset replaced.

  • Opacity, brightness and blur are saved per image, the same layer as the layout mode, the framing and the theme colour.

  • SCHEMA_VERSION is 10 — the fields moved, and an older host would drop them in silence.

  • A blurred wallpaper no longer paints a dark rim — each layer's box is grown 2σ past the viewport and clipped, with the framing moved back by the same amount.

  • A switch between two different values animates again — each layer keeps its own picture's filter, and the wallpaper's opacity rides the transition too.

  • Dragging a slider no longer repaints everything per frame — a frame writes only that field's property, and one full repaint lands when the gesture ends.

完整说明 / full notes: CHANGELOG.zh.md · CHANGELOG.md

dsh plugin --profile web add dsh-background-by-model

v0.9.0 — 通道回到 prefix 路由,定时器并成一个 / one prefix route, one scheduler

Choose a tag to compare

@HarmlessFunny HarmlessFunny released this 18 Oct 13:24

0.9.0 主要是一次内部重整:RPC 通道回到 webServer 上的 prefix 路由(这一代宿主的 connection.rpc.handle 在插件侧用不了),四个定时器并成一个调度器,浏览器半边拆成模块。对外能看见的只有两处:导出的主题又能下载了,深色标记交还宿主。

0.9.0 is mostly internal: the RPC channel is a prefix route on webServer again (this host generation's connection.rpc.handle is unusable from a plugin), four timers became one scheduler, and the browser entry point split into modules. Two changes are visible: exported themes download again, and the dark-mode flag belongs to the host again.

  • RPC 通道是 webServer 上的 prefix 路由 —— connection.rpc.handle 经 connection 服务自己的上下文注册,那里解析不到 webServer,条目根本不会激活;鉴权围墙不变,每个请求仍询问 requestRejection。

  • 导出的主题又能下载了 —— object URL 改为下一个任务释放,在同一 tick 里撤销会被部分浏览器当成取消。

  • 所有周期性检查共用一条调度器 —— 模型轮询、主题看守、节日换日与两次延迟恢复,标签页隐藏时暂停,一个 dispose 全停。

  • 浏览器半边重新拆成模块,index.tsx 只剩接线;check:watchdogs 钉住这条调度器。

  • 旧 schema 的推荐配置又能导入了 —— 素材库声明的版本落后于本构建时,缺的字段取默认值,按钮不再误报网络问题。

  • 深色标记交还宿主 —— 宿主自己切到深色后不会再被推回浅色。

  • The RPC channel is a prefix route on webServer — connection.rpc.handle registers through the connection service's own context, which cannot resolve webServer, so the entry never activates. The fence is unchanged: requestRejection is asked per request.

  • Exported themes download again — the object URL is released on the next task, because same-tick revocation reads as a cancellation to some browsers.

  • One scheduler for every recurring check — model poll, theme watchdog, holiday rollover and the two delayed restores; paused while the tab is hidden and stopped by one dispose.

  • The browser entry point is modules again, with index.tsx as wiring; check:watchdogs pins the scheduler.

  • A recommended profile written for an older schema imports again — missing fields take defaults, so the button no longer reports a network problem while the asset host lags this build.

  • The dark-mode flag belongs to the host again — a host that went dark on its own is no longer pushed back to light.

完整说明 / full notes: CHANGELOG.zh.md · CHANGELOG.md

dsh plugin --profile web add dsh-background-by-model

v0.8.0 — 打包时构建,文档精简 / built at pack time, docs trimmed

Choose a tag to compare

@HarmlessFunny HarmlessFunny released this 07 Oct 02:43

打包方式换了:lib/ 不再进仓库,改由打包那一刻从 src/ 构建 —— 所以你装到的那份,永远是从被打 tag 的那份源码构建出来的,不存在"仓库里的旧构建"。代价是不能再直接从 GitHub 仓库安装(那棵树里没有 lib/),npm 是唯一来源;从源码跑一份工作副本的话,构建成了必须先走的一步。发版也搬进了 GitHub Actions、走 OIDC,于是每个版本都带上构建 provenance。README 和 CHANGELOG 同时收了回来:每个功能一句话,理由留给 CHANGELOG。

How the package is built changed: lib/ is no longer in the repository and is built from src/ at pack time, so what you install is always built from the tagged source rather than from whatever was committed. The cost is that installing straight from a GitHub checkout is gone — that tree has no lib/ — so npm is the only source, and a working copy built from source now has the build as a step you must run. Releases moved to GitHub Actions over OIDC as well, so every version now carries build provenance. The README and CHANGELOG were cut back at the same time: a feature is a sentence, and the reasoning stays in the CHANGELOG.

  • 构建产物在打包时生成 —— lib/ 是每次发版约 1 MB 的生成代码,也几乎就是这个仓库增长的全部;现在它不进 git,由 prepack 在 npm pack / npm publish 时构建。

  • github: 安装这条路没了 —— 那棵树里没有 lib/,也没有任何东西会去构建它。npm 是唯一来源,npx 那条也跟着它走。

  • 发版走 OIDC,版本带 provenance —— npm token 彻底退出发版路径;npm 会附上一份证明,把版本绑到产出它的提交和工作流上。

  • README 与 CHANGELOG 收回到 v0.3.x 的密度 —— 功能一句话带过,十道检查各一行,常见问题十五个一个不少。

  • The bundle is built when the tarball is packed, instead of ~1 MB of generated JavaScript being committed every release and effectively being all of this repository's growth. prepack builds it for both npm pack and npm publish.

  • The github: install route is gone — that tree has no lib/ and nothing in it builds one. npm is the only source, and the npx form follows it.

  • Releases go out over OIDC and carry provenance — the npm token is out of the release path, and each version is bound by attestation to the commit and workflow that produced it.

  • The README and CHANGELOG are cut back to the v0.3.x register — a feature in a sentence, the ten checks one line each, all fifteen FAQ questions kept.

完整说明 / full notes: CHANGELOG.zh.md · CHANGELOG.md

dsh plugin --profile web add dsh-background-by-model

v0.6.0 — 节日特殊背景 / holiday backgrounds

Choose a tag to compare

@HarmlessFunny HarmlessFunny released this 01 Oct 13:53

节日特殊背景:中秋与国庆当天,背景自动换成那个节日自己的图片、并配上该节日固定的主题色,第二天自动换回。

  • 只有一个开关 —「配置」页上一个开关,默认开启;刻意不做每个节日的卡片、缩略图和选图入口 —— 那些面板让这个功能看起来像是等着用户去配置的东西,而它恰恰不是。
  • 图片和配色都换不掉 — 两张壁纸随包发布(原生分辨率 WebP q80,原图 8.37 MB → 729 KB;包 401 KB → 1.12 MB),节日槽位只读:写入、删除、抓取一律被拒,丢进去的文件不会被任何一次读取采用。
  • 主题色是常量,不是从图里读出来的 — 中秋 #384A77、国庆 #FFF6EB,写在节日定义里、每次读取强制覆盖,手改 theme-config.json 里的 color 也换不掉。
  • 中秋按农历、国庆按公历,时区钉在 Asia/Shanghai — 农历换算用浏览器自带的 ICU,零依赖;闰八月不会把中秋拖进十月;两者重叠时(2025-10-06)中秋优先。
  • 不花启动代价 — 只取今天真能生效的那一个节日,不在节日的日子那 729 KB 一个字节都不读。
  • 三道零依赖校验 — pnpm check:holiday / check:ui / check:node,pnpm test 现在会一并执行,其中 check:node 把构建产物里的 node 半边通过真实 RPC 处理器跑一遍。

Holiday backgrounds: on 中秋节 and 国庆节 the wallpaper switches to that holiday's own image and its own fixed theme color, and switches back the next morning. It ships ON, with a single switch on the Config page.

  • Packaged and read-only — both wallpapers ship at native resolution, WebP q80 (8.37 MB of source art → 729 KB; the tarball goes 401 KB → 1.12 MB). A file dropped into a holiday slot is ignored by every read, and writing, deleting or URL-fetching into one is refused.
  • Fixed theme colors — 中秋 #384A77, 国庆 #FFF6EB: constants in the holiday definition, converted to the rule shape's [h, s, l] by the shared schema and forced on every read.
  • 中秋 is lunar, 国庆 is fixed, both read in Asia/Shanghai — resolved from the browser's own ICU Chinese calendar with no dependency; a leap eighth month cannot drag the festival into October; 中秋 wins the 2025-10-06 overlap.
  • Three dependency-free checks now run under pnpm test.

完整说明 / full notes: CHANGELOG.zh.md · CHANGELOG.md

dsh plugin --profile web add dsh-background-by-model

v0.3.0 — 按模型切换背景 / per-model background rules

Choose a tag to compare

@HarmlessFunny HarmlessFunny released this 13 Sep 10:58

按模型切换背景:每条规则自带一整套外观,切模型就换背景。
Per-model backgrounds: an ordered rule list where every rule carries its own wallpaper and appearance.

dsh plugin --profile web add dsh-background-by-model

中文

核心

  • 有序模型规则 — 自上而下用匹配串比对当前会话的模型名(provider / 模型 id / 显示名拼接,忽略大小写),先命中者胜;一条都没命中就用第 1 条,规则 1 兼任兜底。
  • 外观下放到每条规则 — 壁纸、主题色、布局模式(适应 / 填充 / 拉伸 / 平铺 / 居中)、取景、背景透明度、背景模糊都是规则自己的属性,不同模型可以有完全不同的样子。
  • 切换不卡了 — 壁纸改用 object URL 绘制,同一张图只解码一次;规则切换改为 320 ms 交叉淡入(新图在旧图上方淡入,底层始终不透明,中途不会发亮)。
  • 状态行会说真话 — 「模型背景」页实时显示当前模型、命中的规则;只读到宿主默认模型时标注 宿主默认,并指出是哪一环失败。
  • 旧配置自动迁移 — 0.3.0 之前的单张全局壁纸会变成匹配串留空的规则 1 并继承旧外观,旧版遗留的视频文件会被清理。
  • 设置重构 — 现在是 「界面」(全局透明度/模糊)、「模型背景」(规则列表)、「配置」(导入/导出 v3,含图片)。

修复

  • 切换模型没反应 — 三处叠加:ctx.modelDirectories 在插件上下文里不可见;本插件客户端 bundle 早于 api-session-controller 加载导致 ctx.get('sessions') 在 apply() 时还不存在(旧代码在此直接放弃、永不重试);状态行拿宿主默认值冒充了本会话模型。现在改读本会话自己的 modelSelection 投影,并以 400 ms 间隔等待 sessions 服务出现。

破坏性变更

  • 移除视频背景、生成式背景(网格渐变 / Shader / 几何图案)与全局主题色。

English

  • Ordered model rules — case-insensitive substring match against the current session's provider / model id / display name, first match wins; rule 1 doubles as the fallback.
  • Appearance is per rule — wallpaper, theme color, layout mode, framing, background opacity and blur all belong to the rule.
  • Smooth switching — wallpapers paint from an object URL (decoded once) and rule changes cross-fade over 320 ms, with the outgoing image staying fully opaque so the backdrop never brightens mid-transition.
  • The readout tells the truth — the current model and matched rule, a host default badge when only the global default could be read, and the exact failing hop when detection breaks.
  • Automatic migration — a pre-0.3.0 global wallpaper becomes rule 1 with an empty match string and keeps its appearance.
  • Fixed: switching the model did nothing — ctx.modelDirectories is not visible to plugins, and this plugin's client bundle loads before api-session-controller, so ctx.get('sessions') was still undefined during apply() and the old watcher gave up permanently. It now reads this session's own modelSelection projection and waits for the sessions service.
  • Breaking removals — video wallpapers, generated backgrounds and the global theme color are gone.

Storage 存储

~/.dsh/.dsh-background-by-model-data/ — theme-config.json + modelbg-<slot> per rule.