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: bundled binaries missing from app.asar.unpacked break Windows local transcription (#1124)
Gabriel Stein7d1674cab809
diff --git a/electron-builder.json b/electron-builder.jsonindex 7bc7ac314..706d00fd9 100644--- a/electron-builder.json+++ b/electron-builder.json@@ -87,6 +87,7 @@],"asarUnpack": ["**/node_modules/ffmpeg-static/**/*",+ "**/node_modules/ps-list/**/*","**/node_modules/better-sqlite3/**/*","**/node_modules/onnxruntime-node/**/*","**/node_modules/@napi-rs/keyring/**/*",diff --git a/scripts/afterPack.js b/scripts/afterPack.jsindex c98b37ac4..8ef405e8e 100644--- a/scripts/afterPack.js+++ b/scripts/afterPack.js@@ -10,6 +10,8 @@// user flags from ~/.config/open-whispr-flags.conf, and falls back to// --no-sandbox where the Chromium sandbox cannot work (AppImage/tar.gz// on distros that restrict unprivileged user namespaces).+// 3. Fails the build if required binaries (ffmpeg-static, ps-list vendor exe)+// are missing from app.asar.unpacked/.const fs = require("fs");const path = require("path");@@ -200,6 +202,43 @@ function verifyMeetingAecHelper(context) {}}+function verifyUnpackedBinaries(context) {+ const unpackedModulesDir = path.join(+ resolveResourcesDir(context),+ "app.asar.unpacked",+ "node_modules"+ );++ const isWindows = context.electronPlatformName === "win32";++ const ffmpegPath = path.join(+ unpackedModulesDir,+ "ffmpeg-static",+ isWindows ? "ffmpeg.exe" : "ffmpeg"+ );+ if (!fs.existsSync(ffmpegPath)) {+ throw new Error(+ `afterPack: missing ${ffmpegPath} — ffmpeg-static was not unpacked from app.asar (asarUnpack/packaging failure); the packed app cannot spawn FFmpeg`+ );+ }++ // electron-builder strips *.exe from node_modules on non-Windows targets,+ // so the ps-list vendor executable only exists in Windows builds.+ if (isWindows) {+ const psListVendorDir = path.join(unpackedModulesDir, "ps-list", "vendor");+ const hasFastlist =+ fs.existsSync(psListVendorDir) &&+ fs.readdirSync(psListVendorDir).some((name) => /^fastlist-.*\.exe$/.test(name));+ if (!hasFastlist) {+ throw new Error(+ `afterPack: no fastlist-*.exe in ${psListVendorDir} — ps-list vendor executable was not unpacked from app.asar (asarUnpack/packaging failure); Windows process detection would break`+ );+ }+ }++ console.log(" afterPack: verified unpacked bundled binaries");+}+// ---------------------------------------------------------------------------// Main hook// ---------------------------------------------------------------------------@@ -208,5 +247,6 @@ exports.default = async function (context) {stripOnnxruntimeBinaries(context);wrapLinuxBinary(context);verifyMeetingAecHelper(context);+ verifyUnpackedBinaries(context);registerMacResourceBinariesForSigning(context);};diff --git a/src/helpers/ffmpegUtils.js b/src/helpers/ffmpegUtils.jsindex f6d1c38e0..2800d7d47 100644--- a/src/helpers/ffmpegUtils.js+++ b/src/helpers/ffmpegUtils.js@@ -37,8 +37,9 @@ function getFFmpegPath() {return unpackedPath;}- // Try original path (development or if not in ASAR)- if (fs.existsSync(ffmpegPath)) {+ // Try original path (development or if not in ASAR). An in-asar path passes+ // existsSync but can never be spawned, so fall through to system FFmpeg instead.+ if (!unpackedPath && fs.existsSync(ffmpegPath)) {if (process.platform !== "win32") {try {fs.accessSync(ffmpegPath, fs.constants.X_OK);@@ -113,7 +114,11 @@ function convertToWav(inputPath, outputPath, options = {}) {return new Promise((resolve, reject) => {const ffmpegPath = getFFmpegPath();if (!ffmpegPath) {- reject(new Error("FFmpeg not found - required for audio conversion"));+ reject(+ new Error(+ "FFmpeg not found - the bundled FFmpeg is missing from this install and no system FFmpeg was found on PATH; reinstalling OpenWhispr should fix this"+ )+ );return;}