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(workspaces): shared plumbing — is_shared column, public API requests, error code passthrough, invitation deep-link queue
Gabriel Steind3d0a0c1817e
diff --git a/main.js b/main.jsindex dea8437c4..34bac8dd5 100644--- a/main.js+++ b/main.js@@ -524,24 +524,32 @@ app.on("open-url", (event, url) => {}});+// Deep links can arrive before windowManager exists (cold start) or before the+// renderer has mounted its listener. The token is stashed here and the renderer+// pulls it via `get-pending-invitation-token` on mount; the push below is a+// best-effort fast path for an already-running app.+let pendingInvitationDeepLinkToken = null;++ipcMain.handle("get-pending-invitation-token", () => {+ const token = pendingInvitationDeepLinkToken;+ pendingInvitationDeepLinkToken = null;+ return token;+});+function handleInvitationDeepLink(deepLinkUrl) {try {const match = deepLinkUrl.match(/invitations\/([^/?#]+)/);const token = match?.[1];if (!token) return;- if (windowManager && isLiveWindow(windowManager.controlPanelWindow)) {+ pendingInvitationDeepLinkToken = token;+ if (!windowManager) return;+ if (isLiveWindow(windowManager.controlPanelWindow)) {windowManager.controlPanelWindow.show();windowManager.controlPanelWindow.focus();windowManager.controlPanelWindow.webContents.send("workspace-invitation-token", token);- } else if (windowManager) {+ pendingInvitationDeepLinkToken = null;+ } else {windowManager.createControlPanelWindow();- // Defer the send until renderer is ready; main.js relies on `did-finish-load`- const win = windowManager.controlPanelWindow;- if (win) {- win.webContents.once("did-finish-load", () => {- win.webContents.send("workspace-invitation-token", token);- });- }}} catch (error) {console.error("Invitation deep link parse failed:", error);@@ -851,6 +859,21 @@ async function startApp() {await windowManager.createControlPanelWindow();}+ // Windows/Linux cold start delivers protocol URLs via argv (macOS uses+ // open-url); without this scan a deep link that launches the app is lost.+ if (process.platform !== "darwin") {+ const protocolArg = process.argv.find((arg) => arg.startsWith(`${OAUTH_PROTOCOL}://`));+ if (protocolArg) {+ if (protocolArg.includes("upgrade-success")) {+ handleUpgradeDeepLink();+ } else if (protocolArg.includes("/invitations/")) {+ handleInvitationDeepLink(protocolArg);+ } else {+ void handleOAuthDeepLink(protocolArg);+ }+ }+ }+// Create agent window (hidden) and set up agent hotkeyawait windowManager.createAgentWindow();diff --git a/preload.js b/preload.jsindex 6486d85f0..269b19395 100644--- a/preload.js+++ b/preload.js@@ -650,6 +650,7 @@ contextBridge.exposeInMainWorld("electronAPI", {"workspace-invitation-token",(callback) => (_event, token) => callback(token)),+ getPendingInvitationToken: () => ipcRenderer.invoke("get-pending-invitation-token"),// Globe key listener for hotkey capture (macOS only)onGlobeKeyPressed: (callback) => {diff --git a/src/helpers/database.js b/src/helpers/database.jsindex c5413c492..616411626 100644--- a/src/helpers/database.js+++ b/src/helpers/database.js@@ -476,6 +476,11 @@ class DatabaseManager {} catch (err) {if (!err.message.includes("duplicate column")) throw err;}+ try {+ this.db.exec("ALTER TABLE notes ADD COLUMN is_shared INTEGER NOT NULL DEFAULT 0");+ } catch (err) {+ if (!err.message.includes("duplicate column")) throw err;+ }// Sync columns for folderstry {@@ -1481,6 +1486,7 @@ class DatabaseManager {"deleted_at","client_note_id","cloud_id",+ "is_shared",];const fields = [];const values = [];diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex d52be59b7..c14de5d5c 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -6395,7 +6395,8 @@ class IPCHandlers {if (!apiUrl) throw new Error("OpenWhispr API URL not configured");const authHeader = await getAuthHeader(event);- if (!Object.keys(authHeader).length) throw new Error("Not authenticated");+ // Public endpoints (e.g. invitation previews) work without a session.+ if (!Object.keys(authHeader).length && !opts.public) throw new Error("Not authenticated");const method = (opts.method || "GET").toUpperCase();const sendWith = (header) => {@@ -6438,7 +6439,13 @@ class IPCHandlers {if (!response.ok) {const message = data?.error?.message || data?.error || `API error: ${response.status}`;- return { success: false, error: message, status: response.status };+ return {+ success: false,+ error: message,+ status: response.status,+ code: data?.code,+ details: data?.data,+ };}return { success: true, data };diff --git a/src/services/cloudApi.ts b/src/services/cloudApi.tsindex 5c87d5a53..f389d5a91 100644--- a/src/services/cloudApi.ts+++ b/src/services/cloudApi.ts@@ -6,29 +6,43 @@ interface CloudApiResponse<T = unknown> {status?: number;}+// Common `{ data: T }` envelope returned by the cloud API.+export interface DataWrap<T> {+ data: T;+}+export class CloudApiError extends Error {status: number;code?: string;- constructor(message: string, status: number, code?: string) {+ details?: unknown;+ constructor(message: string, status: number, code?: string, details?: unknown) {super(message);this.name = "CloudApiError";this.status = status;this.code = code;+ this.details = details;}}-async function cloudRequest<T = unknown>(method: string, path: string, body?: unknown): Promise<T> {+async function cloudRequest<T = unknown>(+ method: string,+ path: string,+ body?: unknown,+ isPublic?: boolean+): Promise<T> {const result = (await window.electronAPI?.cloudApiRequest?.({method,path,body,- })) as CloudApiResponse<T> | undefined;+ public: isPublic,+ })) as (CloudApiResponse<T> & { details?: unknown }) | undefined;if (!result?.success) {throw new CloudApiError(result?.error ?? "Cloud API request failed",result?.status ?? 0,- result?.code+ result?.code,+ result?.details);}@@ -39,6 +53,11 @@ export async function cloudGet<T = unknown>(path: string): Promise<T> {return cloudRequest<T>("GET", path);}+// For endpoints that work without a session (e.g. invitation previews).+export async function cloudGetPublic<T = unknown>(path: string): Promise<T> {+ return cloudRequest<T>("GET", path, undefined, true);+}+export async function cloudPost<T = unknown>(path: string, body?: unknown): Promise<T> {return cloudRequest<T>("POST", path, body);}diff --git a/src/types/electron.ts b/src/types/electron.tsindex 013e83129..cec8a13f4 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -56,6 +56,7 @@ export interface NoteItem {diarization_enabled: number | null;expected_speaker_count: number | null;cloud_id: string | null;+ is_shared: number;created_at: string;updated_at: string;client_note_id: string;@@ -1255,12 +1256,19 @@ declare global {error?: string;}>;- // Authenticated cloud API proxy- cloudApiRequest?: (opts: { method?: string; path: string; body?: unknown }) => Promise<{+ // Authenticated cloud API proxy (`public: true` skips the auth requirement)+ cloudApiRequest?: (opts: {+ method?: string;+ path: string;+ body?: unknown;+ public?: boolean;+ }) => Promise<{success: boolean;data?: unknown;error?: string;code?: string;+ status?: number;+ details?: unknown;}>;// Cloud audio file transcription@@ -1299,6 +1307,7 @@ declare global {// Workspace invitation deep linkonWorkspaceInvitationToken?: (callback: (token: string) => void) => () => void;+ getPendingInvitationToken?: () => Promise<string | null>;// AssemblyAI StreamingassemblyAiStreamingWarmup?: (options?: {