opencode-studio-server 1.0.10 → 1.0.12
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 +37 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -989,13 +989,14 @@ function setActiveProfile(provider, profileName) {
|
|
|
989
989
|
saveStudioConfig(studioConfig);
|
|
990
990
|
}
|
|
991
991
|
|
|
992
|
-
function verifyActiveProfile(p, n, c) { if (!n || !c) return false; const d = loadAuthProfile(p, n); if (!d) return false; return JSON.stringify(d) === JSON.stringify(c); }
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
|
|
992
|
+
function verifyActiveProfile(p, n, c) { console.log("Verifying:", p, n); if (!n || !c) return false; const d = loadAuthProfile(p, n); if (d && c) { console.log("Profile refresh:", d.refresh); console.log("Current refresh:", c.refresh); } if (!d) return false; return JSON.stringify(d) === JSON.stringify(c); }
|
|
993
|
+
|
|
994
|
+
app.get('/api/auth/profiles', (req, res) => {
|
|
995
|
+
ensureAuthProfilesDir();
|
|
996
|
+
const activeProfiles = getActiveProfiles();
|
|
997
|
+
const authConfig = loadAuthConfig() || {};
|
|
998
|
+
|
|
999
|
+
const profiles = {};
|
|
999
1000
|
|
|
1000
1001
|
Object.keys(PROVIDER_DISPLAY_NAMES).forEach(provider => {
|
|
1001
1002
|
const providerProfiles = listAuthProfiles(provider);
|
|
@@ -1111,6 +1112,32 @@ app.put('/api/auth/profiles/:provider/:name', (req, res) => {
|
|
|
1111
1112
|
}
|
|
1112
1113
|
});
|
|
1113
1114
|
|
|
1114
|
-
app.listen(PORT, () => {
|
|
1115
|
-
|
|
1116
|
-
});
|
|
1115
|
+
app.listen(PORT, () => {
|
|
1116
|
+
const url = 'https://opencode-studio.micr.dev';
|
|
1117
|
+
console.log(`Server running on http://localhost:${PORT}`);
|
|
1118
|
+
console.log(`To manage your OpenCode configuration, visit: ${url}`);
|
|
1119
|
+
console.log('\nPress [Enter] to open in your browser...');
|
|
1120
|
+
|
|
1121
|
+
process.stdin.resume();
|
|
1122
|
+
process.stdin.on('data', (data) => {
|
|
1123
|
+
const input = data.toString();
|
|
1124
|
+
if (input === '\n' || input === '\r\n' || input === '\r') {
|
|
1125
|
+
const platform = os.platform();
|
|
1126
|
+
let cmd;
|
|
1127
|
+
if (platform === 'win32') {
|
|
1128
|
+
cmd = `start "" "${url}"`;
|
|
1129
|
+
} else if (platform === 'darwin') {
|
|
1130
|
+
cmd = `open "${url}"`;
|
|
1131
|
+
} else {
|
|
1132
|
+
cmd = `xdg-open "${url}"`;
|
|
1133
|
+
}
|
|
1134
|
+
exec(cmd, (err) => {
|
|
1135
|
+
if (err) {
|
|
1136
|
+
console.log(`Failed to open browser. Please visit: ${url}`);
|
|
1137
|
+
} else {
|
|
1138
|
+
console.log('Opening browser...');
|
|
1139
|
+
}
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
});
|