Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix: api keys not being overwritten
Gabriel Steinfc147c0d47b3
diff --git a/src/helpers/environment.js b/src/helpers/environment.jsindex 23be33a59..5b6039a5a 100644--- a/src/helpers/environment.js+++ b/src/helpers/environment.js@@ -46,6 +46,8 @@ class EnvironmentManager {try {// Update the environment variable in memory for immediate useprocess.env.OPENAI_API_KEY = key;+ // Persist all keys to file+ this.saveAllKeysToEnvFile();return { success: true };} catch (error) {// Silent error - already throwing@@ -62,6 +64,8 @@ class EnvironmentManager {try {// Update the environment variable in memory for immediate useprocess.env.ANTHROPIC_API_KEY = key;+ // Persist all keys to file+ this.saveAllKeysToEnvFile();return { success: true };} catch (error) {// Silent error - already throwing@@ -78,6 +82,8 @@ class EnvironmentManager {try {// Update the environment variable in memory for immediate useprocess.env.GEMINI_API_KEY = key;+ // Persist all keys to file+ this.saveAllKeysToEnvFile();return { success: true };} catch (error) {// Silent error - already throwing@@ -104,6 +110,36 @@ OPENAI_API_KEY=${apiKey}throw error;}}++ saveAllKeysToEnvFile() {+ try {+ const envPath = path.join(app.getPath("userData"), ".env");++ // Build env content with all current keys+ let envContent = `# OpenWhispr Environment Variables+# This file was created automatically for production use+`;++ if (process.env.OPENAI_API_KEY) {+ envContent += `OPENAI_API_KEY=${process.env.OPENAI_API_KEY}\n`;+ }+ if (process.env.ANTHROPIC_API_KEY) {+ envContent += `ANTHROPIC_API_KEY=${process.env.ANTHROPIC_API_KEY}\n`;+ }+ if (process.env.GEMINI_API_KEY) {+ envContent += `GEMINI_API_KEY=${process.env.GEMINI_API_KEY}\n`;+ }++ fs.writeFileSync(envPath, envContent, "utf8");++ // Reload the env file+ require("dotenv").config({ path: envPath });++ return { success: true, path: envPath };+ } catch (error) {+ throw error;+ }+ }}module.exports = EnvironmentManager;