zen-gitsync 2.4.13 → 2.5.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.
@@ -1,16 +1,16 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Zen-GitSync - Git同步工具</title>
8
- <script type="module" crossorigin src="/assets/index-CVjWGN3c.js"></script>
9
- <link rel="modulepreload" crossorigin href="/assets/vendor-DJt7ABTC.js">
10
- <link rel="stylesheet" crossorigin href="/assets/vendor-D9qDBEE1.css">
11
- <link rel="stylesheet" crossorigin href="/assets/index-CwJ6ny4v.css">
12
- </head>
13
- <body>
14
- <div id="app"></div>
15
- </body>
16
- </html>
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Zen-GitSync - Git同步工具</title>
8
+ <script type="module" crossorigin src="/assets/index-CnCbYqLq.js"></script>
9
+ <link rel="modulepreload" crossorigin href="/assets/vendor-Dys2BbyU.js">
10
+ <link rel="stylesheet" crossorigin href="/assets/vendor-HJmoQ7iQ.css">
11
+ <link rel="stylesheet" crossorigin href="/assets/index-BApDCqKk.css">
12
+ </head>
13
+ <body>
14
+ <div id="app"></div>
15
+ </body>
16
+ </html>
@@ -1987,6 +1987,52 @@ async function startUIServer(noOpen = false, savePort = false) {
1987
1987
  }
1988
1988
  });
1989
1989
 
1990
+ // 解决冲突:保存解决后的文件内容
1991
+ app.post('/api/resolve-conflict', async (req, res) => {
1992
+ try {
1993
+ const { filePath, content } = req.body;
1994
+
1995
+ if (!filePath) {
1996
+ return res.status(400).json({
1997
+ success: false,
1998
+ error: '缺少文件路径参数'
1999
+ });
2000
+ }
2001
+
2002
+ if (content === undefined) {
2003
+ return res.status(400).json({
2004
+ success: false,
2005
+ error: '缺少文件内容参数'
2006
+ });
2007
+ }
2008
+
2009
+ try {
2010
+ // 写入解决后的内容到文件
2011
+ await fs.writeFile(filePath, content, 'utf8');
2012
+
2013
+ // 不自动添加到暂存区,让用户手动决定
2014
+ // Git 会自动将冲突已解决的文件标记为"已修改"状态
2015
+ // await execGitCommand(`git add "${filePath}"`);
2016
+
2017
+ res.json({
2018
+ success: true,
2019
+ message: '冲突已解决,文件已更新'
2020
+ });
2021
+ } catch (writeError) {
2022
+ res.status(500).json({
2023
+ success: false,
2024
+ error: `保存文件失败: ${writeError.message}`
2025
+ });
2026
+ }
2027
+ } catch (error) {
2028
+ console.error('解决冲突失败:', error);
2029
+ res.status(500).json({
2030
+ success: false,
2031
+ error: `解决冲突失败: ${error.message}`
2032
+ });
2033
+ }
2034
+ });
2035
+
1990
2036
  // 撤回文件修改
1991
2037
  app.post('/api/revert_file', async (req, res) => {
1992
2038
  try {