zen-gitsync 2.10.7 → 2.10.9

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.
@@ -6,10 +6,10 @@
6
6
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
8
  <title>Zen GitSync</title>
9
- <script type="module" crossorigin src="/assets/index-5z2rWrTJ.js"></script>
10
- <link rel="modulepreload" crossorigin href="/assets/vendor-CrYGMytM.js">
11
- <link rel="stylesheet" crossorigin href="/assets/vendor-BreftYKt.css">
12
- <link rel="stylesheet" crossorigin href="/assets/index-bVmQ0atC.css">
9
+ <script type="module" crossorigin src="/assets/index-DGL8BdDB.js"></script>
10
+ <link rel="modulepreload" crossorigin href="/assets/vendor-D8Cadz3F.js">
11
+ <link rel="stylesheet" crossorigin href="/assets/vendor-DpSHka1A.css">
12
+ <link rel="stylesheet" crossorigin href="/assets/index-BS0V07Ya.css">
13
13
  </head>
14
14
  <body>
15
15
  <div id="app"></div>
@@ -639,4 +639,31 @@ export function registerConfigRoutes({
639
639
  res.status(500).json({ success: false, error: error.message })
640
640
  }
641
641
  })
642
+
643
+ // 保存“一键推送成功后启动项”
644
+ app.post('/api/config/save-after-quick-push-action', express.json(), async (req, res) => {
645
+ try {
646
+ const { afterQuickPushAction } = req.body
647
+
648
+ if (!afterQuickPushAction || typeof afterQuickPushAction !== 'object') {
649
+ return res.status(400).json({ success: false, error: '缺少必要参数' })
650
+ }
651
+
652
+ const enabled = Boolean(afterQuickPushAction.enabled)
653
+ const type = afterQuickPushAction.type === 'workflow' ? 'workflow' : 'command'
654
+ const refId = String(afterQuickPushAction.refId || '').trim()
655
+
656
+ const config = await configManager.loadConfig()
657
+ config.afterQuickPushAction = {
658
+ enabled,
659
+ type,
660
+ refId
661
+ }
662
+ await configManager.saveConfig(config)
663
+
664
+ res.json({ success: true })
665
+ } catch (error) {
666
+ res.status(500).json({ success: false, error: error.message })
667
+ }
668
+ })
642
669
  }
@@ -108,10 +108,21 @@ export function registerExecRoutes({
108
108
  // 只有 Windows CMD 内置命令(如 dir、type 等)才需要 GBK 转换
109
109
  // npm、node、git 等现代工具都输出 UTF-8
110
110
  const isWindows = process.platform === 'win32';
111
- const cmdBuiltins = ['dir', 'type', 'echo', 'set', 'path', 'cd', 'md', 'rd', 'del', 'copy', 'move', 'ren'];
112
- const needsGbkConversion = isWindows && cmdBuiltins.some(builtin =>
113
- command.trim().toLowerCase().startsWith(builtin + ' ') ||
114
- command.trim().toLowerCase() === builtin
111
+ const cmdBuiltins = ['dir', 'type', 'set', 'path', 'cd', 'md', 'rd', 'del', 'copy', 'move', 'ren'];
112
+
113
+ // echo 命令特殊处理:如果包含变量替换(如 {{xxx}}),说明内容可能已经是 UTF-8,不转换
114
+ const isEchoCommand = command.trim().toLowerCase().startsWith('echo ');
115
+ const hasVariableSubstitution = isEchoCommand && (
116
+ command.includes('{{') ||
117
+ command.includes('${') ||
118
+ command.includes('%') // Windows 环境变量
119
+ );
120
+
121
+ const needsGbkConversion = isWindows && (
122
+ cmdBuiltins.some(builtin =>
123
+ command.trim().toLowerCase().startsWith(builtin + ' ') ||
124
+ command.trim().toLowerCase() === builtin
125
+ ) || (isEchoCommand && !hasVariableSubstitution) // echo 只在没有变量替换时才转换
115
126
  );
116
127
 
117
128
  console.log(`[流式输出] 命令: ${command.substring(0, 50)}, 需要GBK转换: ${needsGbkConversion}`);