opencode-studio-server 1.28.1 → 1.28.2
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/index.js +23 -9
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -495,8 +495,15 @@ const getPaths = () => {
|
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
|
|
498
|
-
const studioConfig = loadStudioConfig();
|
|
499
|
-
|
|
498
|
+
const studioConfig = loadStudioConfig();
|
|
499
|
+
let manualPath = studioConfig.configPath;
|
|
500
|
+
|
|
501
|
+
if (manualPath && fs.existsSync(manualPath) && fs.statSync(manualPath).isDirectory()) {
|
|
502
|
+
const potentialFile = path.join(manualPath, 'opencode.json');
|
|
503
|
+
if (fs.existsSync(potentialFile)) {
|
|
504
|
+
manualPath = potentialFile;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
500
507
|
|
|
501
508
|
let detected = null;
|
|
502
509
|
for (const p of candidates) {
|
|
@@ -602,13 +609,20 @@ app.get('/api/debug/auth', (req, res) => {
|
|
|
602
609
|
});
|
|
603
610
|
});
|
|
604
611
|
|
|
605
|
-
app.post('/api/paths', (req, res) => {
|
|
606
|
-
const { configPath } = req.body;
|
|
607
|
-
const studioConfig = loadStudioConfig();
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
+
app.post('/api/paths', (req, res) => {
|
|
613
|
+
const { configPath } = req.body;
|
|
614
|
+
const studioConfig = loadStudioConfig();
|
|
615
|
+
|
|
616
|
+
if (configPath && fs.existsSync(configPath) && fs.statSync(configPath).isDirectory()) {
|
|
617
|
+
const potentialFile = path.join(configPath, 'opencode.json');
|
|
618
|
+
studioConfig.configPath = potentialFile;
|
|
619
|
+
} else {
|
|
620
|
+
studioConfig.configPath = configPath;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
saveStudioConfig(studioConfig);
|
|
624
|
+
res.json({ success: true, current: getConfigPath() });
|
|
625
|
+
});
|
|
612
626
|
|
|
613
627
|
app.get('/api/config', (req, res) => {
|
|
614
628
|
const config = loadConfig();
|