dsh-reminder-notify 0.6.0 → 0.8.0
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/client.js +137 -4
- package/index.js +73 -2
- package/package.json +1 -1
- package/publish/index.json +2 -2
package/client.js
CHANGED
|
@@ -14,6 +14,9 @@ window.__ModuleLoader__.load({
|
|
|
14
14
|
const h = React.createElement
|
|
15
15
|
|
|
16
16
|
const NS = 'dsh-reminder-notify'
|
|
17
|
+
// 与 index.js 里 Host 注册的路由保持一致(同源 GET,返回 { dir, files, error? })。
|
|
18
|
+
const AUDIO_ROUTE = '/dsh-reminder-notify/audio'
|
|
19
|
+
const AUDIO_KEYS = ['doneAudio', 'decideAudio', 'rawAudio']
|
|
17
20
|
|
|
18
21
|
const zh = {
|
|
19
22
|
title: '桌面提醒设置',
|
|
@@ -57,6 +60,17 @@ window.__ModuleLoader__.load({
|
|
|
57
60
|
titleTemplate: '标题模板',
|
|
58
61
|
messageTemplate: '正文模板',
|
|
59
62
|
templateHint: '可用占位符 {title} {message} {kind} {time}。',
|
|
63
|
+
doneTitleTemplate: 'done 专用标题模板',
|
|
64
|
+
doneMessageTemplate: 'done 专用正文模板',
|
|
65
|
+
decideTitleTemplate: 'decide 专用标题模板',
|
|
66
|
+
decideMessageTemplate: 'decide 专用正文模板',
|
|
67
|
+
rawTitleTemplate: 'raw 专用标题模板',
|
|
68
|
+
rawMessageTemplate: 'raw 专用正文模板',
|
|
69
|
+
perKindTemplateHint: '留空 = 用上面的通用模板;可用占位符 {title} {message} {kind} {time}。',
|
|
70
|
+
audioPick: '从目录选',
|
|
71
|
+
audioScanning: '正在读取音频目录…',
|
|
72
|
+
audioEmpty: '音频目录里没有可用的音频文件',
|
|
73
|
+
audioFailed: '读取音频目录失败:',
|
|
60
74
|
hostMode: '宿主模式',
|
|
61
75
|
hostModeScript: '包内脚本(推荐)',
|
|
62
76
|
hostModeExe: '外部 exe 客户端',
|
|
@@ -65,6 +79,9 @@ window.__ModuleLoader__.load({
|
|
|
65
79
|
powershellPath: 'PowerShell 可执行文件',
|
|
66
80
|
clientDir: '客户端目录(仅 exe 模式)',
|
|
67
81
|
empty: '(留空用默认)',
|
|
82
|
+
browse: '浏览…',
|
|
83
|
+
picking: '选择中…',
|
|
84
|
+
pickFailed: '打开目录选择器失败:',
|
|
68
85
|
save: '保存',
|
|
69
86
|
saving: '保存中…',
|
|
70
87
|
reset: '撤销修改',
|
|
@@ -118,6 +135,17 @@ window.__ModuleLoader__.load({
|
|
|
118
135
|
titleTemplate: 'Title template',
|
|
119
136
|
messageTemplate: 'Message template',
|
|
120
137
|
templateHint: 'Placeholders: {title} {message} {kind} {time}.',
|
|
138
|
+
doneTitleTemplate: 'Done-only title template',
|
|
139
|
+
doneMessageTemplate: 'Done-only message template',
|
|
140
|
+
decideTitleTemplate: 'Decide-only title template',
|
|
141
|
+
decideMessageTemplate: 'Decide-only message template',
|
|
142
|
+
rawTitleTemplate: 'Raw-only title template',
|
|
143
|
+
rawMessageTemplate: 'Raw-only message template',
|
|
144
|
+
perKindTemplateHint: 'Empty falls back to the shared template; placeholders: {title} {message} {kind} {time}.',
|
|
145
|
+
audioPick: 'Pick from the directory',
|
|
146
|
+
audioScanning: 'Reading the sound directory…',
|
|
147
|
+
audioEmpty: 'No audio files in the sound directory',
|
|
148
|
+
audioFailed: 'Could not read the sound directory: ',
|
|
121
149
|
hostMode: 'Host mode',
|
|
122
150
|
hostModeScript: 'Bundled script (recommended)',
|
|
123
151
|
hostModeExe: 'External exe client',
|
|
@@ -126,6 +154,9 @@ window.__ModuleLoader__.load({
|
|
|
126
154
|
powershellPath: 'PowerShell executable',
|
|
127
155
|
clientDir: 'Client directory (exe mode)',
|
|
128
156
|
empty: '(empty uses the default)',
|
|
157
|
+
browse: 'Browse…',
|
|
158
|
+
picking: 'Choosing…',
|
|
159
|
+
pickFailed: 'Could not open the directory picker: ',
|
|
129
160
|
save: 'Save',
|
|
130
161
|
saving: 'Saving…',
|
|
131
162
|
reset: 'Discard changes',
|
|
@@ -158,6 +189,9 @@ window.__ModuleLoader__.load({
|
|
|
158
189
|
.drn-btn { font: inherit; font-size: 13px; padding: 6px 14px; border-radius: 7px; cursor: pointer; border: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
|
|
159
190
|
.drn-btn.primary { background: var(--dsw-alias-brand-primary); border-color: transparent; color: #fff; }
|
|
160
191
|
.drn-btn[disabled] { opacity: .5; cursor: default; }
|
|
192
|
+
.drn-pick { display: flex; gap: 6px; width: 100%; align-items: center; }
|
|
193
|
+
.drn-pick .drn-input { flex: 1 1 auto; min-width: 0; }
|
|
194
|
+
.drn-btn.small { padding: 5px 10px; white-space: nowrap; }
|
|
161
195
|
.drn-msg { font-size: 12px; color: var(--dsw-alias-label-secondary); }
|
|
162
196
|
.drn-msg.error { color: var(--dsw-alias-state-error-primary); }
|
|
163
197
|
`
|
|
@@ -171,7 +205,7 @@ window.__ModuleLoader__.load({
|
|
|
171
205
|
{ key: 'doneAudio', group: 'audio', kind: 'text' },
|
|
172
206
|
{ key: 'decideAudio', group: 'audio', kind: 'text' },
|
|
173
207
|
{ key: 'rawAudio', group: 'audio', kind: 'text' },
|
|
174
|
-
{ key: 'audioDir', group: 'audio', kind: 'text' },
|
|
208
|
+
{ key: 'audioDir', group: 'audio', kind: 'text', pick: 'directory' },
|
|
175
209
|
{ key: 'accentDone', group: 'look', kind: 'color' },
|
|
176
210
|
{ key: 'accentDecide', group: 'look', kind: 'color' },
|
|
177
211
|
{ key: 'accentRaw', group: 'look', kind: 'color' },
|
|
@@ -185,10 +219,16 @@ window.__ModuleLoader__.load({
|
|
|
185
219
|
{ key: 'rawCardIcon', group: 'look', kind: 'text' },
|
|
186
220
|
{ key: 'titleTemplate', group: 'look', kind: 'text' },
|
|
187
221
|
{ key: 'messageTemplate', group: 'look', kind: 'text' },
|
|
222
|
+
{ key: 'doneTitleTemplate', group: 'look', kind: 'text' },
|
|
223
|
+
{ key: 'doneMessageTemplate', group: 'look', kind: 'text' },
|
|
224
|
+
{ key: 'decideTitleTemplate', group: 'look', kind: 'text' },
|
|
225
|
+
{ key: 'decideMessageTemplate', group: 'look', kind: 'text' },
|
|
226
|
+
{ key: 'rawTitleTemplate', group: 'look', kind: 'text' },
|
|
227
|
+
{ key: 'rawMessageTemplate', group: 'look', kind: 'text' },
|
|
188
228
|
{ key: 'hostMode', group: 'host', kind: 'select', options: ['script', 'exe'], optionLabels: ['hostModeScript', 'hostModeExe'] },
|
|
189
229
|
{ key: 'scriptPath', group: 'host', kind: 'text' },
|
|
190
230
|
{ key: 'powershellPath', group: 'host', kind: 'text' },
|
|
191
|
-
{ key: 'clientDir', group: 'host', kind: 'text' },
|
|
231
|
+
{ key: 'clientDir', group: 'host', kind: 'text', pick: 'directory' },
|
|
192
232
|
]
|
|
193
233
|
|
|
194
234
|
const HINTS = {
|
|
@@ -207,6 +247,12 @@ window.__ModuleLoader__.load({
|
|
|
207
247
|
rawCardIcon: 'perKindHint',
|
|
208
248
|
titleTemplate: 'templateHint',
|
|
209
249
|
messageTemplate: 'templateHint',
|
|
250
|
+
doneTitleTemplate: 'perKindTemplateHint',
|
|
251
|
+
doneMessageTemplate: 'perKindTemplateHint',
|
|
252
|
+
decideTitleTemplate: 'perKindTemplateHint',
|
|
253
|
+
decideMessageTemplate: 'perKindTemplateHint',
|
|
254
|
+
rawTitleTemplate: 'perKindTemplateHint',
|
|
255
|
+
rawMessageTemplate: 'perKindTemplateHint',
|
|
210
256
|
scriptPath: 'scriptPathHint',
|
|
211
257
|
}
|
|
212
258
|
|
|
@@ -226,7 +272,32 @@ window.__ModuleLoader__.load({
|
|
|
226
272
|
const revision = state && state.revision
|
|
227
273
|
const [draft, setDraft] = React.useState(null)
|
|
228
274
|
const [busy, setBusy] = React.useState(false)
|
|
275
|
+
const [picking, setPicking] = React.useState(false)
|
|
229
276
|
const [message, setMessage] = React.useState(null)
|
|
277
|
+
const [audio, setAudio] = React.useState({ dir: '', files: [], error: null })
|
|
278
|
+
|
|
279
|
+
// 音频候选:Host 端注册了只读路由 /dsh-reminder-notify/audio,页面同源 fetch 拿目录清单。
|
|
280
|
+
// 拿不到(旧宿主 / 路由被拦)就静默降级成手填文件名,不打扰用户。
|
|
281
|
+
const scanDir = (draft && typeof draft.audioDir === 'string' && draft.audioDir !== '' ? draft.audioDir : values.audioDir) || ''
|
|
282
|
+
React.useEffect(() => {
|
|
283
|
+
if (typeof fetch !== 'function') return undefined
|
|
284
|
+
let cancelled = false
|
|
285
|
+
const url = AUDIO_ROUTE + (scanDir === '' ? '' : '?dir=' + encodeURIComponent(scanDir))
|
|
286
|
+
Promise.resolve()
|
|
287
|
+
.then(() => fetch(url, { headers: { accept: 'application/json' } }))
|
|
288
|
+
.then((response) => (response && response.ok ? response.json() : Promise.reject(new Error('HTTP ' + (response ? response.status : '?')))))
|
|
289
|
+
.then((data) => {
|
|
290
|
+
if (cancelled) return
|
|
291
|
+
setAudio({ dir: (data && data.dir) || scanDir, files: data && Array.isArray(data.files) ? data.files : [], error: (data && data.error) || null })
|
|
292
|
+
})
|
|
293
|
+
.catch((error) => {
|
|
294
|
+
if (cancelled) return
|
|
295
|
+
setAudio({ dir: scanDir, files: [], error: String((error && error.message) || error) })
|
|
296
|
+
})
|
|
297
|
+
return () => {
|
|
298
|
+
cancelled = true
|
|
299
|
+
}
|
|
300
|
+
}, [scanDir])
|
|
230
301
|
|
|
231
302
|
if (props.view === 'summary') {
|
|
232
303
|
const tr = typeof t === 'function' ? t : (key) => key
|
|
@@ -282,6 +353,26 @@ window.__ModuleLoader__.load({
|
|
|
282
353
|
})
|
|
283
354
|
}
|
|
284
355
|
|
|
356
|
+
// 目录类字段的「浏览…」:调宿主原生的目录选择器(client uiWorkspace.pickDirectory),
|
|
357
|
+
// 选完直接把绝对路径写进草稿;面板拿不到选择器时按钮不渲染,字段照旧手填。
|
|
358
|
+
function browse(key) {
|
|
359
|
+
const pick = props.pickDirectory
|
|
360
|
+
if (typeof pick !== 'function' || picking) return
|
|
361
|
+
setPicking(true)
|
|
362
|
+
setMessage(null)
|
|
363
|
+
Promise.resolve()
|
|
364
|
+
.then(() => pick())
|
|
365
|
+
.then((picked) => {
|
|
366
|
+
setPicking(false)
|
|
367
|
+
if (typeof picked === 'string' && picked !== '') edit(key, picked, 'text')
|
|
368
|
+
})
|
|
369
|
+
.catch((error) => {
|
|
370
|
+
setPicking(false)
|
|
371
|
+
const prefix = typeof t === 'function' ? t('pickFailed') : 'pick failed: '
|
|
372
|
+
setMessage({ ok: false, text: prefix + String((error && error.message) || error) })
|
|
373
|
+
})
|
|
374
|
+
}
|
|
375
|
+
|
|
285
376
|
function control(field) {
|
|
286
377
|
const value = effective[field.key]
|
|
287
378
|
const disabled = !writable || busy
|
|
@@ -311,7 +402,7 @@ window.__ModuleLoader__.load({
|
|
|
311
402
|
onChange: (e) => edit(field.key, e.target.value, 'color'),
|
|
312
403
|
})
|
|
313
404
|
}
|
|
314
|
-
|
|
405
|
+
const input = h('input', {
|
|
315
406
|
className: 'drn-input',
|
|
316
407
|
type: field.kind === 'number' ? 'number' : 'text',
|
|
317
408
|
value: value === undefined || value === null ? '' : String(value),
|
|
@@ -319,6 +410,41 @@ window.__ModuleLoader__.load({
|
|
|
319
410
|
disabled,
|
|
320
411
|
onChange: (e) => edit(field.key, e.target.value, field.kind),
|
|
321
412
|
})
|
|
413
|
+
if (AUDIO_KEYS.includes(field.key) && audio.files.length > 0) {
|
|
414
|
+
return h(
|
|
415
|
+
'div',
|
|
416
|
+
{ className: 'drn-pick' },
|
|
417
|
+
input,
|
|
418
|
+
h(
|
|
419
|
+
'select',
|
|
420
|
+
{
|
|
421
|
+
className: 'drn-select',
|
|
422
|
+
disabled,
|
|
423
|
+
value: '',
|
|
424
|
+
onChange: (e) => {
|
|
425
|
+
const picked = e.target.value
|
|
426
|
+
if (picked !== '') edit(field.key, picked, 'text')
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
[h('option', { value: '' }, typeof t === 'function' ? t('audioPick') : 'pick')].concat(
|
|
430
|
+
audio.files.map((name) => h('option', { value: name }, name)),
|
|
431
|
+
),
|
|
432
|
+
),
|
|
433
|
+
)
|
|
434
|
+
}
|
|
435
|
+
if (field.pick === 'directory' && typeof props.pickDirectory === 'function') {
|
|
436
|
+
return h(
|
|
437
|
+
'div',
|
|
438
|
+
{ className: 'drn-pick' },
|
|
439
|
+
input,
|
|
440
|
+
h(
|
|
441
|
+
'button',
|
|
442
|
+
{ type: 'button', className: 'drn-btn small', disabled: disabled || picking, onClick: () => browse(field.key) },
|
|
443
|
+
typeof t === 'function' ? t(picking ? 'picking' : 'browse') : 'Browse…',
|
|
444
|
+
),
|
|
445
|
+
)
|
|
446
|
+
}
|
|
447
|
+
return input
|
|
322
448
|
}
|
|
323
449
|
|
|
324
450
|
const groups = GROUPS.map((group) =>
|
|
@@ -380,6 +506,13 @@ window.__ModuleLoader__.load({
|
|
|
380
506
|
function apply(ctx) {
|
|
381
507
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'dsh-reminder-notify: settings dictionaries')
|
|
382
508
|
|
|
509
|
+
// 目录选择器来自 Client 的 uiWorkspace 服务;旧宿主没有这个服务时保持 undefined,
|
|
510
|
+
// 面板会退化成纯手填,不影响保存。
|
|
511
|
+
const workspace = typeof ctx.get === 'function' ? ctx.get('uiWorkspace') : undefined
|
|
512
|
+
const pickDirectory = workspace && typeof workspace.pickDirectory === 'function'
|
|
513
|
+
? () => workspace.pickDirectory()
|
|
514
|
+
: undefined
|
|
515
|
+
|
|
383
516
|
ctx.effect(() => {
|
|
384
517
|
if (typeof document === 'undefined') return
|
|
385
518
|
const previous = document.getElementById('drn-panel-style')
|
|
@@ -400,7 +533,7 @@ window.__ModuleLoader__.load({
|
|
|
400
533
|
name: 'plugins.bundle.config',
|
|
401
534
|
key: NS,
|
|
402
535
|
locale: NS,
|
|
403
|
-
inject: () => ({ t: ctx.locale.bind(NS) }),
|
|
536
|
+
inject: () => ({ t: ctx.locale.bind(NS), pickDirectory }),
|
|
404
537
|
},
|
|
405
538
|
ReminderConfigPanel,
|
|
406
539
|
),
|
package/index.js
CHANGED
|
@@ -52,6 +52,12 @@ export const Config = z === null ? undefined : z.object({
|
|
|
52
52
|
rawCardIcon: z.string().default('').description('raw 档位单独用的标题图标,留空 = 用通用图标'),
|
|
53
53
|
titleTemplate: z.string().default('{title}').description('标题模板,可用占位符 {title} {message} {kind} {time}'),
|
|
54
54
|
messageTemplate: z.string().default('{message}').description('正文模板,可用占位符 {title} {message} {kind} {time}'),
|
|
55
|
+
doneTitleTemplate: z.string().default('').description('done 档位单独的标题模板,留空 = 用上面的通用模板'),
|
|
56
|
+
doneMessageTemplate: z.string().default('').description('done 档位单独的正文模板,留空 = 用通用模板'),
|
|
57
|
+
decideTitleTemplate: z.string().default('').description('decide 档位单独的标题模板,留空 = 用通用模板'),
|
|
58
|
+
decideMessageTemplate: z.string().default('').description('decide 档位单独的正文模板,留空 = 用通用模板'),
|
|
59
|
+
rawTitleTemplate: z.string().default('').description('raw 档位单独的标题模板,留空 = 用通用模板'),
|
|
60
|
+
rawMessageTemplate: z.string().default('').description('raw 档位单独的正文模板,留空 = 用通用模板'),
|
|
55
61
|
})
|
|
56
62
|
|
|
57
63
|
const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)))
|
|
@@ -127,6 +133,12 @@ function settingsOf(config) {
|
|
|
127
133
|
rawCardIcon: str(c.rawCardIcon, ''),
|
|
128
134
|
titleTemplate: typeof c.titleTemplate === 'string' ? c.titleTemplate : '{title}',
|
|
129
135
|
messageTemplate: typeof c.messageTemplate === 'string' ? c.messageTemplate : '{message}',
|
|
136
|
+
doneTitleTemplate: typeof c.doneTitleTemplate === 'string' ? c.doneTitleTemplate : '',
|
|
137
|
+
doneMessageTemplate: typeof c.doneMessageTemplate === 'string' ? c.doneMessageTemplate : '',
|
|
138
|
+
decideTitleTemplate: typeof c.decideTitleTemplate === 'string' ? c.decideTitleTemplate : '',
|
|
139
|
+
decideMessageTemplate: typeof c.decideMessageTemplate === 'string' ? c.decideMessageTemplate : '',
|
|
140
|
+
rawTitleTemplate: typeof c.rawTitleTemplate === 'string' ? c.rawTitleTemplate : '',
|
|
141
|
+
rawMessageTemplate: typeof c.rawMessageTemplate === 'string' ? c.rawMessageTemplate : '',
|
|
130
142
|
}
|
|
131
143
|
}
|
|
132
144
|
|
|
@@ -251,8 +263,11 @@ async function notify(kind, args, settings) {
|
|
|
251
263
|
const plainTitle = str(args.title, DEFAULT_TITLES[kind])
|
|
252
264
|
const plainMessage = str(args.message, DEFAULT_MESSAGES[kind])
|
|
253
265
|
const vars = { title: plainTitle, message: plainMessage, kind, time: clockText(new Date()) }
|
|
254
|
-
|
|
255
|
-
const
|
|
266
|
+
// 档位模板优先:留空就退回上面的通用模板,两层都空才落到 "{title}" / "{message}"。
|
|
267
|
+
const kindTitleTemplate = str(settings[`${kind}TitleTemplate`], '')
|
|
268
|
+
const kindMessageTemplate = str(settings[`${kind}MessageTemplate`], '')
|
|
269
|
+
const title = renderTemplate(kindTitleTemplate !== '' ? kindTitleTemplate : settings.titleTemplate, '{title}', vars)
|
|
270
|
+
const message = renderTemplate(kindMessageTemplate !== '' ? kindMessageTemplate : settings.messageTemplate, '{message}', vars)
|
|
256
271
|
const seconds = Math.round(clamp(num(args.seconds, settings.seconds), 2, 600))
|
|
257
272
|
const sound = args.sound === false ? false : settings.sound
|
|
258
273
|
const audio = audioNameOf(kind, settings)
|
|
@@ -387,7 +402,63 @@ function toolDefinition(getSettings) {
|
|
|
387
402
|
}
|
|
388
403
|
}
|
|
389
404
|
|
|
405
|
+
const AUDIO_EXTENSIONS = ['.wav', '.mp3', '.ogg', '.m4a', '.flac', '.aac', '.wma']
|
|
406
|
+
const AUDIO_ROUTE = '/dsh-reminder-notify/audio'
|
|
407
|
+
|
|
408
|
+
// 面板要「把音频目录里的文件列成下拉」,但 Client 侧没有任何读文件能力,
|
|
409
|
+
// 所以由 Host 注册一条只读的 GET 路由,页面用同源 fetch 取这个 JSON。
|
|
410
|
+
export function listAudioFiles(dir) {
|
|
411
|
+
const files = []
|
|
412
|
+
let entries = []
|
|
413
|
+
try {
|
|
414
|
+
entries = fs.readdirSync(dir, { withFileTypes: true })
|
|
415
|
+
} catch (error) {
|
|
416
|
+
return { dir, files, error: String((error && error.message) || error) }
|
|
417
|
+
}
|
|
418
|
+
for (const entry of entries) {
|
|
419
|
+
if (!entry.isFile()) continue
|
|
420
|
+
const ext = path.extname(entry.name).toLowerCase()
|
|
421
|
+
if (AUDIO_EXTENSIONS.includes(ext)) files.push(entry.name)
|
|
422
|
+
}
|
|
423
|
+
files.sort((a, b) => a.localeCompare(b, 'zh-Hans-CN'))
|
|
424
|
+
return { dir, files }
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
function registerAudioRoute(ctx, getSettings) {
|
|
428
|
+
const web = typeof ctx.get === 'function' ? ctx.get('webServer') : undefined
|
|
429
|
+
if (web === undefined || web === null || typeof web.register !== 'function') {
|
|
430
|
+
ctx.logger?.warn?.('dsh-reminder-notify: webServer is unavailable, the audio list dropdown stays manual-entry only')
|
|
431
|
+
return
|
|
432
|
+
}
|
|
433
|
+
const route = {
|
|
434
|
+
kind: 'exact',
|
|
435
|
+
path: AUDIO_ROUTE,
|
|
436
|
+
handler: (req, res) => {
|
|
437
|
+
const settings = getSettings()
|
|
438
|
+
const requested = (() => {
|
|
439
|
+
try {
|
|
440
|
+
const url = new URL(req.url ?? AUDIO_ROUTE, 'http://127.0.0.1')
|
|
441
|
+
return url.searchParams.get('dir') ?? ''
|
|
442
|
+
} catch {
|
|
443
|
+
return ''
|
|
444
|
+
}
|
|
445
|
+
})()
|
|
446
|
+
const dir = requested !== '' ? path.resolve(requested) : settings.audioDir
|
|
447
|
+
const body = JSON.stringify(listAudioFiles(dir))
|
|
448
|
+
res.writeHead(200, { 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-store' })
|
|
449
|
+
res.end(body)
|
|
450
|
+
},
|
|
451
|
+
}
|
|
452
|
+
ctx.effect(() => {
|
|
453
|
+
const dispose = web.register(route)
|
|
454
|
+
return () => {
|
|
455
|
+
if (typeof dispose === 'function') dispose()
|
|
456
|
+
}
|
|
457
|
+
}, 'dsh-reminder-notify: audio list route')
|
|
458
|
+
}
|
|
459
|
+
|
|
390
460
|
export function apply(ctx, config) {
|
|
461
|
+
registerAudioRoute(ctx, () => settingsOf(config))
|
|
391
462
|
const tools = typeof ctx.get === 'function' ? ctx.get('tools') : ctx.tools
|
|
392
463
|
if (tools === undefined || tools === null || typeof tools.register !== 'function') {
|
|
393
464
|
ctx.logger?.warn?.('dsh-reminder-notify: tools service is unavailable, notify_user was not registered')
|
package/package.json
CHANGED