zen-gitsync 2.11.3 → 2.11.4
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/config.js +14 -0
- package/src/ui/public/assets/{index-vy-kFr2X.css → index-ByZIPrdG.css} +1 -1
- package/src/ui/public/assets/index-C9dA2Gmn.js +108 -0
- package/src/ui/public/index.html +2 -2
- package/src/ui/server/routes/config.js +14 -0
- package/src/ui/server/routes/fs.js +51 -1
- package/src/ui/public/assets/index-B0KjkiTF.js +0 -108
package/src/ui/public/index.html
CHANGED
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
11
11
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
12
12
|
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
|
|
13
|
-
<script type="module" crossorigin src="/assets/index-
|
|
13
|
+
<script type="module" crossorigin src="/assets/index-C9dA2Gmn.js"></script>
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/vendor-BSAE54oX.js">
|
|
15
15
|
<link rel="stylesheet" crossorigin href="/assets/vendor-COoKXBNX.css">
|
|
16
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
16
|
+
<link rel="stylesheet" crossorigin href="/assets/index-ByZIPrdG.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body>
|
|
19
19
|
<div id="app"></div>
|
|
@@ -33,6 +33,20 @@ export function registerConfigRoutes({
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
|
|
37
|
+
// 删除最近访问的目录
|
|
38
|
+
app.post('/api/remove_recent_directory', async (req, res) => {
|
|
39
|
+
try {
|
|
40
|
+
const { path: dirPath } = req.body;
|
|
41
|
+
if (!dirPath) {
|
|
42
|
+
return res.status(400).json({ success: false, error: '目录路径不能为空' });
|
|
43
|
+
}
|
|
44
|
+
const list = await configManager.removeRecentDirectory(dirPath);
|
|
45
|
+
res.json({ success: true, directories: list });
|
|
46
|
+
} catch (error) {
|
|
47
|
+
res.status(500).json({ success: false, error: error.message });
|
|
48
|
+
}
|
|
49
|
+
});
|
|
36
50
|
|
|
37
51
|
// 获取配置
|
|
38
52
|
app.get('/api/config/getConfig', async (req, res) => {
|
|
@@ -249,9 +249,22 @@ export function registerFsRoutes({
|
|
|
249
249
|
try {
|
|
250
250
|
// 尝试从配置中获取最近的目录
|
|
251
251
|
const recentDirs = await configManager.getRecentDirectories();
|
|
252
|
+
// 并行检查每个目录是否存在
|
|
253
|
+
const checked = await Promise.all(
|
|
254
|
+
(recentDirs || []).map(async (dir) => {
|
|
255
|
+
let exists = false;
|
|
256
|
+
try {
|
|
257
|
+
await fs.access(dir);
|
|
258
|
+
exists = true;
|
|
259
|
+
} catch {
|
|
260
|
+
exists = false;
|
|
261
|
+
}
|
|
262
|
+
return { path: dir, exists };
|
|
263
|
+
})
|
|
264
|
+
);
|
|
252
265
|
res.json({
|
|
253
266
|
success: true,
|
|
254
|
-
directories:
|
|
267
|
+
directories: checked
|
|
255
268
|
});
|
|
256
269
|
} catch (error) {
|
|
257
270
|
res.status(500).json({
|
|
@@ -384,6 +397,43 @@ export function registerFsRoutes({
|
|
|
384
397
|
}
|
|
385
398
|
});
|
|
386
399
|
|
|
400
|
+
// 新开 cmd 标签并在目标路径执行 g ui
|
|
401
|
+
app.post('/api/open-new-tab-gui', async (req, res) => {
|
|
402
|
+
try {
|
|
403
|
+
const directoryPath = req.body.path || process.cwd();
|
|
404
|
+
|
|
405
|
+
try {
|
|
406
|
+
await fs.access(directoryPath);
|
|
407
|
+
|
|
408
|
+
const platform = os.platform();
|
|
409
|
+
|
|
410
|
+
if (platform === 'win32') {
|
|
411
|
+
// Windows: start 第一个参数是窗口标题,必须用 "" 占位,否则 cmd 会被当成标题
|
|
412
|
+
// start "" /D "path" cmd /k g ui
|
|
413
|
+
const winPath = directoryPath.replace(/\//g, '\\').replace(/"/g, '\\"');
|
|
414
|
+
exec(`start "" /D "${winPath}" cmd /k g ui`);
|
|
415
|
+
} else if (platform === 'darwin') {
|
|
416
|
+
spawn('open', ['-a', 'Terminal', directoryPath], {
|
|
417
|
+
detached: true,
|
|
418
|
+
stdio: 'ignore'
|
|
419
|
+
}).unref();
|
|
420
|
+
} else {
|
|
421
|
+
// Linux fallback
|
|
422
|
+
spawn('bash', ['-c', `gnome-terminal -- bash -c "cd '${directoryPath}' && g ui; exec bash" &`], {
|
|
423
|
+
detached: true,
|
|
424
|
+
stdio: 'ignore'
|
|
425
|
+
}).unref();
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
res.json({ success: true });
|
|
429
|
+
} catch (error) {
|
|
430
|
+
res.status(400).json({ success: false, error: `无法打开: ${error.message}` });
|
|
431
|
+
}
|
|
432
|
+
} catch (error) {
|
|
433
|
+
res.status(500).json({ success: false, error: error.message });
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
|
|
387
437
|
// ========== 文件锁定相关 API ==========
|
|
388
438
|
|
|
389
439
|
// 获取锁定文件列表
|