opencode-studio-server 1.0.3 → 1.0.5
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 +19 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -32,7 +32,11 @@ app.use((req, res, next) => {
|
|
|
32
32
|
const ALLOWED_ORIGINS = [
|
|
33
33
|
'http://localhost:3000',
|
|
34
34
|
'http://127.0.0.1:3000',
|
|
35
|
+
'https://opencode-studio.vercel.app',
|
|
36
|
+
'https://opencode.micr.dev',
|
|
37
|
+
'https://opencode-studio.micr.dev',
|
|
35
38
|
/\.vercel\.app$/,
|
|
39
|
+
/\.micr\.dev$/,
|
|
36
40
|
];
|
|
37
41
|
|
|
38
42
|
app.use(cors({
|
|
@@ -857,14 +861,21 @@ app.post('/api/auth/login', (req, res) => {
|
|
|
857
861
|
return res.status(400).json({ error: 'Invalid provider' });
|
|
858
862
|
}
|
|
859
863
|
|
|
860
|
-
// Run opencode auth login - this opens browser
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
864
|
+
// Run opencode auth login - this opens browser
|
|
865
|
+
// Use detached + shell to ensure browser opens even when server runs headless
|
|
866
|
+
const isWindows = process.platform === 'win32';
|
|
867
|
+
const child = spawn('opencode', ['auth', 'login', provider], {
|
|
868
|
+
detached: true,
|
|
869
|
+
shell: isWindows,
|
|
870
|
+
stdio: 'ignore',
|
|
871
|
+
windowsHide: false,
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
child.unref(); // Allow server to exit independently
|
|
875
|
+
|
|
876
|
+
child.on('error', (err) => {
|
|
877
|
+
console.error('Failed to start auth login:', err);
|
|
878
|
+
});
|
|
868
879
|
|
|
869
880
|
// Return immediately - login happens in browser
|
|
870
881
|
res.json({
|