opencode-studio-server 1.9.0 → 1.9.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/cli.js +7 -1
- package/index.js +13 -5
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -127,4 +127,10 @@ if (shouldOpenBrowser) {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
// Start the server
|
|
130
|
-
require('./index.js');
|
|
130
|
+
const server = require('./index.js');
|
|
131
|
+
if (server.startServer) {
|
|
132
|
+
server.startServer();
|
|
133
|
+
} else {
|
|
134
|
+
// Fallback if not exported (should not happen with new version)
|
|
135
|
+
console.error('Failed to start server: startServer not found');
|
|
136
|
+
}
|
package/index.js
CHANGED
|
@@ -1470,7 +1470,8 @@ app.post('/api/auth/profiles/:provider/:name/activate', (req, res) => {
|
|
|
1470
1470
|
? (activePlugin === 'antigravity' ? 'google.antigravity' : 'google.gemini')
|
|
1471
1471
|
: provider;
|
|
1472
1472
|
|
|
1473
|
-
const
|
|
1473
|
+
const dir = getProfileDir(provider, activePlugin);
|
|
1474
|
+
const profilePath = path.join(dir, `${name}.json`);
|
|
1474
1475
|
if (!fs.existsSync(profilePath)) return res.status(404).json({ error: 'Profile not found' });
|
|
1475
1476
|
|
|
1476
1477
|
const profileData = JSON.parse(fs.readFileSync(profilePath, 'utf8'));
|
|
@@ -1517,7 +1518,8 @@ app.delete('/api/auth/profiles/:provider/:name', (req, res) => {
|
|
|
1517
1518
|
? (activePlugin === 'antigravity' ? 'google.antigravity' : 'google.gemini')
|
|
1518
1519
|
: provider;
|
|
1519
1520
|
|
|
1520
|
-
const
|
|
1521
|
+
const dir = getProfileDir(provider, activePlugin);
|
|
1522
|
+
const profilePath = path.join(dir, `${name}.json`);
|
|
1521
1523
|
if (fs.existsSync(profilePath)) fs.unlinkSync(profilePath);
|
|
1522
1524
|
|
|
1523
1525
|
const studio = loadStudioConfig();
|
|
@@ -1554,8 +1556,9 @@ app.put('/api/auth/profiles/:provider/:name', (req, res) => {
|
|
|
1554
1556
|
? (activePlugin === 'antigravity' ? 'google.antigravity' : 'google.gemini')
|
|
1555
1557
|
: provider;
|
|
1556
1558
|
|
|
1557
|
-
const
|
|
1558
|
-
const
|
|
1559
|
+
const dir = getProfileDir(provider, activePlugin);
|
|
1560
|
+
const oldPath = path.join(dir, `${name}.json`);
|
|
1561
|
+
const newPath = path.join(dir, `${newName}.json`);
|
|
1559
1562
|
if (fs.existsSync(oldPath)) fs.renameSync(oldPath, newPath);
|
|
1560
1563
|
|
|
1561
1564
|
const metadata = loadPoolMetadata();
|
|
@@ -2817,13 +2820,18 @@ app.post('/api/presets/:id/apply', (req, res) => {
|
|
|
2817
2820
|
});
|
|
2818
2821
|
|
|
2819
2822
|
// Start watcher on server start
|
|
2820
|
-
|
|
2823
|
+
function startServer() {
|
|
2821
2824
|
setupLogWatcher();
|
|
2822
2825
|
importExistingAuth();
|
|
2823
2826
|
app.listen(PORT, () => console.log(`Server running at http://localhost:${PORT}`));
|
|
2824
2827
|
}
|
|
2825
2828
|
|
|
2829
|
+
if (require.main === module) {
|
|
2830
|
+
startServer();
|
|
2831
|
+
}
|
|
2832
|
+
|
|
2826
2833
|
module.exports = {
|
|
2834
|
+
startServer,
|
|
2827
2835
|
rotateAccount,
|
|
2828
2836
|
processLogLine,
|
|
2829
2837
|
loadPoolMetadata,
|