opencode-studio-server 1.0.4 → 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 +15 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -861,14 +861,21 @@ app.post('/api/auth/login', (req, res) => {
|
|
|
861
861
|
return res.status(400).json({ error: 'Invalid provider' });
|
|
862
862
|
}
|
|
863
863
|
|
|
864
|
-
// Run opencode auth login - this opens browser
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
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
|
+
});
|
|
872
879
|
|
|
873
880
|
// Return immediately - login happens in browser
|
|
874
881
|
res.json({
|