change-image-suffix 2.1.16 → 2.1.18
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/CHANGELOG.md +15 -0
- package/dist/index.js +24 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.1.18](https://github.com/GuoSirius/change-image-suffix/compare/v2.1.17...v2.1.18) (2026-05-25)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* remove emojis from menu labels, remove MultiSelectModel ([a991d75](https://github.com/GuoSirius/change-image-suffix/commit/a991d7534416901746456d879a52fb5a4bc4661b))
|
|
11
|
+
* use %* with MultiSelectModel=Player for single-window multi-select ([4b5b94b](https://github.com/GuoSirius/change-image-suffix/commit/4b5b94be3128f9a438bfff099ccb53d3ef0ef683))
|
|
12
|
+
|
|
13
|
+
### [2.1.17](https://github.com/GuoSirius/change-image-suffix/compare/v2.1.16...v2.1.17) (2026-05-25)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* use .reg file instead of reg add to avoid cmd.exe quote mangling ([142f410](https://github.com/GuoSirius/change-image-suffix/commit/142f4107f32b8615080018a9c5ec908bb950ac1b))
|
|
19
|
+
|
|
5
20
|
### [2.1.16](https://github.com/GuoSirius/change-image-suffix/compare/v2.1.15...v2.1.16) (2026-05-25)
|
|
6
21
|
|
|
7
22
|
|
package/dist/index.js
CHANGED
|
@@ -61,29 +61,41 @@ function installContextMenu() {
|
|
|
61
61
|
const scriptPath = path.join(__dirname, 'index.js');
|
|
62
62
|
// ── 格式列表(webp 排第一,其他按常见程度排序)──
|
|
63
63
|
const formats = [
|
|
64
|
-
{ verb: 'webp', label: '
|
|
65
|
-
{ verb: 'jpg', label: '
|
|
66
|
-
{ verb: 'png', label: '
|
|
67
|
-
{ verb: 'avif', label: '
|
|
68
|
-
{ verb: 'tiff', label: '
|
|
64
|
+
{ verb: 'webp', label: 'WebP' },
|
|
65
|
+
{ verb: 'jpg', label: 'JPG' },
|
|
66
|
+
{ verb: 'png', label: 'PNG' },
|
|
67
|
+
{ verb: 'avif', label: 'AVIF' },
|
|
68
|
+
{ verb: 'tiff', label: 'TIFF' },
|
|
69
69
|
];
|
|
70
70
|
// ── 使用 ExtendedSubCommandsKey,直接调用 node.exe(无 bat 中转)──
|
|
71
71
|
// AllFilesystemObjects 覆盖文件和目录,支持混合多选
|
|
72
72
|
const menuBases = [
|
|
73
73
|
{ base: 'HKCU\\Software\\Classes\\Directory\\Background\\shell\\cis', subMenu: 'Directory\\ContextMenus\\cis', arg: '-p "%V"' },
|
|
74
|
-
{ base: 'HKCU\\Software\\Classes\\AllFilesystemObjects\\shell\\cis', subMenu: 'Directory\\ContextMenus\\cis_afo', arg: '
|
|
74
|
+
{ base: 'HKCU\\Software\\Classes\\AllFilesystemObjects\\shell\\cis', subMenu: 'Directory\\ContextMenus\\cis_afo', arg: '%*', multiSelect: true },
|
|
75
75
|
];
|
|
76
|
-
// 1.
|
|
77
|
-
const
|
|
76
|
+
// 1. 用 .reg 文件写子菜单(避免 cmd.exe 引号嵌套解析出错)
|
|
77
|
+
const regLines = ['Windows Registry Editor Version 5.00', ''];
|
|
78
78
|
for (const menu of menuBases) {
|
|
79
79
|
for (const fmt of formats) {
|
|
80
|
-
|
|
80
|
+
// .reg 语法:值内 \" → 引号,\\ → 反斜杠,%1/%V 保持原样
|
|
81
81
|
const cmd = `"${nodeExe}" "${scriptPath}" --pause -t ${fmt.verb} ${menu.arg}`;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
const cmdEscaped = cmd.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
83
|
+
const key = `HKEY_CURRENT_USER\\Software\\Classes\\${menu.subMenu}\\shell\\${fmt.verb}`;
|
|
84
|
+
regLines.push(`[${key}]`);
|
|
85
|
+
regLines.push(`@="${fmt.label}"`);
|
|
86
|
+
regLines.push(`"Icon"="${iconPath.replace(/\\/g, '\\\\')}"`);
|
|
87
|
+
regLines.push(`[${key}\\command]`);
|
|
88
|
+
regLines.push(`@="${cmdEscaped}"`);
|
|
89
|
+
regLines.push('');
|
|
85
90
|
}
|
|
86
91
|
}
|
|
92
|
+
const regFile = path.join(appDataDir, 'cis_menu.reg');
|
|
93
|
+
fs.writeFileSync(regFile, regLines.join('\r\n'), 'utf8');
|
|
94
|
+
execSync(`reg import "${regFile}"`, { stdio: 'ignore' });
|
|
95
|
+
try {
|
|
96
|
+
fs.unlinkSync(regFile);
|
|
97
|
+
}
|
|
98
|
+
catch { /* ignore */ }
|
|
87
99
|
// 2. 注册主菜单项
|
|
88
100
|
for (const menu of menuBases) {
|
|
89
101
|
execSync(`reg add "${menu.base}" /ve /d "🖼 转换图片 (cis)" /f`, { stdio: 'ignore' });
|