buddy-workbench 0.1.22 → 0.1.24
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/server/config.js +1 -0
- package/server/repositories/settings.js +2 -1
- package/server/routes/settings.js +20 -1
- package/server/services/browser.js +12 -0
- package/ui/dist/assets/index-BvKTN1o3.js +530 -0
- package/ui/dist/assets/index-CvciRg_E.css +1 -0
- package/ui/dist/index.html +4 -4
- package/ui/dist/assets/index-B5Hvs98U.js +0 -530
- package/ui/dist/assets/index-B9y46rtV.css +0 -1
package/package.json
CHANGED
package/server/config.js
CHANGED
|
@@ -3,6 +3,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
3
3
|
|
|
4
4
|
export const root = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
5
5
|
export const paths = {
|
|
6
|
+
dataDir: join(root, 'data'),
|
|
6
7
|
launchers: join(root, 'data', 'launchers.json'),
|
|
7
8
|
portHistory: join(root, 'data', 'port-history.json'),
|
|
8
9
|
groupTasks: join(root, 'data', 'group-tasks.json'),
|
|
@@ -20,7 +20,8 @@ export function settingsStatus() {
|
|
|
20
20
|
isMac: process.platform === 'darwin',
|
|
21
21
|
clipboardEnabled: settings.clipboardEnabled !== false,
|
|
22
22
|
clipboardImageEnabled: settings.clipboardImageEnabled !== false,
|
|
23
|
-
clipboardDeduplicateMinutes: typeof settings.clipboardDeduplicateMinutes === 'number' && !isNaN(settings.clipboardDeduplicateMinutes) ? settings.clipboardDeduplicateMinutes : 60
|
|
23
|
+
clipboardDeduplicateMinutes: typeof settings.clipboardDeduplicateMinutes === 'number' && !isNaN(settings.clipboardDeduplicateMinutes) ? settings.clipboardDeduplicateMinutes : 60,
|
|
24
|
+
dataDir: paths.dataDir
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { existsSync, mkdirSync } from 'node:fs';
|
|
1
2
|
import { Router } from 'express';
|
|
3
|
+
import { paths } from '../config.js';
|
|
2
4
|
import { saveAccessToken, saveClipboardDeduplicateMinutes, saveClipboardEnabled, saveClipboardImageEnabled, saveDefaultBrowser, saveDefaultEditor, saveDomain, saveJiraIssuePrefix, settingsStatus } from '../repositories/settings.js';
|
|
3
|
-
import { openInSystemBrowser, openInSystemEditor } from '../services/browser.js';
|
|
5
|
+
import { openInSystemBrowser, openInSystemEditor, openInSystemFolder } from '../services/browser.js';
|
|
4
6
|
import { selectDirectory } from '../services/dialog.js';
|
|
5
7
|
|
|
6
8
|
const router = Router();
|
|
@@ -38,6 +40,23 @@ router.post('/open-editor', (req, res) => {
|
|
|
38
40
|
openInSystemEditor(path.trim(), location ? String(location).trim() : '');
|
|
39
41
|
res.json({ success: true });
|
|
40
42
|
});
|
|
43
|
+
router.post('/open-folder', (req, res) => {
|
|
44
|
+
const { path } = req.body || {};
|
|
45
|
+
const targetPath = (typeof path === 'string' && path.trim()) ? path.trim() : paths.dataDir;
|
|
46
|
+
if (!existsSync(targetPath)) {
|
|
47
|
+
mkdirSync(targetPath, { recursive: true });
|
|
48
|
+
}
|
|
49
|
+
openInSystemFolder(targetPath);
|
|
50
|
+
res.json({ success: true });
|
|
51
|
+
});
|
|
52
|
+
router.post('/open-data-dir', (req, res) => {
|
|
53
|
+
const targetPath = paths.dataDir;
|
|
54
|
+
if (!existsSync(targetPath)) {
|
|
55
|
+
mkdirSync(targetPath, { recursive: true });
|
|
56
|
+
}
|
|
57
|
+
openInSystemFolder(targetPath);
|
|
58
|
+
res.json({ success: true });
|
|
59
|
+
});
|
|
41
60
|
router.post('/select-directory', async (_req, res) => {
|
|
42
61
|
try {
|
|
43
62
|
const result = await selectDirectory();
|
|
@@ -96,3 +96,15 @@ export function openInSystemEditor(path, location = '') {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
+
|
|
100
|
+
export function openInSystemFolder(targetPath) {
|
|
101
|
+
if (!targetPath || typeof targetPath !== 'string') return;
|
|
102
|
+
if (process.platform === 'darwin') {
|
|
103
|
+
execFile('open', [targetPath]);
|
|
104
|
+
} else if (process.platform === 'win32') {
|
|
105
|
+
execFile('cmd', ['/c', 'start', '', targetPath]);
|
|
106
|
+
} else {
|
|
107
|
+
execFile('xdg-open', [targetPath]);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|