@koreanhole/opencodex 3.2.21 → 3.2.22
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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spawn as nodeSpawn, type ChildProcess } from "node:child_process";
|
|
2
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { accessSync, constants, existsSync, readFileSync, statSync } from "node:fs";
|
|
3
3
|
import { link, lstat, mkdir, mkdtemp, readFile, rm, stat, symlink, writeFile } from "node:fs/promises";
|
|
4
4
|
import { homedir, tmpdir } from "node:os";
|
|
5
5
|
import { join, resolve } from "node:path";
|
|
@@ -173,6 +173,17 @@ function geminiVendorHome(sourceEnv: NodeJS.ProcessEnv): string {
|
|
|
173
173
|
?? homedir();
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
function hasPlaintextGeminiOAuthStore(sourceEnv: NodeJS.ProcessEnv): boolean {
|
|
177
|
+
const path = join(geminiVendorHome(sourceEnv), ".gemini", "oauth_creds.json");
|
|
178
|
+
try {
|
|
179
|
+
const info = statSync(path);
|
|
180
|
+
accessSync(path, constants.R_OK);
|
|
181
|
+
return info.isFile() && info.size > 0;
|
|
182
|
+
} catch {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
176
187
|
function safeMessage(value: unknown, fallback: string): string {
|
|
177
188
|
const raw = typeof value === "string"
|
|
178
189
|
? value
|
|
@@ -213,7 +224,10 @@ export function buildGeminiHeadlessEnv(
|
|
|
213
224
|
}
|
|
214
225
|
if (geminiHeadlessAuth(sourceEnv) === "oauth") {
|
|
215
226
|
env.GOOGLE_GENAI_USE_GCA = "true";
|
|
216
|
-
if (
|
|
227
|
+
if (
|
|
228
|
+
env.GEMINI_FORCE_ENCRYPTED_FILE_STORAGE === undefined
|
|
229
|
+
&& !hasPlaintextGeminiOAuthStore(sourceEnv)
|
|
230
|
+
) {
|
|
217
231
|
env.GEMINI_FORCE_ENCRYPTED_FILE_STORAGE = "true";
|
|
218
232
|
}
|
|
219
233
|
}
|