opencode-studio-server 1.12.5 → 1.12.6
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 +11 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1883,13 +1883,17 @@ function importCurrentGoogleAuthToPool() {
|
|
|
1883
1883
|
if (studio.activeGooglePlugin !== 'antigravity') return;
|
|
1884
1884
|
|
|
1885
1885
|
const authCfg = loadAuthConfig();
|
|
1886
|
-
if (!authCfg
|
|
1886
|
+
if (!authCfg) return;
|
|
1887
|
+
|
|
1888
|
+
// Check google.antigravity first, then google
|
|
1889
|
+
const creds = authCfg['google.antigravity'] || authCfg.google;
|
|
1890
|
+
if (!creds || !creds.email) return;
|
|
1887
1891
|
|
|
1888
1892
|
const namespace = 'google.antigravity';
|
|
1889
1893
|
const profileDir = path.join(AUTH_PROFILES_DIR, namespace);
|
|
1890
1894
|
if (!fs.existsSync(profileDir)) fs.mkdirSync(profileDir, { recursive: true });
|
|
1891
1895
|
|
|
1892
|
-
const email =
|
|
1896
|
+
const email = creds.email;
|
|
1893
1897
|
const profilePath = path.join(profileDir, `${email}.json`);
|
|
1894
1898
|
|
|
1895
1899
|
// Check if we need to sync (new account or updated tokens)
|
|
@@ -1897,7 +1901,7 @@ function importCurrentGoogleAuthToPool() {
|
|
|
1897
1901
|
if (fs.existsSync(profilePath)) {
|
|
1898
1902
|
try {
|
|
1899
1903
|
const current = JSON.parse(fs.readFileSync(profilePath, 'utf8'));
|
|
1900
|
-
if (current.access_token ===
|
|
1904
|
+
if (current.access_token === creds.access_token) {
|
|
1901
1905
|
shouldSync = false;
|
|
1902
1906
|
}
|
|
1903
1907
|
} catch {
|
|
@@ -1907,12 +1911,13 @@ function importCurrentGoogleAuthToPool() {
|
|
|
1907
1911
|
|
|
1908
1912
|
if (shouldSync) {
|
|
1909
1913
|
console.log(`[Auth] Syncing Google login for ${email} to Antigravity pool.`);
|
|
1910
|
-
atomicWriteFileSync(profilePath, JSON.stringify(
|
|
1914
|
+
atomicWriteFileSync(profilePath, JSON.stringify(creds, null, 2));
|
|
1911
1915
|
|
|
1912
1916
|
const metadata = loadPoolMetadata();
|
|
1913
1917
|
if (!metadata[namespace]) metadata[namespace] = {};
|
|
1914
1918
|
|
|
1915
|
-
//
|
|
1919
|
+
// Update metadata
|
|
1920
|
+
// Always update to ensure projectId is captured if added later
|
|
1916
1921
|
if (!metadata[namespace][email]) {
|
|
1917
1922
|
metadata[namespace][email] = {
|
|
1918
1923
|
email: email,
|
|
@@ -1921,8 +1926,8 @@ function importCurrentGoogleAuthToPool() {
|
|
|
1921
1926
|
usageCount: 0,
|
|
1922
1927
|
imported: true
|
|
1923
1928
|
};
|
|
1924
|
-
savePoolMetadata(metadata);
|
|
1925
1929
|
}
|
|
1930
|
+
savePoolMetadata(metadata);
|
|
1926
1931
|
}
|
|
1927
1932
|
}
|
|
1928
1933
|
|