opencode-studio-server 1.16.2 → 1.16.3
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 +75 -11
- package/package.json +1 -1
- package/server.log +2 -0
package/index.js
CHANGED
|
@@ -1615,15 +1615,37 @@ app.delete('/api/auth/profiles/:provider/all', (req, res) => {
|
|
|
1615
1615
|
|
|
1616
1616
|
const authCfg = loadAuthConfig() || {};
|
|
1617
1617
|
if (authCfg[provider]) {
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
delete authCfg[key];
|
|
1618
|
+
const paths = getPaths();
|
|
1619
|
+
const allPaths = paths.candidates;
|
|
1620
|
+
if (paths.current && !allPaths.includes(paths.current)) {
|
|
1621
|
+
allPaths.push(paths.current);
|
|
1623
1622
|
}
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1623
|
+
|
|
1624
|
+
allPaths.forEach(p => {
|
|
1625
|
+
const ap = path.join(path.dirname(p), 'auth.json');
|
|
1626
|
+
if (fs.existsSync(ap)) {
|
|
1627
|
+
try {
|
|
1628
|
+
const cfg = JSON.parse(fs.readFileSync(ap, 'utf8'));
|
|
1629
|
+
let modified = false;
|
|
1630
|
+
|
|
1631
|
+
if (provider === 'google') {
|
|
1632
|
+
if (cfg.google) { delete cfg.google; modified = true; }
|
|
1633
|
+
if (cfg['google.antigravity']) { delete cfg['google.antigravity']; modified = true; }
|
|
1634
|
+
if (cfg['google.gemini']) { delete cfg['google.gemini']; modified = true; }
|
|
1635
|
+
} else if (cfg[provider]) {
|
|
1636
|
+
delete cfg[provider];
|
|
1637
|
+
modified = true;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
if (modified) {
|
|
1641
|
+
console.log(`[Auth] Removing ${provider} (all) from ${ap}`);
|
|
1642
|
+
atomicWriteFileSync(ap, JSON.stringify(cfg, null, 2));
|
|
1643
|
+
}
|
|
1644
|
+
} catch (e) {
|
|
1645
|
+
console.error(`[Auth] Failed to update ${ap}:`, e.message);
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
});
|
|
1627
1649
|
}
|
|
1628
1650
|
|
|
1629
1651
|
const metadata = loadPoolMetadata();
|
|
@@ -1692,9 +1714,51 @@ app.delete('/api/auth/profiles/:provider/:name', (req, res) => {
|
|
|
1692
1714
|
}
|
|
1693
1715
|
|
|
1694
1716
|
if (changed) {
|
|
1695
|
-
const
|
|
1696
|
-
const
|
|
1697
|
-
|
|
1717
|
+
const paths = getPaths();
|
|
1718
|
+
const allPaths = paths.candidates;
|
|
1719
|
+
if (paths.current && !allPaths.includes(paths.current)) {
|
|
1720
|
+
allPaths.push(paths.current);
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
allPaths.forEach(p => {
|
|
1724
|
+
const ap = path.join(path.dirname(p), 'auth.json');
|
|
1725
|
+
if (fs.existsSync(ap)) {
|
|
1726
|
+
try {
|
|
1727
|
+
const cfg = JSON.parse(fs.readFileSync(ap, 'utf8'));
|
|
1728
|
+
let modified = false;
|
|
1729
|
+
|
|
1730
|
+
if (provider === 'google') {
|
|
1731
|
+
if (cfg.google?.email === name || cfg['google.antigravity']?.email === name || cfg['google.gemini']?.email === name) {
|
|
1732
|
+
delete cfg.google;
|
|
1733
|
+
delete cfg['google.antigravity'];
|
|
1734
|
+
delete cfg['google.gemini'];
|
|
1735
|
+
modified = true;
|
|
1736
|
+
}
|
|
1737
|
+
} else if (cfg[provider]) {
|
|
1738
|
+
const creds = cfg[provider];
|
|
1739
|
+
let matches = false;
|
|
1740
|
+
if (creds.email === name) matches = true;
|
|
1741
|
+
else if (creds.accountId === name) matches = true;
|
|
1742
|
+
else if (provider === 'openai' && creds.access) {
|
|
1743
|
+
const decoded = decodeJWT(creds.access);
|
|
1744
|
+
if (decoded && decoded['https://api.openai.com/profile']?.email === name) matches = true;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
if (matches) {
|
|
1748
|
+
delete cfg[provider];
|
|
1749
|
+
modified = true;
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
if (modified) {
|
|
1754
|
+
console.log(`[Auth] Removing credentials from ${ap}`);
|
|
1755
|
+
atomicWriteFileSync(ap, JSON.stringify(cfg, null, 2));
|
|
1756
|
+
}
|
|
1757
|
+
} catch (e) {
|
|
1758
|
+
console.error(`[Auth] Failed to update ${ap}:`, e.message);
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
});
|
|
1698
1762
|
}
|
|
1699
1763
|
|
|
1700
1764
|
const metadata = loadPoolMetadata();
|
package/package.json
CHANGED
package/server.log
ADDED