Skip to content

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

feat(workspaces): wire openwhispr://invitations deep link and accept modal

Gabriel Stein98e33ba190be
diff --git a/main.js b/main.js
index 6346f0d83..f8dca3fe1 100644
--- a/main.js
+++ b/main.js
@@ -463,6 +463,11 @@ app.on("open-url", (event, url) => {
return;
}
+ if (url.includes("/invitations/")) {
+ handleInvitationDeepLink(url);
+ return;
+ }
+
void handleOAuthDeepLink(url);
if (windowManager && isLiveWindow(windowManager.controlPanelWindow)) {
@@ -471,6 +476,30 @@ app.on("open-url", (event, url) => {
}
});
+function handleInvitationDeepLink(deepLinkUrl) {
+ try {
+ const match = deepLinkUrl.match(/invitations\/([^/?#]+)/);
+ const token = match?.[1];
+ if (!token) return;
+ if (windowManager && isLiveWindow(windowManager.controlPanelWindow)) {
+ windowManager.controlPanelWindow.show();
+ windowManager.controlPanelWindow.focus();
+ windowManager.controlPanelWindow.webContents.send("workspace-invitation-token", token);
+ } else if (windowManager) {
+ 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);
+ }
+}
+
function resolveAuthUrl() {
const fs = require("fs");
const envPath = path.join(__dirname, "src", "dist", "runtime-env.json");
@@ -1452,6 +1481,8 @@ if (gotSingleInstanceLock) {
if (url) {
if (url.includes("upgrade-success")) {
handleUpgradeDeepLink();
+ } else if (url.includes("/invitations/")) {
+ handleInvitationDeepLink(url);
} else {
void handleOAuthDeepLink(url);
}
diff --git a/preload.js b/preload.js
index e2c7aab8e..f4b8714d5 100644
--- a/preload.js
+++ b/preload.js
@@ -600,6 +600,12 @@ contextBridge.exposeInMainWorld("electronAPI", {
notifyLimitReached: (data) => ipcRenderer.send("limit-reached", data),
onLimitReached: registerListener("limit-reached", (callback) => (_event, data) => callback(data)),
+ // Workspace invitation deep link
+ onWorkspaceInvitationToken: registerListener(
+ "workspace-invitation-token",
+ (callback) => (_event, token) => callback(token)
+ ),
+
// Globe key listener for hotkey capture (macOS only)
onGlobeKeyPressed: (callback) => {
const listener = () => callback?.();
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsx
index fd0ef3795..e65a5e4b9 100644
--- a/src/components/ControlPanel.tsx
+++ b/src/components/ControlPanel.tsx
@@ -42,6 +42,10 @@ import { fetchProviders as fetchStreamingProviders } from "../stores/streamingPr
import HistoryView from "./HistoryView";
import BackgroundActionToastListener from "./notes/BackgroundActionToastListener";
import { syncService } from "../services/SyncService.js";
+import AcceptInvitationModal, {
+ consumePendingInvitationToken,
+ clearPendingInvitationToken,
+} from "./AcceptInvitationModal";
const platform = getCachedPlatform();
@@ -68,6 +72,7 @@ export default function ControlPanel() {
() => localStorage.getItem("aiCTADismissed") === "true"
);
const [showReferrals, setShowReferrals] = useState(false);
+ const [invitationToken, setInvitationToken] = useState<string | null>(null);
const [showSearch, setShowSearch] = useState(false);
const [showCloudMigrationBanner, setShowCloudMigrationBanner] = useState(false);
const [activeView, setActiveView] = useState<ControlPanelView>("home");
@@ -238,6 +243,22 @@ export default function ControlPanel() {
});
}, [usage?.isPastDue, usage?.hasLoaded, toast, t]);
+ useEffect(() => {
+ const unsubscribe = window.electronAPI?.onWorkspaceInvitationToken?.((token) => {
+ setInvitationToken(token);
+ });
+ return () => unsubscribe?.();
+ }, []);
+
+ useEffect(() => {
+ if (!authLoaded || !isSignedIn) return;
+ const pending = consumePendingInvitationToken();
+ if (pending) {
+ setInvitationToken(pending);
+ clearPendingInvitationToken();
+ }
+ }, [authLoaded, isSignedIn]);
+
useEffect(() => {
if (!authLoaded || !isSignedIn || cloudMigrationProcessed.current) return;
const isPending = localStorage.getItem("pendingCloudMigration") === "true";
@@ -653,6 +674,15 @@ export default function ControlPanel() {
</Suspense>
)}
+ <AcceptInvitationModal
+ token={invitationToken}
+ onClose={() => setInvitationToken(null)}
+ isSignedIn={isSignedIn}
+ onSignIn={() => {
+ setInvitationToken(null);
+ }}
+ />
+
{showSearch && (
<Suspense fallback={null}>
<CommandSearch
diff --git a/src/types/electron.ts b/src/types/electron.ts
index f70b1f1b4..579de1dff 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -1214,6 +1214,9 @@ declare global {
callback: (data: { wordsUsed: number; limit: number }) => void
) => () => void;
+ // Workspace invitation deep link
+ onWorkspaceInvitationToken?: (callback: (token: string) => void) => () => void;
+
// AssemblyAI Streaming
assemblyAiStreamingWarmup?: (options?: {
sampleRate?: number;