juice-email-cli 2.3.0 → 2.3.1
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/package.json +1 -1
- package/src/context-menu.js +20 -7
package/package.json
CHANGED
package/src/context-menu.js
CHANGED
|
@@ -56,19 +56,28 @@ function regAdd(key, valueName, type, data) {
|
|
|
56
56
|
if (type) args.push('/t', type);
|
|
57
57
|
if (data !== undefined) args.push('/d', data);
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
try {
|
|
60
|
+
const result = spawnSync('reg', args, { stdio: 'pipe', timeout: 10000 });
|
|
61
|
+
if (result.status !== 0) {
|
|
62
|
+
const msg = (result.stderr || '').toString().trim();
|
|
63
|
+
console.warn(chalk.yellow(` ⚠ reg add 失败\n 键:${key}\n 原因:${msg}`));
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
} catch (e) {
|
|
68
|
+
console.warn(chalk.yellow(` ⚠ reg add 超时:${key}`));
|
|
63
69
|
return false;
|
|
64
70
|
}
|
|
65
|
-
return true;
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
function regDelete(key) {
|
|
69
74
|
if (!isWindows) return false;
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
try {
|
|
76
|
+
const result = spawnSync('reg', ['delete', key, '/f'], { stdio: 'pipe', timeout: 10000 });
|
|
77
|
+
return result.status === 0;
|
|
78
|
+
} catch (_) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
72
81
|
}
|
|
73
82
|
|
|
74
83
|
// ─── 菜单结构常量 ─────────────────────────────────────────────────────────────
|
|
@@ -307,16 +316,19 @@ async function registerContextMenu() {
|
|
|
307
316
|
let ok = true;
|
|
308
317
|
|
|
309
318
|
// 先删除旧容器再重建,避免注册残留旧子命令(如旧版 HTML 容器的 WithConfig)
|
|
319
|
+
console.log(chalk.gray(' 清理旧版菜单...'));
|
|
310
320
|
regDelete(`${HKCU_SHELL}\\${SUB_CMDS_CONTAINER_HTML}`);
|
|
311
321
|
regDelete(`${HKCU_SHELL}\\${SUB_CMDS_CONTAINER_YAML}`);
|
|
312
322
|
regDelete(`${HKCU_SHELL}\\${SUB_CMDS_CONTAINER_DIR}`);
|
|
313
323
|
regDelete(`${HKCU_SHELL}\\${SUB_CMDS_CONTAINER_BG}`);
|
|
314
324
|
|
|
315
325
|
// HTML 容器:generate + snippet + pwsh
|
|
326
|
+
console.log(chalk.gray(' 注册 .html 文件菜单...'));
|
|
316
327
|
const htmlContainer = `${HKCU_SHELL}\\${SUB_CMDS_CONTAINER_HTML}`;
|
|
317
328
|
registerSubCommands(htmlContainer, 'html', nodePath, scriptPath, iconPath, pwshPath);
|
|
318
329
|
|
|
319
330
|
// YAML 容器:config + pwsh
|
|
331
|
+
console.log(chalk.gray(' 注册 .yaml 文件菜单...'));
|
|
320
332
|
const yamlContainer = `${HKCU_SHELL}\\${SUB_CMDS_CONTAINER_YAML}`;
|
|
321
333
|
registerSubCommands(yamlContainer, 'yaml', nodePath, scriptPath, iconPath, pwshPath);
|
|
322
334
|
|
|
@@ -337,6 +349,7 @@ async function registerContextMenu() {
|
|
|
337
349
|
}
|
|
338
350
|
|
|
339
351
|
// Directory / Background → 独立容器
|
|
352
|
+
console.log(chalk.gray(' 注册文件夹/空白处菜单...'));
|
|
340
353
|
registerDirBgMenus(nodePath, scriptPath, iconPath, pwshPath);
|
|
341
354
|
|
|
342
355
|
if (!ok) {
|