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
feat: updated notarization config for distribution
Gabriel Steina4598a18741e
diff --git a/electron-builder.json b/electron-builder.jsonindex ab05be9b0..59ef22bdb 100644--- a/electron-builder.json+++ b/electron-builder.json@@ -35,15 +35,17 @@],"icon": "assets/icon.icns","gatekeeperAssess": false,+ "hardenedRuntime": true,"entitlements": "build/entitlements.mac.plist","entitlementsInherit": "build/entitlements.mac.plist",- "identity": "Developer ID Application: HeroTools Inc. (9R85XFMH59)",+ "identity": "HeroTools Inc. (9R85XFMH59)","extendInfo": {"LSUIElement": false,"NSMicrophoneUsageDescription": "OpenWispr needs microphone access for speech-to-text transcription.","NSAccessibilityUsageDescription": "OpenWispr needs accessibility permissions to paste transcribed text into other applications."}},+ "afterSign": "scripts/afterSign.js","win": {"target": ["nsis",diff --git a/package.json b/package.jsonindex 23459df49..94068ec14 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "open-wispr",- "version": "0.0.8-alpha",+ "version": "1.0.0","description": "A desktop dictation application using OpenAI Whisper for speech-to-text transcription","main": "main.js","private": true,@@ -33,6 +33,7 @@"author": "OpenWispr Team","license": "MIT","devDependencies": {+ "@electron/notarize": "^3.0.1","@esbuild/darwin-arm64": "^0.25.5","@eslint/js": "^9.25.0","@tailwindcss/vite": "^4.1.10",diff --git a/scripts/afterSign.js b/scripts/afterSign.jsnew file mode 100644index 000000000..5ab40acd0--- /dev/null+++ b/scripts/afterSign.js@@ -0,0 +1,64 @@+const { exec } = require('child_process');+const { promisify } = require('util');+const path = require('path');+const fs = require('fs').promises;++const execAsync = promisify(exec);++exports.default = async function(context) {+ const { electronPlatformName, appOutDir } = context;++ if (electronPlatformName !== 'darwin') {+ return;+ }++ const appName = context.packager.appInfo.productFilename;+ const appPath = path.join(appOutDir, `${appName}.app`);+ const entitlementsPath = path.join(__dirname, '..', 'build', 'entitlements.mac.plist');++ console.log('Starting custom signing process...');++ // List of binaries that need to be signed with hardened runtime+ const binariesToSign = [+ // ffmpeg-static binary+ 'Contents/Resources/app.asar.unpacked/node_modules/ffmpeg-static/ffmpeg',+ // Electron Framework libraries+ 'Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libEGL.dylib',+ 'Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libvk_swiftshader.dylib',+ 'Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib',+ 'Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib',+ // Squirrel ShipIt+ 'Contents/Frameworks/Squirrel.framework/Versions/A/Resources/ShipIt'+ ];++ // Sign each binary with hardened runtime and timestamp+ for (const binaryPath of binariesToSign) {+ const fullPath = path.join(appPath, binaryPath);++ try {+ // Check if file exists+ await fs.access(fullPath);++ console.log(`Signing: ${binaryPath}`);++ // Sign with hardened runtime, timestamp, and entitlements+ const signCommand = `codesign --force --deep --timestamp --options runtime --entitlements "${entitlementsPath}" --sign "Developer ID Application: HeroTools Inc. (9R85XFMH59)" "${fullPath}"`;++ await execAsync(signCommand);+ console.log(`✓ Signed: ${binaryPath}`);+ } catch (error) {+ console.warn(`Warning: Could not sign ${binaryPath}:`, error.message);+ }+ }++ // Finally, sign the entire app bundle again to ensure consistency+ console.log('Re-signing entire app bundle...');+ const appSignCommand = `codesign --force --deep --timestamp --options runtime --entitlements "${entitlementsPath}" --sign "Developer ID Application: HeroTools Inc. (9R85XFMH59)" "${appPath}"`;++ await execAsync(appSignCommand);+ console.log('✓ App bundle signed successfully');++ // Run the notarization script+ const notarizeScript = require('./notarize');+ return notarizeScript.default(context);+};\ No newline at end of filediff --git a/scripts/notarize.js b/scripts/notarize.jsnew file mode 100644index 000000000..9bd9104ef--- /dev/null+++ b/scripts/notarize.js@@ -0,0 +1,29 @@+const { notarize } = require('@electron/notarize');+const path = require('path');++exports.default = async function notarizing(context) {+ const { electronPlatformName, appOutDir } = context;++ if (electronPlatformName !== 'darwin') {+ return;+ }++ const appName = context.packager.appInfo.productFilename;+ const appPath = path.join(appOutDir, `${appName}.app`);++ console.log('Notarizing using keychain profile: openwispr-profile');+ console.log('Submitting app for notarization...');++ try {+ const result = await notarize({+ tool: 'notarytool',+ appPath,+ keychainProfile: 'openwispr-profile'+ });+ console.log('✓ Notarization completed successfully');+ return result;+ } catch (error) {+ console.error('Notarization failed:', error);+ throw error;+ }+};\ No newline at end of filediff --git a/src/helpers/whisper.js b/src/helpers/whisper.jsindex e0107c117..9b468d2c1 100644--- a/src/helpers/whisper.js+++ b/src/helpers/whisper.js@@ -258,17 +258,8 @@ class WhisperManager {for (const pythonPath of possiblePaths) {try {- const result = await new Promise((resolve, reject) => {- const testProcess = spawn(pythonPath, ["--version"]);- testProcess.on("close", (code) => {- resolve(code === 0);- });- testProcess.on("error", () => {- resolve(false);- });- });-- if (result) {+ const version = await this.getPythonVersion(pythonPath);+ if (this.isPythonVersionSupported(version)) {this.pythonCmd = pythonPath; // Cache the resultreturn pythonPath;}@@ -278,10 +269,35 @@ class WhisperManager {}throw new Error(- "Python executable not found. Please ensure Python 3 is installed."+ "Python 3.8-3.11 not found. Please ensure a compatible Python version is installed.");}+ async getPythonVersion(pythonPath) {+ return new Promise((resolve) => {+ const testProcess = spawn(pythonPath, ["--version"]);+ let output = "";++ testProcess.stdout.on("data", (data) => output += data);+ testProcess.stderr.on("data", (data) => output += data);++ testProcess.on("close", (code) => {+ if (code === 0) {+ const match = output.match(/Python (\d+)\.(\d+)/i);+ resolve(match ? { major: +match[1], minor: +match[2] } : null);+ } else {+ resolve(null);+ }+ });++ testProcess.on("error", () => resolve(null));+ });+ }++ isPythonVersionSupported(version) {+ return version && version.major === 3 && version.minor >= 8 && version.minor <= 11;+ }+async checkWhisperInstallation() {// Return cached result if availableif (this.whisperInstalled !== null) {@@ -381,9 +397,34 @@ class WhisperManager {}}+ async upgradePip(pythonCmd) {+ return new Promise((resolve) => {+ const upgradeProcess = spawn(pythonCmd, ["-m", "pip", "install", "--upgrade", "pip"]);++ const timeout = setTimeout(() => {+ upgradeProcess.kill("SIGTERM");+ resolve();+ }, 60000); // 1 minute timeout++ upgradeProcess.on("close", () => {+ clearTimeout(timeout);+ resolve();+ });++ upgradeProcess.on("error", () => {+ clearTimeout(timeout);+ resolve();+ });+ });+ }+async installWhisper() {try {const pythonCmd = await this.findPythonExecutable();++ // First upgrade pip to ensure compatibility+ await this.upgradePip(pythonCmd);+const args = ["-m", "pip", "install", "-U", "openai-whisper"];return new Promise((resolve, reject) => {@@ -410,9 +451,20 @@ class WhisperManager {} else {console.error("Whisper installation failed with code:", code);console.error("Installation stderr:", stderr);- reject(- new Error(`Whisper installation failed (code ${code}): ${stderr}`)- );++ let errorMessage = "Whisper installation failed";++ if (stderr.includes("pyproject.toml") && stderr.includes("TomlError")) {+ errorMessage = "Outdated pip version. Please upgrade pip manually and retry.";+ } else if (stderr.includes("No module named pip")) {+ errorMessage = "pip not installed.";+ } else if (stderr.includes("Permission denied")) {+ errorMessage = "Permission denied. May need administrator privileges.";+ } else if (stderr.includes("No matching distribution")) {+ errorMessage = "Incompatible Python version. Use Python 3.8-3.11.";+ }++ reject(new Error(errorMessage));}});