Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(network): proxy-aware fetches + actionable connectivity errors (#687)

Gabriel Stein3e7cb4a3d5f2
diff --git a/docs/network-allowlist.md b/docs/network-allowlist.md
new file mode 100644
index 000000000..99a95b3ff
--- /dev/null
+++ b/docs/network-allowlist.md
@@ -0,0 +1,98 @@
+# Network Allowlist
+
+Outbound hosts the OpenWhispr desktop app contacts. For firewall, proxy, and
+DNS filter configuration.
+
+All connections are client-initiated over TLS. No inbound ports.
+
+## Required by default
+
+Contacted by every install using OpenWhispr Cloud (the default after
+onboarding).
+
+| Host | Protocol | Port | Purpose |
+| --- | --- | --- | --- |
+| `api.openwhispr.com` | HTTPS | 443 | Cloud API: transcription, sync, agent reasoning, settings, usage. |
+| `*.neonauth.c-3.us-east-1.aws.neon.tech` | HTTPS | 443 | Account sign-in and session refresh (Neon Auth). |
+| `github.com`, `objects.githubusercontent.com` | HTTPS | 443 | Application auto-update (release artifacts via electron-updater, GitHub provider). |
+
+## Required for streaming transcription
+
+OpenWhispr Cloud routes streaming sessions through one of three providers.
+Allowlist all three unless a specific provider is pinned in configuration.
+
+| Host | Protocol | Port | Purpose |
+| --- | --- | --- | --- |
+| `api.deepgram.com` | WSS | 443 | Deepgram streaming transcription. |
+| `api.openai.com` | WSS, HTTPS | 443 | OpenAI Realtime streaming transcription. |
+| `streaming.assemblyai.com` | WSS, HTTPS | 443 | AssemblyAI streaming transcription. Token endpoint is HTTPS; live session is WSS. |
+
+## Required for local model downloads
+
+Contacted only when a user opts into a local model (Whisper, Parakeet, or a
+local GGUF reasoning model). Not required for cloud-only installs.
+
+| Host | Protocol | Port | Purpose |
+| --- | --- | --- | --- |
+| `huggingface.co` | HTTPS | 443 | Whisper GGML, Parakeet, GGUF, and embedding model downloads. |
+| `cdn-lfs.huggingface.co`, `cdn-lfs-us-1.huggingface.co` | HTTPS | 443 | HuggingFace large-file CDN (LFS-backed model files). |
+| `github.com`, `objects.githubusercontent.com` | HTTPS | 443 | sherpa-onnx, llama.cpp, whisper.cpp, and Qdrant binaries (GitHub releases). |
+
+## Required for Google Calendar (optional feature)
+
+Contacted only if the user connects Google Calendar in settings.
+
+| Host | Protocol | Port | Purpose |
+| --- | --- | --- | --- |
+| `accounts.google.com` | HTTPS | 443 | OAuth authorization. |
+| `oauth2.googleapis.com` | HTTPS | 443 | OAuth token exchange and revoke. |
+| `www.googleapis.com` | HTTPS | 443 | Calendar event and calendar list reads. |
+| `openwhispr.com` | HTTPS | 443 | OAuth desktop callback redirect (`/auth/desktop-callback`). |
+
+## BYOK provider hosts (only if configured)
+
+Required only when a user configures their own API key for the corresponding
+provider. Skip any provider not in use.
+
+| Host | Protocol | Port | Used when |
+| --- | --- | --- | --- |
+| `api.openai.com` | HTTPS | 443 | OpenAI API key configured (transcription or reasoning). |
+| `api.anthropic.com` | HTTPS | 443 | Anthropic API key configured. |
+| `generativelanguage.googleapis.com` | HTTPS | 443 | Gemini API key configured. |
+| `api.groq.com` | HTTPS | 443 | Groq API key configured. |
+| `api.mistral.ai` | HTTPS | 443 | Mistral API key configured. |
+
+## Notes
+
+- The app uses Electron's network stack, which honors system proxy settings
+ (macOS System Settings, Windows Internet Options / WPAD, GNOME proxy) and
+ PAC scripts on all platforms.
+- Connections fail with `ENOTFOUND` if DNS is filtered, `ECONNREFUSED` /
+ `ETIMEDOUT` if a firewall blocks the host, and `CERT_HAS_EXPIRED` /
+ `UNABLE_TO_VERIFY_LEAF_SIGNATURE` if a TLS-intercepting proxy is in the
+ path without its root certificate trusted by the OS.
+- IP-pinning is not supported. The hosts above resolve to provider-managed
+ IPs that change without notice.
+
+## How to test
+
+Run from a machine on the same network as the user. A successful response
+(any HTTP status, including `401`) confirms the network path works.
+
+```sh
+# OpenWhispr Cloud reachability
+curl -v https://api.openwhispr.com/api/health
+
+# Streaming providers
+curl -v https://api.deepgram.com/v1/projects
+curl -v https://api.openai.com/v1/models
+curl -v https://streaming.assemblyai.com/v3/token
+
+# Model downloads (only if local mode is in use)
+curl -v -I https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.bin
+```
+
+If a request returns `Could not resolve host`, the DNS layer (resolver,
+filter, or ad blocker) is blocking the domain. If it hangs or returns
+`Connection refused`, a firewall is blocking the port. If it returns a TLS
+error, a proxy is intercepting the connection without a trusted root.
diff --git a/preload.js b/preload.js
index 32ce6c951..8a423a54e 100644
--- a/preload.js
+++ b/preload.js
@@ -465,6 +465,7 @@ contextBridge.exposeInMainWorld("electronAPI", {
authClearSession: () => ipcRenderer.invoke("auth-clear-session"),
// OpenWhispr Cloud API
+ cloudHealthCheck: () => ipcRenderer.invoke("cloud-health-check"),
cloudTranscribe: (audioBuffer, opts) => ipcRenderer.invoke("cloud-transcribe", audioBuffer, opts),
cloudReason: (text, opts) => ipcRenderer.invoke("cloud-reason", text, opts),
cloudStreamingUsage: (text, audioDurationSeconds, opts) =>
diff --git a/src/components/OnboardingFlow.tsx b/src/components/OnboardingFlow.tsx
index b95d5886d..5fd936807 100644
--- a/src/components/OnboardingFlow.tsx
+++ b/src/components/OnboardingFlow.tsx
@@ -89,6 +89,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
activationMode,
setActivationMode,
setDictationKey,
+ setUseLocalWhisper,
updateTranscriptionSettings,
preferredLanguage,
} = useSettings();
@@ -102,6 +103,10 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
const readableHotkey = formatHotkeyLabel(hotkey);
const { alertDialog, confirmDialog, showAlertDialog, hideAlertDialog, hideConfirmDialog } =
useDialogs();
+ const [connectivityDialog, setConnectivityDialog] = useState<{
+ open: boolean;
+ cause: string;
+ }>({ open: false, cause: "" });
const autoRegisterInFlightRef = useRef(false);
const hotkeyStepInitializedRef = useRef(false);
@@ -380,9 +385,47 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
if (!saved) {
return;
}
- removeCurrentStep();
- onComplete();
- }, [saveSettings, removeCurrentStep, onComplete]);
+
+ const cloudHealthCheck = window.electronAPI?.cloudHealthCheck;
+ if (useLocalWhisper || !cloudHealthCheck) {
+ removeCurrentStep();
+ onComplete();
+ return;
+ }
+
+ let result;
+ try {
+ result = await cloudHealthCheck();
+ } catch (error) {
+ logger.error("Cloud health check threw", { error }, "onboarding");
+ result = { ok: false } as Awaited<ReturnType<typeof cloudHealthCheck>>;
+ }
+
+ // Any HTTP response (even 4xx) proves the network reached the server.
+ // Only a transport-level failure with no status warrants the warning.
+ if (result.ok || result.status !== undefined) {
+ removeCurrentStep();
+ onComplete();
+ return;
+ }
+
+ setConnectivityDialog({
+ open: true,
+ cause: t(result.messageKey || "streaming.errors.cloudUnreachable.generic"),
+ });
+ }, [saveSettings, removeCurrentStep, onComplete, useLocalWhisper, t]);
+
+ const resolveConnectivity = useCallback(
+ (useLocal: boolean) => {
+ if (useLocal) {
+ setUseLocalWhisper(true);
+ }
+ setConnectivityDialog({ open: false, cause: "" });
+ removeCurrentStep();
+ onComplete();
+ },
+ [setUseLocalWhisper, removeCurrentStep, onComplete]
+ );
const renderStep = () => {
switch (currentStep) {
@@ -711,6 +754,17 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {
onConfirm={confirmDialog.onConfirm}
/>
+ <ConfirmDialog
+ open={connectivityDialog.open}
+ onOpenChange={(open) => !open && setConnectivityDialog({ open: false, cause: "" })}
+ title={t("onboarding.connectivity.title")}
+ description={t("onboarding.connectivity.body", { cause: connectivityDialog.cause })}
+ confirmText={t("onboarding.connectivity.useLocal")}
+ cancelText={t("onboarding.connectivity.continue")}
+ onConfirm={() => resolveConnectivity(true)}
+ onCancel={() => resolveConnectivity(false)}
+ />
+
<AlertDialog
open={alertDialog.open}
onOpenChange={(open) => !open && hideAlertDialog()}
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.js
index a5b2d550a..0c200fb57 100644
--- a/src/helpers/audioManager.js
+++ b/src/helpers/audioManager.js
@@ -574,6 +574,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
"OpenWhispr Cloud requires sign-in. Please sign in again or switch to BYOK mode."
);
err.code = "AUTH_REQUIRED";
+ err.messageKey = "hooks.audioRecording.errorDescriptions.sessionExpired";
throw err;
}
activeModel = "openwhispr-cloud";
@@ -640,6 +641,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
title: "Transcription Error",
description: `Transcription failed: ${error.message}`,
code: error.code,
+ messageKey: error.messageKey,
});
// Save failed transcription with audio so the user can retry later
@@ -1273,6 +1275,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
if (!navigator.onLine) {
const err = new Error("You're offline. Cloud transcription requires an internet connection.");
err.code = "OFFLINE";
+ err.messageKey = "hooks.audioRecording.errorDescriptions.offline";
throw err;
}
@@ -1587,8 +1590,10 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
);
const err = new Error(`API Error: ${response.status} ${errorText}`);
if (response.status === 401) err.code = "INVALID_KEY";
- else if (response.status === 429) err.code = "LIMIT_REACHED";
- else if (response.status >= 500) err.code = "SERVER_ERROR";
+ else if (response.status === 429) {
+ err.code = "LIMIT_REACHED";
+ err.messageKey = "hooks.audioRecording.errorDescriptions.dailyLimitReached";
+ } else if (response.status >= 500) err.code = "SERVER_ERROR";
throw err;
}
@@ -2262,6 +2267,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
preferredLanguage: preferredLang,
cloudTranscriptionModel,
cloudTranscriptionMode,
+ useLocalWhisper,
} = getSettings();
const res = await provider.start({
sampleRate: 16000,
@@ -2275,8 +2281,19 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
if (res.code === "NO_API") {
return { needsFallback: true };
}
+ if (res.code === "NETWORK_ERROR" && useLocalWhisper) {
+ this.onError?.({
+ code: "NETWORK_ERROR",
+ title: "streaming.errors.cloudUnreachable.title",
+ description: "Cloud unreachable — using local engine for this recording.",
+ messageKey: "streaming.errors.cloudUnreachable.fallback",
+ });
+ return { needsFallback: true };
+ }
const err = new Error(res.error || "Failed to start streaming session");
err.code = res.code;
+ err.messageKey = res.messageKey;
+ err.networkCode = res.networkCode;
throw err;
}
return res;
@@ -2335,9 +2352,14 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
errorTitle = "Sign-in Required";
errorDescription =
"Your OpenWhispr Cloud session is unavailable. Please sign in again from Settings.";
+ } else if (error.code === "NETWORK_ERROR") {
+ errorTitle = "streaming.errors.cloudUnreachable.title";
+ errorDescription = error.messageKey || "streaming.errors.cloudUnreachable.generic";
}
this.onError?.({
+ code: error.code,
+ messageKey: error.messageKey,
title: errorTitle,
description: errorDescription,
});
diff --git a/src/helpers/downloadUtils.js b/src/helpers/downloadUtils.js
index 262d2eb56..705971a14 100644
--- a/src/helpers/downloadUtils.js
+++ b/src/helpers/downloadUtils.js
@@ -1,8 +1,7 @@
const fs = require("fs");
const { promises: fsPromises } = require("fs");
const path = require("path");
-const https = require("https");
-const http = require("http");
+const { net } = require("electron");
const { execFile } = require("child_process");
const { pipeline } = require("stream");
const debugLogger = require("./debugLogger");
@@ -10,7 +9,6 @@ const debugLogger = require("./debugLogger");
const USER_AGENT = "OpenWhispr/1.0";
const PROGRESS_THROTTLE_MS = 100;
const MAX_REDIRECTS = 5;
-const DEFAULT_TIMEOUT = 60000;
const DEFAULT_MAX_RETRIES = 3;
const MAX_BACKOFF_MS = 30000;
const STALL_TIMEOUT_MS = 30000;
@@ -48,6 +46,11 @@ function isRetryable(error) {
return RETRYABLE_CODES.has(error.code);
}
+function headerValue(headers, name) {
+ const raw = headers[name];
+ return Array.isArray(raw) ? raw[0] : raw;
+}
+
function backoffDelay(attempt) {
return Math.min(1000 * Math.pow(2, attempt), MAX_BACKOFF_MS);
}
@@ -57,14 +60,7 @@ function sleep(ms) {
}
function downloadAttempt(url, tempPath, options) {
- const {
- timeout,
- onProgress,
- signal,
- startOffset = 0,
- expectedSize = 0,
- _redirects = 0,
- } = options;
+ const { onProgress, signal, startOffset = 0, expectedSize = 0, _redirects = 0 } = options;
return new Promise((resolve, reject) => {
if (signal?.aborted) {
@@ -82,7 +78,6 @@ function downloadAttempt(url, tempPath, options) {
headers["Range"] = `bytes=${startOffset}-`;
}
- const client = url.startsWith("https") ? https : http;
let request = null;
let activeFile = null;
let stallTimer = null;
@@ -96,7 +91,7 @@ function downloadAttempt(url, tempPath, options) {
stallTimer = null;
}
if (request) {
- request.destroy();
+ request.abort();
request = null;
}
if (activeFile) {
@@ -114,7 +109,13 @@ function downloadAttempt(url, tempPath, options) {
signal.onAbort = onAbort;
}
- request = client.get(url, { headers, timeout }, (response) => {
+ // Manual redirects so we can reset startOffset when the new origin ignores Range.
+ request = net.request({ url, method: "GET", redirect: "manual" });
+ for (const [name, value] of Object.entries(headers)) {
+ request.setHeader(name, value);
+ }
+
+ request.on("response", (response) => {
if (signal?.aborted) {
response.resume();
cleanup();
@@ -124,22 +125,21 @@ function downloadAttempt(url, tempPath, options) {
const statusCode = response.statusCode;
- // Follow redirects inline — no separate HEAD resolve step needed
if (statusCode >= 300 && statusCode < 400) {
response.resume();
if (signal) signal.onAbort = null;
if (request) {
- request.destroy();
+ request.abort();
request = null;
}
- const location = response.headers.location;
- if (!location) {
+ const redirectUrl = headerValue(response.headers, "location");
+ if (!redirectUrl) {
reject(
Object.assign(new Error("Redirect without location header"), { isHttpError: true })
);
return;
}
- downloadAttempt(location, tempPath, { ...options, _redirects: _redirects + 1 }).then(
+ downloadAttempt(redirectUrl, tempPath, { ...options, _redirects: _redirects + 1 }).then(
resolve,
reject
);
@@ -151,21 +151,21 @@ function downloadAttempt(url, tempPath, options) {
// Server doesn't support Range — restart from beginning
downloadedSize = 0;
activeFile = fs.createWriteStream(tempPath, { flags: "w" });
- totalSize = parseInt(response.headers["content-length"], 10) || 0;
+ totalSize = parseInt(headerValue(response.headers, "content-length"), 10) || 0;
} else if (statusCode === 206) {
activeFile = fs.createWriteStream(tempPath, { flags: "a" });
- const contentRange = response.headers["content-range"];
+ const contentRange = headerValue(response.headers, "content-range");
if (contentRange) {
const match = contentRange.match(/\/(\d+)$/);
if (match) totalSize = parseInt(match[1], 10);
}
if (!totalSize) {
- const contentLength = parseInt(response.headers["content-length"], 10) || 0;
+ const contentLength = parseInt(headerValue(response.headers, "content-length"), 10) || 0;
totalSize = startOffset + contentLength;
}
} else if (statusCode === 200) {
activeFile = fs.createWriteStream(tempPath, { flags: "w" });
- totalSize = parseInt(response.headers["content-length"], 10) || 0;
+ totalSize = parseInt(headerValue(response.headers, "content-length"), 10) || 0;
} else {
response.resume();
cleanup();
@@ -247,11 +247,7 @@ function downloadAttempt(url, tempPath, options) {
}
});
- request.on("timeout", () => {
- if (signal) signal.onAbort = null;
- cleanup();
- reject(Object.assign(new Error("Socket timeout"), { code: "ETIMEDOUT" }));
- });
+ request.end();
function emitProgress() {
if (!onProgress) return;
@@ -268,13 +264,7 @@ function downloadAttempt(url, tempPath, options) {
}
async function downloadFile(url, destPath, options = {}) {
- const {
- onProgress,
- timeout = DEFAULT_TIMEOUT,
- maxRetries = DEFAULT_MAX_RETRIES,
- signal,
- expectedSize = 0,
- } = options;
+ const { onProgress, maxRetries = DEFAULT_MAX_RETRIES, signal, expectedSize = 0 } = options;
const tempPath = `${destPath}.tmp`;
@@ -314,7 +304,6 @@ async function downloadFile(url, destPath, options = {}) {
try {
await downloadAttempt(url, tempPath, {
- timeout,
onProgress,
signal,
startOffset,
diff --git a/src/helpers/enterpriseProviderErrors.js b/src/helpers/enterpriseProviderErrors.js
index f236f3221..6bd558e78 100644
--- a/src/helpers/enterpriseProviderErrors.js
+++ b/src/helpers/enterpriseProviderErrors.js
@@ -4,6 +4,8 @@
* an action hint and a shell command the user can copy-paste.
*/
+const { classifyNetworkError } = require("./networkErrors");
+
function mapBedrockError(error, config = {}) {
const msg = error?.message || error?.code || String(error);
const profile = config.bedrockProfile || "default";
@@ -62,7 +64,7 @@ function mapAzureError(error) {
retryable: true,
};
}
- if (msg.includes("ENOTFOUND") || msg.includes("ECONNREFUSED") || msg.includes("fetch failed")) {
+ if (classifyNetworkError(error).isNetworkError || msg.includes("fetch failed")) {
return {
message: "Cannot reach Azure endpoint. Check the endpoint URL.",
action: "Ensure the URL looks like: https://yourresource.openai.azure.com",
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index 1fc49c96e..9863c797e 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -1,4 +1,4 @@
-const { ipcMain, app, shell, BrowserWindow, systemPreferences } = require("electron");
+const { ipcMain, app, shell, BrowserWindow, systemPreferences, net } = require("electron");
const path = require("path");
const fs = require("fs");
const os = require("os");
@@ -6,6 +6,7 @@ const http = require("http");
const https = require("https");
const crypto = require("crypto");
const debugLogger = require("./debugLogger");
+const { classifyAndLog } = require("./networkErrors");
const GnomeShortcutManager = require("./gnomeShortcut");
const HyprlandShortcutManager = require("./hyprlandShortcut");
const AssemblyAiStreaming = require("./assemblyAiStreaming");
@@ -2446,7 +2447,7 @@ class IPCHandlers {
}
}
- const response = await fetch(MISTRAL_TRANSCRIPTION_URL, {
+ const response = await proxyFetch(MISTRAL_TRANSCRIPTION_URL, {
method: "POST",
headers: {
"x-api-key": apiKey,
@@ -2816,7 +2817,7 @@ class IPCHandlers {
temperature: config?.temperature || 0.3,
};
- const response = await fetch("https://api.anthropic.com/v1/messages", {
+ const response = await proxyFetch("https://api.anthropic.com/v1/messages", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -3362,6 +3363,11 @@ class IPCHandlers {
return getSessionCookiesFromWindow(win);
};
+ // Honors system proxy via Electron's net stack. useSessionCookies:false
+ // because we set the Cookie header manually from getSessionCookies() —
+ // letting Electron also attach session cookies risks duplicates.
+ const proxyFetch = (url, init = {}) => net.fetch(url, { ...init, useSessionCookies: false });
+
ipcMain.handle("cloud-transcribe", async (event, audioBuffer, opts = {}) => {
try {
const apiUrl = getApiUrl();
@@ -3446,6 +3452,35 @@ class IPCHandlers {
}
});
+ ipcMain.handle("cloud-health-check", async () => {
+ const apiUrl = getApiUrl();
+ if (!apiUrl) {
+ return {
+ ok: false,
+ code: "NO_API_URL",
+ messageKey: "streaming.errors.cloudUnreachable.generic",
+ };
+ }
+ const url = `${apiUrl}/api/health`;
+ try {
+ const res = await proxyFetch(url, {
+ method: "GET",
+ signal: AbortSignal.timeout(3000),
+ });
+ return { ok: res.ok, status: res.status };
+ } catch (err) {
+ const classified = classifyAndLog(err, url);
+ if (classified.isNetworkError) {
+ return { ok: false, code: classified.code, messageKey: classified.messageKey };
+ }
+ return {
+ ok: false,
+ code: "UNKNOWN",
+ messageKey: "streaming.errors.cloudUnreachable.generic",
+ };
+ }
+ });
+
ipcMain.handle("retry-transcription", async (event, id, settings) => {
const buffer = this.audioStorageManager.getAudioBuffer(id);
if (!buffer) return { success: false, error: "Audio file not found" };
@@ -3540,7 +3575,7 @@ class IPCHandlers {
headers.Authorization = `Bearer ${apiKey}`;
}
- const response = await fetch(endpoint, { method: "POST", headers, body: formData });
+ const response = await proxyFetch(endpoint, { method: "POST", headers, body: formData });
if (!response.ok) {
const errorText = await response.text();
throw new Error(`${provider} API Error: ${response.status} ${errorText}`);
@@ -3991,11 +4026,25 @@ class IPCHandlers {
if (!apiUrl) throw new Error("OpenWhispr API URL not configured");
const cookieHeader = await getSessionCookies(event);
if (!cookieHeader) throw new Error("No session cookies available");
- const response = await fetch(`${apiUrl}${path}`, {
- method: "POST",
- headers: { "Content-Type": "application/json", Cookie: cookieHeader },
- body: JSON.stringify(body),
- });
+ const url = `${apiUrl}${path}`;
+ let response;
+ try {
+ response = await proxyFetch(url, {
+ method: "POST",
+ headers: { "Content-Type": "application/json", Cookie: cookieHeader },
+ body: JSON.stringify(body),
+ });
+ } catch (err) {
+ const classified = classifyAndLog(err, url);
+ if (classified.isNetworkError) {
+ throw Object.assign(new Error(err.message || "Network request failed"), {
+ code: "NETWORK_ERROR",
+ networkCode: classified.code,
+ messageKey: classified.messageKey,
+ });
+ }
+ throw err;
+ }
if (!response.ok) {
const err = await response.json().catch(() => ({}));
throw new Error(err.error || `Token request failed: ${response.status}`);
@@ -4012,7 +4061,7 @@ class IPCHandlers {
throw new Error("No AssemblyAI API key configured. Add your key in Settings.");
}
return dual(async () => {
- const response = await fetch(
+ const response = await proxyFetch(
"https://streaming.assemblyai.com/v3/token?expires_in_seconds=60",
{ headers: { Authorization: apiKey } }
);
@@ -5334,13 +5383,21 @@ class IPCHandlers {
}
});
+ const streamingStartFailure = (err) => {
+ const result = { success: false, error: err.message };
+ if (err.code) result.code = err.code;
+ if (err.messageKey) result.messageKey = err.messageKey;
+ if (err.networkCode) result.networkCode = err.networkCode;
+ return result;
+ };
+
ipcMain.handle("dictation-realtime-warmup", async (event, options = {}) => {
try {
await connectDictationStreaming(event, options);
startDictationIdleTimer();
return { success: true };
} catch (err) {
- return { success: false, error: err.message };
+ return streamingStartFailure(err);
}
});
@@ -5350,7 +5407,7 @@ class IPCHandlers {
if (!this._dictationStreaming?.isConnected) await connectDictationStreaming(event, options);
return { success: true };
} catch (err) {
- return { success: false, error: err.message };
+ return streamingStartFailure(err);
}
});
@@ -5475,7 +5532,7 @@ class IPCHandlers {
"cloud-api"
);
- const response = await fetch(`${apiUrl}/api/reason`, {
+ const response = await proxyFetch(`${apiUrl}/api/reason`, {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -5551,7 +5608,7 @@ class IPCHandlers {
const cookieHeader = await getSessionCookies(event);
if (!cookieHeader) throw new Error("No session cookies available");
- const response = await fetch(`${apiUrl}/api/agent/stream`, {
+ const response = await proxyFetch(`${apiUrl}/api/agent/stream`, {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -5646,7 +5703,7 @@ class IPCHandlers {
debugLogger.debug("Agent web search request", { query, numResults }, "cloud-api");
- const response = await fetch(`${apiUrl}/api/agent/web-search`, {
+ const response = await proxyFetch(`${apiUrl}/api/agent/web-search`, {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -5687,7 +5744,7 @@ class IPCHandlers {
const cookieHeader = await getSessionCookies(event);
if (!cookieHeader) throw new Error("No session cookies available");
- const response = await fetch(`${apiUrl}/api/streaming-usage`, {
+ const response = await proxyFetch(`${apiUrl}/api/streaming-usage`, {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -5738,7 +5795,7 @@ class IPCHandlers {
const cookieHeader = await getSessionCookies(event);
if (!cookieHeader) throw new Error("No session cookies available");
- const response = await fetch(`${apiUrl}/api/usage`, {
+ const response = await proxyFetch(`${apiUrl}/api/usage`, {
headers: { Cookie: cookieHeader },
});
@@ -5775,7 +5832,7 @@ class IPCHandlers {
fetchOpts.body = JSON.stringify(body);
}
- const response = await fetch(`${apiUrl}${endpoint}`, fetchOpts);
+ const response = await proxyFetch(`${apiUrl}${endpoint}`, fetchOpts);
if (!response.ok) {
if (response.status === 401) {
@@ -5812,7 +5869,7 @@ class IPCHandlers {
const cookieHeader = await getSessionCookies(event);
if (!cookieHeader) throw new Error("No session cookies available");
- const response = await fetch(`${apiUrl}/api/stripe/switch-plan`, {
+ const response = await proxyFetch(`${apiUrl}/api/stripe/switch-plan`, {
method: "POST",
headers: { Cookie: cookieHeader, "Content-Type": "application/json" },
body: JSON.stringify(opts),
@@ -5844,7 +5901,7 @@ class IPCHandlers {
const cookieHeader = await getSessionCookies(event);
if (!cookieHeader) throw new Error("No session cookies available");
- const response = await fetch(`${apiUrl}/api/stripe/preview-switch`, {
+ const response = await proxyFetch(`${apiUrl}/api/stripe/preview-switch`, {
method: "POST",
headers: { Cookie: cookieHeader, "Content-Type": "application/json" },
body: JSON.stringify(opts),
@@ -5885,7 +5942,7 @@ class IPCHandlers {
fetchOpts.body = JSON.stringify(opts.body);
}
- const response = await fetch(`${apiUrl}${opts.path}`, fetchOpts);
+ const response = await proxyFetch(`${apiUrl}${opts.path}`, fetchOpts);
if (response.status === 401) {
return { success: false, error: "Session expired", code: "AUTH_EXPIRED" };
@@ -5919,7 +5976,7 @@ class IPCHandlers {
const cookieHeader = await getSessionCookies(event);
if (!cookieHeader) throw new Error("No session cookies available");
- const response = await fetch(`${apiUrl}/api/stt-config`, {
+ const response = await proxyFetch(`${apiUrl}/api/stt-config`, {
headers: { Cookie: cookieHeader },
});
@@ -5949,7 +6006,7 @@ class IPCHandlers {
const cookieHeader = await getSessionCookies(event);
if (!cookieHeader) throw new Error("No session cookies available");
- const response = await fetch(`${apiUrl}/api/note-recording-config`, {
+ const response = await proxyFetch(`${apiUrl}/api/note-recording-config`, {
headers: { Cookie: cookieHeader },
});
@@ -6094,7 +6151,7 @@ class IPCHandlers {
throw new Error("No session cookies available");
}
- const response = await fetch(`${apiUrl}/api/referrals/stats`, {
+ const response = await proxyFetch(`${apiUrl}/api/referrals/stats`, {
headers: {
Cookie: cookieHeader,
},
@@ -6130,7 +6187,7 @@ class IPCHandlers {
throw new Error("No session cookies available");
}
- const response = await fetch(`${apiUrl}/api/referrals/invite`, {
+ const response = await proxyFetch(`${apiUrl}/api/referrals/invite`, {
method: "POST",
headers: {
Cookie: cookieHeader,
@@ -6168,7 +6225,7 @@ class IPCHandlers {
throw new Error("No session cookies available");
}
- const response = await fetch(`${apiUrl}/api/referrals/invites`, {
+ const response = await proxyFetch(`${apiUrl}/api/referrals/invites`, {
headers: {
Cookie: cookieHeader,
},
@@ -6350,7 +6407,7 @@ class IPCHandlers {
throw new Error("No session cookies available");
}
- const tokenResponse = await fetch(`${apiUrl}/api/streaming-token`, {
+ const tokenResponse = await proxyFetch(`${apiUrl}/api/streaming-token`, {
method: "POST",
headers: {
Cookie: cookieHeader,
@@ -6496,7 +6553,7 @@ class IPCHandlers {
if (error.code === "AUTH_EXPIRED") {
return { success: false, error: "Session expired", code: "AUTH_EXPIRED" };
}
- return { success: false, error: error.message };
+ return streamingStartFailure(error);
} finally {
streamingStartInProgress = false;
}
@@ -6551,7 +6608,7 @@ class IPCHandlers {
const cookieHeader = await getSessionCookiesFromWindow(win);
if (!cookieHeader) throw new Error("No session cookies available");
- const tokenResponse = await fetch(`${apiUrl}/api/deepgram-streaming-token`, {
+ const tokenResponse = await proxyFetch(`${apiUrl}/api/deepgram-streaming-token`, {
method: "POST",
headers: { Cookie: cookieHeader },
});
@@ -6581,7 +6638,7 @@ class IPCHandlers {
throw new Error("No session cookies available");
}
- const tokenResponse = await fetch(`${apiUrl}/api/deepgram-streaming-token`, {
+ const tokenResponse = await proxyFetch(`${apiUrl}/api/deepgram-streaming-token`, {
method: "POST",
headers: {
Cookie: cookieHeader,
@@ -6750,7 +6807,7 @@ class IPCHandlers {
if (error.code === "AUTH_EXPIRED") {
return { success: false, error: "Session expired", code: "AUTH_EXPIRED" };
}
- return { success: false, error: error.message };
+ return streamingStartFailure(error);
} finally {
deepgramStreamingStartInProgress = false;
}
diff --git a/src/helpers/networkErrors.js b/src/helpers/networkErrors.js
new file mode 100644
index 000000000..b96f35590
--- /dev/null
+++ b/src/helpers/networkErrors.js
@@ -0,0 +1,51 @@
+const debugLogger = require("./debugLogger");
+
+const CODE_TO_KEY = {
+ ENOTFOUND: "streaming.errors.cloudUnreachable.dnsBlocked",
+ ECONNREFUSED: "streaming.errors.cloudUnreachable.refused",
+ ECONNRESET: "streaming.errors.cloudUnreachable.refused",
+ UND_ERR_SOCKET: "streaming.errors.cloudUnreachable.refused",
+ ETIMEDOUT: "streaming.errors.cloudUnreachable.timeout",
+ UND_ERR_CONNECT_TIMEOUT: "streaming.errors.cloudUnreachable.timeout",
+ CERT_HAS_EXPIRED: "streaming.errors.cloudUnreachable.tls",
+ UNABLE_TO_VERIFY_LEAF_SIGNATURE: "streaming.errors.cloudUnreachable.tls",
+ DEPTH_ZERO_SELF_SIGNED_CERT: "streaming.errors.cloudUnreachable.tls",
+};
+
+const NAME_TO_KEY = {
+ TimeoutError: "streaming.errors.cloudUnreachable.timeout",
+ AbortError: "streaming.errors.cloudUnreachable.timeout",
+};
+
+function classifyNetworkError(err) {
+ if (!err) return { isNetworkError: false };
+ const code = err.code || err.cause?.code;
+ if (code && CODE_TO_KEY[code]) {
+ return { code, messageKey: CODE_TO_KEY[code], isNetworkError: true };
+ }
+ if (err.name && NAME_TO_KEY[err.name]) {
+ return { code: err.name, messageKey: NAME_TO_KEY[err.name], isNetworkError: true };
+ }
+ return { isNetworkError: false };
+}
+
+function classifyAndLog(err, url) {
+ const classified = classifyNetworkError(err);
+ if (!classified.isNetworkError) return classified;
+ let host;
+ let urlPath;
+ try {
+ const parsed = new URL(url);
+ host = parsed.host;
+ urlPath = parsed.pathname;
+ } catch {
+ // url may be missing/invalid — log without host metadata
+ }
+ debugLogger.warn("Network error", { code: classified.code, host, urlPath }, "network");
+ return classified;
+}
+
+module.exports = {
+ classifyNetworkError,
+ classifyAndLog,
+};
diff --git a/src/hooks/useAudioRecording.js b/src/hooks/useAudioRecording.js
index e9c2b4459..9eb1eca54 100644
--- a/src/hooks/useAudioRecording.js
+++ b/src/hooks/useAudioRecording.js
@@ -4,7 +4,7 @@ import AudioManager from "../helpers/audioManager";
import logger from "../utils/logger";
import { playStartCue, playStopCue } from "../utils/dictationCues";
import { getSettings } from "../stores/settingsStore";
-import { getRecordingErrorTitle } from "../utils/recordingErrors";
+import { getRecordingErrorTitle, getRecordingErrorDescription } from "../utils/recordingErrors";
import { isAccessibilitySkipped } from "../utils/permissions";
export const useAudioRecording = (toast, options = {}) => {
@@ -100,9 +100,10 @@ export const useAudioRecording = (toast, options = {}) => {
window.electronAPI?.hideDictationPreview?.();
}
const title = getRecordingErrorTitle(error, t);
+ const description = getRecordingErrorDescription(error, t);
toast({
title,
- description: error.description,
+ description,
variant: "destructive",
duration: error.code === "AUTH_EXPIRED" ? 8000 : undefined,
});
diff --git a/src/lib/auth.ts b/src/lib/auth.ts
index 2b88b69c9..c35e762a8 100644
--- a/src/lib/auth.ts
+++ b/src/lib/auth.ts
@@ -65,13 +65,11 @@ function getLastSignInTime(): number | null {
}
function createAuthExpiredError(originalError: unknown): Error {
- if (originalError instanceof Error) {
- (originalError as Error & { code?: string }).code = "AUTH_EXPIRED";
- return originalError;
- }
-
- const error = new Error("Session expired");
- (error as Error & { code?: string }).code = "AUTH_EXPIRED";
+ const error = originalError instanceof Error ? originalError : new Error("Session expired");
+ Object.assign(error, {
+ code: "AUTH_EXPIRED",
+ messageKey: "hooks.audioRecording.errorDescriptions.sessionExpired",
+ });
return error;
}
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index f3c50da84..aaf4d47e8 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -206,6 +206,25 @@
"hotkeyToStartStop": "{{hotkey}} zum Starten/Stoppen",
"holdHotkey": "{{hotkey}} gedrückt halten",
"textareaPlaceholder": "Hier klicken und Hotkey zum Diktieren verwenden..."
+ },
+ "connectivity": {
+ "title": "OpenWhispr Cloud ist aus diesem Netzwerk nicht erreichbar",
+ "body": "{{cause}} Sie können zur lokalen Engine wechseln oder fortfahren und es später erneut versuchen.",
+ "useLocal": "Lokale Engine verwenden",
+ "continue": "Trotzdem fortfahren"
+ }
+ },
+ "streaming": {
+ "errors": {
+ "cloudUnreachable": {
+ "title": "OpenWhispr Cloud nicht erreichbar",
+ "generic": "Die Netzwerkanfrage ist fehlgeschlagen. Prüfen Sie Ihre Verbindung.",
+ "dnsBlocked": "DNS löst openwhispr.com nicht auf — ein Werbeblocker oder Filter blockiert es möglicherweise.",
+ "refused": "Verbindung wurde abgelehnt — wahrscheinlich eine Firewall oder ein VPN.",
+ "timeout": "Netzwerk-Zeitüberschreitung — VPN, Captive Portal oder instabile Verbindung.",
+ "tls": "TLS-Handshake fehlgeschlagen — prüfen Sie Ihre Systemuhr oder einen Unternehmens-Proxy.",
+ "fallback": "Cloud nicht erreichbar — lokale Engine wird für diese Aufnahme verwendet."
+ }
}
},
"controlPanel": {
@@ -408,6 +427,11 @@
"noAudio": {
"title": "Kein Audio erkannt",
"description": "Die Aufnahme enthielt kein erkennbares Audio. Bitte versuchen Sie es erneut."
+ },
+ "errorDescriptions": {
+ "sessionExpired": "Deine OpenWhispr-Cloud-Sitzung ist nicht verfügbar. Bitte melde dich erneut über die Einstellungen an.",
+ "offline": "Du bist offline. Die Cloud-Transkription benötigt eine Internetverbindung.",
+ "dailyLimitReached": "Du hast dein heutiges Transkriptionslimit erreicht. Versuch es morgen erneut oder upgrade deinen Plan."
}
},
"clipboard": {
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index e250f60f8..f660f68e7 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -206,6 +206,25 @@
"hotkeyToStartStop": "{{hotkey}} to start/stop",
"holdHotkey": "Hold {{hotkey}}",
"textareaPlaceholder": "Click here and use your hotkey to dictate..."
+ },
+ "connectivity": {
+ "title": "We can't reach OpenWhispr Cloud from this network",
+ "body": "{{cause}} You can switch to the local engine, or continue and try again later.",
+ "useLocal": "Use local engine",
+ "continue": "Continue anyway"
+ }
+ },
+ "streaming": {
+ "errors": {
+ "cloudUnreachable": {
+ "title": "Can't reach OpenWhispr Cloud",
+ "generic": "Network request failed. Check your connection.",
+ "dnsBlocked": "DNS isn't resolving openwhispr.com — an ad blocker or filter may be blocking it.",
+ "refused": "Connection was refused — likely a firewall or VPN.",
+ "timeout": "Network timed out — VPN, captive portal, or unstable connection.",
+ "tls": "TLS handshake failed — check your system clock or for a corporate proxy.",
+ "fallback": "Cloud unreachable — using local engine for this recording."
+ }
}
},
"controlPanel": {
@@ -408,6 +427,11 @@
"noAudio": {
"title": "No Audio Detected",
"description": "The recording contained no detectable audio. Please try again."
+ },
+ "errorDescriptions": {
+ "sessionExpired": "Your OpenWhispr Cloud session is unavailable. Please sign in again from Settings.",
+ "offline": "You're offline. Cloud transcription requires an internet connection.",
+ "dailyLimitReached": "You've reached today's transcription limit. Try again tomorrow or upgrade your plan."
}
},
"clipboard": {
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index 216a274e3..565dad271 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -206,6 +206,25 @@
"hotkeyToStartStop": "{{hotkey}} para iniciar/detener",
"holdHotkey": "Mantener {{hotkey}}",
"textareaPlaceholder": "Haz clic aquí y usa tu atajo para dictar..."
+ },
+ "connectivity": {
+ "title": "No podemos conectar con OpenWhispr Cloud desde esta red",
+ "body": "{{cause}} Puedes cambiar al motor local o continuar e intentarlo más tarde.",
+ "useLocal": "Usar motor local",
+ "continue": "Continuar de todos modos"
+ }
+ },
+ "streaming": {
+ "errors": {
+ "cloudUnreachable": {
+ "title": "No se puede conectar con OpenWhispr Cloud",
+ "generic": "La solicitud de red falló. Comprueba tu conexión.",
+ "dnsBlocked": "El DNS no resuelve openwhispr.com: puede que un bloqueador de anuncios o un filtro lo esté bloqueando.",
+ "refused": "La conexión fue rechazada: probablemente un firewall o una VPN.",
+ "timeout": "Se agotó el tiempo de la red: VPN, portal cautivo o conexión inestable.",
+ "tls": "Falló el handshake TLS: revisa el reloj del sistema o un proxy corporativo.",
+ "fallback": "Cloud no disponible: usando el motor local para esta grabación."
+ }
}
},
"controlPanel": {
@@ -408,6 +427,11 @@
"noAudio": {
"title": "No se detectó audio",
"description": "La grabación no contiene audio detectable. Inténtalo de nuevo."
+ },
+ "errorDescriptions": {
+ "sessionExpired": "Tu sesión de OpenWhispr Cloud no está disponible. Vuelve a iniciar sesión desde Ajustes.",
+ "offline": "Estás sin conexión. La transcripción en la nube requiere conexión a Internet.",
+ "dailyLimitReached": "Has alcanzado el límite de transcripción de hoy. Inténtalo mañana o mejora tu plan."
}
},
"clipboard": {
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index 0dac569e4..eb36d4289 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -206,6 +206,25 @@
"hotkeyToStartStop": "{{hotkey}} pour démarrer/arrêter",
"holdHotkey": "Maintenir {{hotkey}}",
"textareaPlaceholder": "Cliquez ici puis utilisez votre raccourci pour dicter..."
+ },
+ "connectivity": {
+ "title": "Impossible d'atteindre OpenWhispr Cloud depuis ce réseau",
+ "body": "{{cause}} Vous pouvez basculer sur le moteur local, ou continuer et réessayer plus tard.",
+ "useLocal": "Utiliser le moteur local",
+ "continue": "Continuer quand même"
+ }
+ },
+ "streaming": {
+ "errors": {
+ "cloudUnreachable": {
+ "title": "Impossible d'atteindre OpenWhispr Cloud",
+ "generic": "La requête réseau a échoué. Vérifiez votre connexion.",
+ "dnsBlocked": "Le DNS ne résout pas openwhispr.com — un bloqueur de publicités ou un filtre le bloque peut-être.",
+ "refused": "La connexion a été refusée — probablement un pare-feu ou un VPN.",
+ "timeout": "Délai réseau dépassé — VPN, portail captif ou connexion instable.",
+ "tls": "Échec du handshake TLS — vérifiez l'horloge système ou un proxy d'entreprise.",
+ "fallback": "Cloud injoignable — utilisation du moteur local pour cet enregistrement."
+ }
}
},
"controlPanel": {
@@ -408,6 +427,11 @@
"noAudio": {
"title": "Aucun audio détecté",
"description": "L'enregistrement ne contient pas d'audio détectable. Réessayez."
+ },
+ "errorDescriptions": {
+ "sessionExpired": "Votre session OpenWhispr Cloud est indisponible. Reconnectez-vous depuis Paramètres.",
+ "offline": "Vous êtes hors ligne. La transcription cloud nécessite une connexion Internet.",
+ "dailyLimitReached": "Vous avez atteint votre limite de transcription du jour. Réessayez demain ou améliorez votre forfait."
}
},
"clipboard": {
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index 6e30346cd..f7bfb17a6 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -206,6 +206,25 @@
"hotkeyToStartStop": "{{hotkey}} per avviare/fermare",
"holdHotkey": "Tieni premuto {{hotkey}}",
"textareaPlaceholder": "Clicca qui e usa la scorciatoia per dettare..."
+ },
+ "connectivity": {
+ "title": "Non riusciamo a raggiungere OpenWhispr Cloud da questa rete",
+ "body": "{{cause}} Puoi passare al motore locale o continuare e riprovare più tardi.",
+ "useLocal": "Usa motore locale",
+ "continue": "Continua comunque"
+ }
+ },
+ "streaming": {
+ "errors": {
+ "cloudUnreachable": {
+ "title": "Impossibile raggiungere OpenWhispr Cloud",
+ "generic": "La richiesta di rete è fallita. Controlla la connessione.",
+ "dnsBlocked": "Il DNS non risolve openwhispr.com — potrebbe esserci un ad blocker o un filtro.",
+ "refused": "Connessione rifiutata — probabilmente un firewall o una VPN.",
+ "timeout": "Timeout di rete — VPN, captive portal o connessione instabile.",
+ "tls": "Handshake TLS fallito — controlla l'orologio di sistema o un proxy aziendale.",
+ "fallback": "Cloud non raggiungibile — uso del motore locale per questa registrazione."
+ }
}
},
"controlPanel": {
@@ -408,6 +427,11 @@
"noAudio": {
"title": "Nessun audio rilevato",
"description": "La registrazione non contiene audio rilevabile. Riprova."
+ },
+ "errorDescriptions": {
+ "sessionExpired": "La tua sessione OpenWhispr Cloud non è disponibile. Effettua di nuovo l'accesso dalle Impostazioni.",
+ "offline": "Sei offline. La trascrizione cloud richiede una connessione Internet.",
+ "dailyLimitReached": "Hai raggiunto il limite di trascrizioni di oggi. Riprova domani o aggiorna il tuo piano."
}
},
"clipboard": {
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index d650f02f8..cb9eec17d 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -206,6 +206,25 @@
"hotkeyToStartStop": "{{hotkey}} で開始/停止",
"holdHotkey": "{{hotkey}} を押し続ける",
"textareaPlaceholder": "ここをクリックしてホットキーでディクテーション..."
+ },
+ "connectivity": {
+ "title": "このネットワークから OpenWhispr Cloud に接続できません",
+ "body": "{{cause}} ローカルエンジンに切り替えるか、続行して後でもう一度お試しください。",
+ "useLocal": "ローカルエンジンを使う",
+ "continue": "そのまま続行"
+ }
+ },
+ "streaming": {
+ "errors": {
+ "cloudUnreachable": {
+ "title": "OpenWhispr Cloud に接続できません",
+ "generic": "ネットワーク要求に失敗しました。接続を確認してください。",
+ "dnsBlocked": "DNS が the server を解決できません — 広告ブロッカーやフィルターに遮断されている可能性があります。",
+ "refused": "接続が拒否されました — ファイアウォールまたは VPN の可能性があります。",
+ "timeout": "ネットワークがタイムアウトしました — VPN、キャプティブポータル、または不安定な接続。",
+ "tls": "TLS ハンドシェイクに失敗しました — システム時計または企業プロキシを確認してください。",
+ "fallback": "Cloud に接続できません — この録音にはローカルエンジンを使用します。"
+ }
}
},
"controlPanel": {
@@ -408,6 +427,11 @@
"noAudio": {
"title": "音声が検出されませんでした",
"description": "録音に音声が含まれていませんでした。もう一度お試しください。"
+ },
+ "errorDescriptions": {
+ "sessionExpired": "OpenWhispr Cloud のセッションが利用できません。「設定」から再度サインインしてください。",
+ "offline": "オフラインです。クラウド文字起こしにはインターネット接続が必要です。",
+ "dailyLimitReached": "本日の文字起こし上限に達しました。明日もう一度お試しいただくか、プランをアップグレードしてください。"
}
},
"clipboard": {
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index 60593afc6..0c2573a50 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -178,6 +178,25 @@
"hotkeyToStartStop": "{{hotkey}} para iniciar/parar",
"holdHotkey": "Segure {{hotkey}}",
"textareaPlaceholder": "Clique aqui e use seu atalho para ditar..."
+ },
+ "connectivity": {
+ "title": "Não conseguimos acessar o OpenWhispr Cloud nesta rede",
+ "body": "{{cause}} Você pode mudar para o motor local ou continuar e tentar de novo depois.",
+ "useLocal": "Usar motor local",
+ "continue": "Continuar mesmo assim"
+ }
+ },
+ "streaming": {
+ "errors": {
+ "cloudUnreachable": {
+ "title": "Não foi possível acessar o OpenWhispr Cloud",
+ "generic": "A solicitação de rede falhou. Verifique sua conexão.",
+ "dnsBlocked": "O DNS não está resolvendo openwhispr.com — pode ser um bloqueador de anúncios ou filtro.",
+ "refused": "A conexão foi recusada — provavelmente um firewall ou VPN.",
+ "timeout": "Tempo limite da rede esgotado — VPN, portal cativo ou conexão instável.",
+ "tls": "Falha no handshake TLS — verifique o relógio do sistema ou um proxy corporativo.",
+ "fallback": "Cloud indisponível — usando o motor local para esta gravação."
+ }
}
},
"controlPanel": {
@@ -380,6 +399,11 @@
"noAudio": {
"title": "Nenhum áudio detectado",
"description": "A gravação não contém áudio detectável. Tente novamente."
+ },
+ "errorDescriptions": {
+ "sessionExpired": "Sua sessão do OpenWhispr Cloud está indisponível. Entre novamente nas Configurações.",
+ "offline": "Você está offline. A transcrição na nuvem exige conexão com a internet.",
+ "dailyLimitReached": "Você atingiu o limite de transcrições de hoje. Tente novamente amanhã ou faça upgrade do seu plano."
}
},
"clipboard": {
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index 168e53d90..c17c1c982 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -206,6 +206,25 @@
"hotkeyToStartStop": "{{hotkey}} для старта/остановки",
"holdHotkey": "Удерживайте {{hotkey}}",
"textareaPlaceholder": "Нажмите сюда и используйте горячую клавишу для диктовки..."
+ },
+ "connectivity": {
+ "title": "Не удаётся подключиться к OpenWhispr Cloud из этой сети",
+ "body": "{{cause}} Вы можете переключиться на локальный движок или продолжить и повторить попытку позже.",
+ "useLocal": "Использовать локальный движок",
+ "continue": "Продолжить всё равно"
+ }
+ },
+ "streaming": {
+ "errors": {
+ "cloudUnreachable": {
+ "title": "Не удаётся подключиться к OpenWhispr Cloud",
+ "generic": "Сетевой запрос не выполнен. Проверьте подключение.",
+ "dnsBlocked": "DNS не разрешает openwhispr.com — возможно, его блокирует блокировщик рекламы или фильтр.",
+ "refused": "Соединение отклонено — вероятно, межсетевой экран или VPN.",
+ "timeout": "Тайм-аут сети — VPN, captive-портал или нестабильное соединение.",
+ "tls": "Сбой TLS-рукопожатия — проверьте системные часы или корпоративный прокси.",
+ "fallback": "Облако недоступно — используется локальный движок для этой записи."
+ }
}
},
"controlPanel": {
@@ -408,6 +427,11 @@
"noAudio": {
"title": "Звук не обнаружен",
"description": "В записи не обнаружен звук. Попробуйте ещё раз."
+ },
+ "errorDescriptions": {
+ "sessionExpired": "Сессия OpenWhispr Cloud недоступна. Войдите снова из Настроек.",
+ "offline": "Вы офлайн. Облачная транскрипция требует подключения к интернету.",
+ "dailyLimitReached": "Достигнут дневной лимит транскрипций. Попробуйте завтра или обновите тариф."
}
},
"clipboard": {
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index f210f541e..cac782182 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -206,6 +206,25 @@
"hotkeyToStartStop": "{{hotkey}} 开始/停止",
"holdHotkey": "按住 {{hotkey}}",
"textareaPlaceholder": "点击此处,然后使用快捷键进行听写..."
+ },
+ "connectivity": {
+ "title": "无法从该网络连接到 OpenWhispr Cloud",
+ "body": "{{cause}} 你可以切换到本地引擎,或继续并稍后重试。",
+ "useLocal": "使用本地引擎",
+ "continue": "仍然继续"
+ }
+ },
+ "streaming": {
+ "errors": {
+ "cloudUnreachable": {
+ "title": "无法连接到 OpenWhispr Cloud",
+ "generic": "网络请求失败,请检查你的连接。",
+ "dnsBlocked": "DNS 无法解析 openwhispr.com — 广告拦截器或过滤器可能阻止了它。",
+ "refused": "连接被拒绝 — 可能是防火墙或 VPN。",
+ "timeout": "网络超时 — VPN、强制门户或网络不稳定。",
+ "tls": "TLS 握手失败 — 请检查系统时钟或企业代理。",
+ "fallback": "Cloud 不可用 — 本次录音将使用本地引擎。"
+ }
}
},
"controlPanel": {
@@ -408,6 +427,11 @@
"noAudio": {
"title": "未检测到音频",
"description": "录音中未检测到音频,请重试。"
+ },
+ "errorDescriptions": {
+ "sessionExpired": "OpenWhispr Cloud 会话不可用。请到「设置」中重新登录。",
+ "offline": "你目前离线。云端转录需要互联网连接。",
+ "dailyLimitReached": "已达今日转录上限。请明天再试或升级你的套餐。"
}
},
"clipboard": {
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index 33d3bdb8f..1f64fb3f9 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -206,6 +206,25 @@
"hotkeyToStartStop": "{{hotkey}} 開始/停止",
"holdHotkey": "按住 {{hotkey}}",
"textareaPlaceholder": "點擊這裡,然後使用快捷鍵開始語音輸入..."
+ },
+ "connectivity": {
+ "title": "無法從此網路連線到 OpenWhispr Cloud",
+ "body": "{{cause}} 你可以切換到本機引擎,或繼續並稍後再試。",
+ "useLocal": "使用本機引擎",
+ "continue": "仍然繼續"
+ }
+ },
+ "streaming": {
+ "errors": {
+ "cloudUnreachable": {
+ "title": "無法連線到 OpenWhispr Cloud",
+ "generic": "網路請求失敗,請檢查你的連線。",
+ "dnsBlocked": "DNS 無法解析 openwhispr.com — 廣告封鎖器或過濾器可能阻擋了它。",
+ "refused": "連線被拒絕 — 可能是防火牆或 VPN。",
+ "timeout": "網路逾時 — VPN、強制入口頁或連線不穩定。",
+ "tls": "TLS 交握失敗 — 請檢查系統時鐘或企業 Proxy。",
+ "fallback": "Cloud 無法連線 — 本次錄音將使用本機引擎。"
+ }
}
},
"controlPanel": {
@@ -408,6 +427,11 @@
"noAudio": {
"title": "未偵測到音訊",
"description": "錄音中未偵測到聲音。請再試一次。"
+ },
+ "errorDescriptions": {
+ "sessionExpired": "OpenWhispr Cloud 工作階段無法使用。請至「設定」重新登入。",
+ "offline": "你目前離線。雲端轉錄需要網際網路連線。",
+ "dailyLimitReached": "已達今日的轉錄上限。請明天再試或升級你的方案。"
}
},
"clipboard": {
diff --git a/src/tsconfig.json b/src/tsconfig.json
index 84f8984eb..4e3de6645 100644
--- a/src/tsconfig.json
+++ b/src/tsconfig.json
@@ -16,8 +16,7 @@
"isolatedModules": true,
"paths": {
"@/*": ["./*"]
- },
- "baseUrl": "."
+ }
},
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
"exclude": ["node_modules", "dist"]
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 0358bb4fc..3fa84303e 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -1007,6 +1007,12 @@ declare global {
error?: string;
code?: string;
}>;
+ cloudHealthCheck?: () => Promise<{
+ ok: boolean;
+ status?: number;
+ code?: string;
+ messageKey?: string;
+ }>;
cloudUsage?: () => Promise<{
success: boolean;
wordsUsed?: number;
diff --git a/src/utils/recordingErrors.ts b/src/utils/recordingErrors.ts
index 48362f1ae..7ad3ac020 100644
--- a/src/utils/recordingErrors.ts
+++ b/src/utils/recordingErrors.ts
@@ -1,14 +1,24 @@
import { TFunction } from "i18next";
-export function getRecordingErrorTitle(
- error: { code?: string; title: string },
- t: TFunction
-): string {
- return error.code === "AUTH_EXPIRED"
- ? t("hooks.audioRecording.errorTitles.sessionExpired")
- : error.code === "OFFLINE"
- ? t("hooks.audioRecording.errorTitles.offline")
- : error.code === "LIMIT_REACHED"
- ? t("hooks.audioRecording.errorTitles.dailyLimitReached")
- : error.title;
+type RecordingError = {
+ code?: string;
+ title: string;
+ description?: string;
+ messageKey?: string;
+};
+
+export function getRecordingErrorTitle(error: RecordingError, t: TFunction): string {
+ if (error.code === "NETWORK_ERROR") return t(error.title);
+ if (error.code === "AUTH_EXPIRED" || error.code === "AUTH_REQUIRED") {
+ return t("hooks.audioRecording.errorTitles.sessionExpired");
+ }
+ if (error.code === "OFFLINE") return t("hooks.audioRecording.errorTitles.offline");
+ if (error.code === "LIMIT_REACHED")
+ return t("hooks.audioRecording.errorTitles.dailyLimitReached");
+ return error.title;
+}
+
+export function getRecordingErrorDescription(error: RecordingError, t: TFunction): string {
+ if (error.messageKey) return t(error.messageKey);
+ return error.description ?? "";
}