Repository navigation
dsh-notify 0.4.0
dsh-notify 0.4.0
⚠️ 本版为 DSH 0.1.7 适配版。 如果你的 DSH 是 0.1.5 或更早,请留在 0.3.2;如果已经升到 0.1.7+,那么 0.3.x 装上后插件完全不会加载,必须用本版。
症状:插件静默停在 pending
升级 DSH 后,Web 端启动会报:
Failed to load plugins
web boot: 1 entry did not activate
@having5548/dsh-notify: pending (waiting for service: settingsScope)
cordis 会一直挂起一个插件,直到它 inject 的每个服务都存在。0.1.7 把 settingsScope 删掉了,于是插件永远等下去——整个插件不加载,而且没有任何报错,连通知都发不出来。
DSH 0.1.5 → 0.1.7 变了什么
| 用途 | 0.3.x(0.1.5 写法) | 0.4.0(0.1.7 写法) |
|---|---|---|
| 设置读写 | ctx.settingsScope.bind({namespace}) |
ctx.configForms.get('dsh-notify') |
| 待审批 / 待回答 | uiSession.pendingInteractions |
uiSession.sessionStatus → pendingInteraction |
| 后台任务 | sessions.list.jobsBySession |
ctx.jobs.state.rows(+ 按会话 watchRows) |
| 当前会话 | sessions.list.current |
uiSession.adapter.current.getSnapshot().key |
| 服务端设置 | ctx.settings.register(ns, schema) |
导出 Config schema,apply(ctx, config) 直接读 |
session/event、webServer.register、settings.section 槽位都没有变。
本版最重要的改动:不再硬依赖可选服务
光换服务名只解决这一次。真正的病根是硬 inject——任何一个服务被改名或移除,插件就整体静默死亡,而界面上只有一个 pending。
所以本版把 inject 收窄到只剩骨架服务:
var inject = ['sessions', 'slots']configForms / uiSession / jobs / locale 全部改为 ctx.get() 惰性解析,缺哪个就只关掉对应功能并在控制台留一条 warn。宁可少一个功能,也不能整个插件不加载。
后台任务的行为变化
0.1.7 的任务名册是按会话订阅的(引用计数),不再能被动读取。本版会跟随会话列表,为每个列出的会话调用 ctx.jobs.watchRows(),并在会话移出列表时释放订阅。
新增回归测试
tools/smoke-client.mjs —— 打桩跑,无需浏览器:
node tools/smoke-client.mjs覆盖 sessionStatus / jobs / configForms / 优雅降级共 9 组断言。这类 bug 没有它根本看不见(插件静默 pending、零报错)。每次 DSH 升级后请先跑它。
该目录不在
files字段内,不会进入 npm 包。
安装
# 从 npm
dsh plugin --profile web add @having5548/dsh-notify
# 或从本页附件
dsh plugin --profile web add having5548-dsh-notify-0.4.0.tgz安装后重启 DSH Web GUI 生效。
环境
- DSH ≥ 0.1.7-rc.2(0.1.5 及更早请用 0.3.2)
- Windows 10+ / macOS
Assets
having5548-dsh-notify-0.4.0.tgz— 插件安装包- SHA256:
0BC7AB229E95AADC2CF2952EC56162E4E38B2FE5A17F3F91C474F9BCAB8160CE