dsh-reminder-notify 0.5.0 → 0.6.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 +26 -0
- package/index.js +27 -2
- package/package.json +1 -1
- package/publish/index.json +2 -2
package/client.js
CHANGED
|
@@ -47,6 +47,13 @@ window.__ModuleLoader__.load({
|
|
|
47
47
|
cardBackgroundHint: 'png / jpg 路径(绝对路径或相对插件目录),留空 = 纯色背景。',
|
|
48
48
|
cardIcon: '标题图标',
|
|
49
49
|
cardIconHint: '标题左侧的小图标(png),留空 = 不显示。',
|
|
50
|
+
doneCardBackground: 'done 专用背景图',
|
|
51
|
+
decideCardBackground: 'decide 专用背景图',
|
|
52
|
+
rawCardBackground: 'raw 专用背景图',
|
|
53
|
+
doneCardIcon: 'done 专用图标',
|
|
54
|
+
decideCardIcon: 'decide 专用图标',
|
|
55
|
+
rawCardIcon: 'raw 专用图标',
|
|
56
|
+
perKindHint: '按档位覆盖通用设置,留空就用上面的通用背景 / 图标。',
|
|
50
57
|
titleTemplate: '标题模板',
|
|
51
58
|
messageTemplate: '正文模板',
|
|
52
59
|
templateHint: '可用占位符 {title} {message} {kind} {time}。',
|
|
@@ -101,6 +108,13 @@ window.__ModuleLoader__.load({
|
|
|
101
108
|
cardBackgroundHint: 'A png / jpg path (absolute or relative to the plugin); empty keeps the solid colour.',
|
|
102
109
|
cardIcon: 'Title icon',
|
|
103
110
|
cardIconHint: 'A small png shown left of the title; empty hides it.',
|
|
111
|
+
doneCardBackground: 'Done-only background',
|
|
112
|
+
decideCardBackground: 'Decide-only background',
|
|
113
|
+
rawCardBackground: 'Raw-only background',
|
|
114
|
+
doneCardIcon: 'Done-only icon',
|
|
115
|
+
decideCardIcon: 'Decide-only icon',
|
|
116
|
+
rawCardIcon: 'Raw-only icon',
|
|
117
|
+
perKindHint: 'Overrides the shared background / icon per kind; empty falls back to the shared value.',
|
|
104
118
|
titleTemplate: 'Title template',
|
|
105
119
|
messageTemplate: 'Message template',
|
|
106
120
|
templateHint: 'Placeholders: {title} {message} {kind} {time}.',
|
|
@@ -163,6 +177,12 @@ window.__ModuleLoader__.load({
|
|
|
163
177
|
{ key: 'accentRaw', group: 'look', kind: 'color' },
|
|
164
178
|
{ key: 'cardBackground', group: 'look', kind: 'text' },
|
|
165
179
|
{ key: 'cardIcon', group: 'look', kind: 'text' },
|
|
180
|
+
{ key: 'doneCardBackground', group: 'look', kind: 'text' },
|
|
181
|
+
{ key: 'decideCardBackground', group: 'look', kind: 'text' },
|
|
182
|
+
{ key: 'rawCardBackground', group: 'look', kind: 'text' },
|
|
183
|
+
{ key: 'doneCardIcon', group: 'look', kind: 'text' },
|
|
184
|
+
{ key: 'decideCardIcon', group: 'look', kind: 'text' },
|
|
185
|
+
{ key: 'rawCardIcon', group: 'look', kind: 'text' },
|
|
166
186
|
{ key: 'titleTemplate', group: 'look', kind: 'text' },
|
|
167
187
|
{ key: 'messageTemplate', group: 'look', kind: 'text' },
|
|
168
188
|
{ key: 'hostMode', group: 'host', kind: 'select', options: ['script', 'exe'], optionLabels: ['hostModeScript', 'hostModeExe'] },
|
|
@@ -179,6 +199,12 @@ window.__ModuleLoader__.load({
|
|
|
179
199
|
audioDir: 'audioDirHint',
|
|
180
200
|
cardBackground: 'cardBackgroundHint',
|
|
181
201
|
cardIcon: 'cardIconHint',
|
|
202
|
+
doneCardBackground: 'perKindHint',
|
|
203
|
+
decideCardBackground: 'perKindHint',
|
|
204
|
+
rawCardBackground: 'perKindHint',
|
|
205
|
+
doneCardIcon: 'perKindHint',
|
|
206
|
+
decideCardIcon: 'perKindHint',
|
|
207
|
+
rawCardIcon: 'perKindHint',
|
|
182
208
|
titleTemplate: 'templateHint',
|
|
183
209
|
messageTemplate: 'templateHint',
|
|
184
210
|
scriptPath: 'scriptPathHint',
|
package/index.js
CHANGED
|
@@ -44,6 +44,12 @@ export const Config = z === null ? undefined : z.object({
|
|
|
44
44
|
cooldownMs: z.number().min(0).step(100).default(1500).description('同档位提醒的最小间隔(毫秒)'),
|
|
45
45
|
cardBackground: z.string().default('').description('卡片背景图路径(png / jpg),留空 = 纯色背景'),
|
|
46
46
|
cardIcon: z.string().default('').description('标题左侧的小图标路径(png / ico),留空 = 不显示'),
|
|
47
|
+
doneCardBackground: z.string().default('').description('done 档位单独用的背景图,留空 = 用上面的通用背景'),
|
|
48
|
+
decideCardBackground: z.string().default('').description('decide 档位单独用的背景图,留空 = 用通用背景'),
|
|
49
|
+
rawCardBackground: z.string().default('').description('raw 档位单独用的背景图,留空 = 用通用背景'),
|
|
50
|
+
doneCardIcon: z.string().default('').description('done 档位单独用的标题图标,留空 = 用通用图标'),
|
|
51
|
+
decideCardIcon: z.string().default('').description('decide 档位单独用的标题图标,留空 = 用通用图标'),
|
|
52
|
+
rawCardIcon: z.string().default('').description('raw 档位单独用的标题图标,留空 = 用通用图标'),
|
|
47
53
|
titleTemplate: z.string().default('{title}').description('标题模板,可用占位符 {title} {message} {kind} {time}'),
|
|
48
54
|
messageTemplate: z.string().default('{message}').description('正文模板,可用占位符 {title} {message} {kind} {time}'),
|
|
49
55
|
})
|
|
@@ -113,6 +119,12 @@ function settingsOf(config) {
|
|
|
113
119
|
cooldownMs: Math.max(0, Math.round(num(c.cooldownMs, 1500))),
|
|
114
120
|
cardBackground: str(c.cardBackground, ''),
|
|
115
121
|
cardIcon: str(c.cardIcon, ''),
|
|
122
|
+
doneCardBackground: str(c.doneCardBackground, ''),
|
|
123
|
+
decideCardBackground: str(c.decideCardBackground, ''),
|
|
124
|
+
rawCardBackground: str(c.rawCardBackground, ''),
|
|
125
|
+
doneCardIcon: str(c.doneCardIcon, ''),
|
|
126
|
+
decideCardIcon: str(c.decideCardIcon, ''),
|
|
127
|
+
rawCardIcon: str(c.rawCardIcon, ''),
|
|
116
128
|
titleTemplate: typeof c.titleTemplate === 'string' ? c.titleTemplate : '{title}',
|
|
117
129
|
messageTemplate: typeof c.messageTemplate === 'string' ? c.messageTemplate : '{message}',
|
|
118
130
|
}
|
|
@@ -154,7 +166,18 @@ function assetPath(value) {
|
|
|
154
166
|
return fs.existsSync(full) ? full : ''
|
|
155
167
|
}
|
|
156
168
|
|
|
157
|
-
//
|
|
169
|
+
// 档位外观:doneCardBackground / decideCardIcon 这类按档位覆盖,留空就退回通用值。
|
|
170
|
+
function appearanceOf(kind, settings) {
|
|
171
|
+
const background = str(settings[`${kind}CardBackground`], '') !== ''
|
|
172
|
+
? settings[`${kind}CardBackground`]
|
|
173
|
+
: settings.cardBackground
|
|
174
|
+
const icon = str(settings[`${kind}CardIcon`], '') !== ''
|
|
175
|
+
? settings[`${kind}CardIcon`]
|
|
176
|
+
: settings.cardIcon
|
|
177
|
+
return { background: assetPath(background), icon: assetPath(icon) }
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
158
181
|
// PowerShell 自己还会再解析一遍 -File 之后的参数,所以这里把英文双引号替换掉,
|
|
159
182
|
// 避免一条带引号的正文把后面所有参数吃掉。
|
|
160
183
|
function psSafe(value) {
|
|
@@ -288,7 +311,7 @@ async function notify(kind, args, settings) {
|
|
|
288
311
|
}
|
|
289
312
|
|
|
290
313
|
async function fireScript(settings, title, message, seconds, kind, audioPath, sound, scriptPath, missingAudio) {
|
|
291
|
-
const extras =
|
|
314
|
+
const extras = appearanceOf(kind, settings)
|
|
292
315
|
const argv = argvOfScriptHost(title, message, seconds, settings.position, accentOf(kind, settings), audioPath, sound, extras)
|
|
293
316
|
argv[argv.indexOf(null)] = scriptPath
|
|
294
317
|
try {
|
|
@@ -306,6 +329,8 @@ async function fireScript(settings, title, message, seconds, kind, audioPath, so
|
|
|
306
329
|
sound: sound && audioPath !== '',
|
|
307
330
|
audio: sound && audioPath !== '' ? audioPath : null,
|
|
308
331
|
audioMissing: missingAudio !== '' ? missingAudio : undefined,
|
|
332
|
+
background: extras.background !== '' ? extras.background : null,
|
|
333
|
+
icon: extras.icon !== '' ? extras.icon : null,
|
|
309
334
|
pid,
|
|
310
335
|
host: scriptPath,
|
|
311
336
|
earlyExit: early === 'running' ? null : early,
|
package/package.json
CHANGED