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: centralize duplicated error string
Chadpihaff3e529c2ca2
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.jsindex 99f88985a..bda7b0896 100644--- a/src/helpers/audioManager.js+++ b/src/helpers/audioManager.js@@ -39,7 +39,10 @@ import {getTranscriptionProviders,isOnlineParakeetModel,} from "../models/ModelRegistry";-import { isTinfoilInferenceUrl } from "../services/transcriptionBaseUrl";+import {+ TINFOIL_PROXY_REQUIRED_ERROR,+ isTinfoilInferenceUrl,+} from "../services/transcriptionBaseUrl";import { shouldSkipTranscriptionApiKey } from "./transcriptionAuth";import {isSelfHostedTranscription,@@ -2875,7 +2878,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);// Backstop against the OpenAI-default leak: Tinfoil goes through the main-process// proxy, never here — except self-hosted, which resolves its remote URL below.if (currentProvider === "tinfoil" && !isSelfHostedTranscription(s)) {- throw new Error("Tinfoil transcription must go through the attested main-process proxy");+ throw new Error(TINFOIL_PROXY_REQUIRED_ERROR);}const currentBaseUrl = s.cloudTranscriptionBaseUrl || "";@@ -2903,7 +2906,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);!isSelfHosted &&isTinfoilInferenceUrl(currentBaseUrl, getTranscriptionProviders())) {- throw new Error("Tinfoil transcription must go through the attested main-process proxy");+ throw new Error(TINFOIL_PROXY_REQUIRED_ERROR);}if (diff --git a/src/services/fileTranscription.ts b/src/services/fileTranscription.tsindex 8b326d7ab..af5b0d375 100644--- a/src/services/fileTranscription.ts+++ b/src/services/fileTranscription.ts@@ -1,6 +1,10 @@import { withSessionRefresh } from "../lib/auth";import { getTranscriptionProviders } from "../models/ModelRegistry";-import { isTinfoilInferenceUrl, resolveByokBaseUrl } from "./transcriptionBaseUrl";+import {+ TINFOIL_PROXY_REQUIRED_ERROR,+ isTinfoilInferenceUrl,+ resolveByokBaseUrl,+} from "./transcriptionBaseUrl";export interface FileTranscriptionResult {success: boolean;@@ -79,7 +83,7 @@ export async function transcribeFile(cfg.transcriptionMode !== "self-hosted" &&isTinfoilInferenceUrl(baseUrl, providers)) {- throw new Error("Tinfoil transcription must go through the attested main-process proxy");+ throw new Error(TINFOIL_PROXY_REQUIRED_ERROR);}// Self-hosted fields make the handler route to the configured serverdiff --git a/src/services/transcriptionBaseUrl.ts b/src/services/transcriptionBaseUrl.tsindex dffddf3c8..7e703ea44 100644--- a/src/services/transcriptionBaseUrl.ts+++ b/src/services/transcriptionBaseUrl.ts@@ -29,6 +29,11 @@ function parseHostname(url: string): string | null {return null;}+// Shared by every guard that refuses a direct Tinfoil endpoint, so the+// dictation and upload paths can't drift apart.+export const TINFOIL_PROXY_REQUIRED_ERROR =+ "Tinfoil transcription must go through the attested main-process proxy";+/*** True when a URL points at Tinfoil's inference host. Tinfoil audio must go* through the attested main-process proxy, so request paths use this to