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: Add auth-aware routing to show re-authentication screen for signed-out returning users
Gabriel Stein95bb2815694a
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex 2fc202b2a..bb87efc27 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -904,10 +904,6 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPagesetIsSigningOut(true);try {await signOut();- // Clear onboarding to show auth screen again- localStorage.removeItem("onboardingCompleted");- localStorage.removeItem("onboardingCurrentStep");- // Reload the app to show onboarding/authwindow.location.reload();} catch (error) {logger.error("Sign out failed", error, "auth");@@ -1132,8 +1128,8 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage<ButtononClick={() => {localStorage.setItem("pendingCloudMigration", "true");- localStorage.removeItem("onboardingCompleted");localStorage.setItem("onboardingCurrentStep", "0");+ localStorage.removeItem("onboardingCompleted");window.location.reload();}}size="sm"diff --git a/src/helpers/hotkeyManager.js b/src/helpers/hotkeyManager.jsindex a3f5cc930..9a23f82d5 100644--- a/src/helpers/hotkeyManager.js+++ b/src/helpers/hotkeyManager.js@@ -238,9 +238,7 @@ class HotkeyManager {) {return;}- const prevAccel = previousHotkey.startsWith("Fn+")- ? previousHotkey.slice(3)- : previousHotkey;+ const prevAccel = previousHotkey.startsWith("Fn+") ? previousHotkey.slice(3) : previousHotkey;try {const restored = globalShortcut.register(prevAccel, callback);if (restored) {@@ -248,9 +246,7 @@ class HotkeyManager {`[HotkeyManager] Restored previous hotkey "${previousHotkey}" after failed registration`);} else {- debugLogger.warn(- `[HotkeyManager] Could not restore previous hotkey "${previousHotkey}"`- );+ debugLogger.warn(`[HotkeyManager] Could not restore previous hotkey "${previousHotkey}"`);}} catch (err) {debugLogger.warn(diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex 12caa69f5..9042db4eb 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -445,7 +445,10 @@ class IPCHandlers {const { isModifierOnlyHotkey, isRightSideModifier } = require("./hotkeyManager");const usesNativeListener = (hotkey) =>- !hotkey || hotkey === "GLOBE" || isModifierOnlyHotkey(hotkey) || isRightSideModifier(hotkey);+ !hotkey ||+ hotkey === "GLOBE" ||+ isModifierOnlyHotkey(hotkey) ||+ isRightSideModifier(hotkey);if (enabled) {// Entering capture mode - unregister globalShortcut so it doesn't consume key eventsdiff --git a/src/main.jsx b/src/main.jsxindex e6c35fa85..5e4aabc82 100644--- a/src/main.jsx+++ b/src/main.jsx@@ -3,9 +3,14 @@ import ReactDOM from "react-dom/client";import App from "./App.jsx";import ControlPanel from "./components/ControlPanel.tsx";import OnboardingFlow from "./components/OnboardingFlow.tsx";+import AuthenticationStep from "./components/AuthenticationStep.tsx";+import TitleBar from "./components/TitleBar.tsx";+import SupportDropdown from "./components/ui/SupportDropdown.tsx";+import { Card, CardContent } from "./components/ui/card.tsx";import ErrorBoundary from "./components/ErrorBoundary.tsx";import { ToastProvider } from "./components/ui/Toast.tsx";import { useTheme } from "./hooks/useTheme";+import { useAuth } from "./hooks/useAuth";import "./index.css";let root = null;@@ -256,38 +261,50 @@ if (!isOAuthBrowserRedirect()) {}function AppRouter() {- // Initialize theme systemuseTheme();+ const { isSignedIn, isLoaded: authLoaded } = useAuth();const [showOnboarding, setShowOnboarding] = useState(false);+ const [needsReauth, setNeedsReauth] = useState(false);const [isLoading, setIsLoading] = useState(true);- // Check if this is the control panel windowconst isControlPanel =window.location.pathname.includes("control") || window.location.search.includes("panel=true");-- // Check if this is the dictation panel (main app)const isDictationPanel = !isControlPanel;useEffect(() => {- // Check if onboarding has been completed+ if (!authLoaded) return;+const onboardingCompleted = localStorage.getItem("onboardingCompleted") === "true";- // Clamp step to valid range (0-5) for current 6-step onboarding- const rawStep = parseInt(localStorage.getItem("onboardingCurrentStep") || "0");- const currentStep = Math.max(0, Math.min(rawStep, 5));+ const authSkipped =+ localStorage.getItem("authenticationSkipped") === "true" ||+ localStorage.getItem("skipAuth") === "true";++ // Valid session proves prior onboarding — restore flag if localStorage was wiped+ if (!onboardingCompleted && isSignedIn) {+ localStorage.setItem("onboardingCompleted", "true");+ }- if (isControlPanel && !onboardingCompleted) {- // Show onboarding for control panel if not completed- setShowOnboarding(true);+ const resolved = localStorage.getItem("onboardingCompleted") === "true";++ if (isControlPanel) {+ if (!resolved) {+ setShowOnboarding(true);+ } else if (!isSignedIn && !authSkipped) {+ setNeedsReauth(true);+ }}- // Hide dictation panel window unless onboarding is complete or we're past the permissions step- if (isDictationPanel && !onboardingCompleted && currentStep < 4) {- window.electronAPI?.hideWindow?.();+ if (isDictationPanel && !resolved) {+ const rawStep = parseInt(localStorage.getItem("onboardingCurrentStep") || "0");+ const currentStep = Math.max(0, Math.min(rawStep, 5));+ if (currentStep < 4) {+ window.electronAPI?.hideWindow?.();+ }}setIsLoading(false);- }, [isControlPanel, isDictationPanel]);+ }, [isControlPanel, isDictationPanel, isSignedIn, authLoaded]);const handleOnboardingComplete = () => {setShowOnboarding(false);@@ -305,10 +322,46 @@ function AppRouter() {);}+ // First-time user: full onboarding wizardif (isControlPanel && showOnboarding) {return <OnboardingFlow onComplete={handleOnboardingComplete} />;}+ // Returning user needs to re-authenticate (signed out, setup already done)+ if (isControlPanel && needsReauth) {+ return (+ <div+ className="h-screen flex flex-col bg-background"+ style={{ paddingTop: "env(safe-area-inset-top, 0px)" }}+ >+ <div className="shrink-0 z-10">+ <TitleBar+ showTitle={true}+ className="bg-background backdrop-blur-xl border-b border-border shadow-sm"+ actions={<SupportDropdown />}+ />+ </div>+ <div className="flex-1 px-6 md:px-12 overflow-y-auto flex items-center">+ <div className="w-full max-w-sm mx-auto">+ <Card className="bg-card/90 backdrop-blur-2xl border border-border/50 dark:border-white/5 shadow-lg rounded-xl overflow-hidden">+ <CardContent className="p-6">+ <AuthenticationStep+ onContinueWithoutAccount={() => {+ localStorage.setItem("authenticationSkipped", "true");+ localStorage.setItem("skipAuth", "true");+ setNeedsReauth(false);+ }}+ onAuthComplete={() => setNeedsReauth(false)}+ onNeedsVerification={() => {}}+ />+ </CardContent>+ </Card>+ </div>+ </div>+ </div>+ );+ }+return isControlPanel ? <ControlPanel /> : <App />;}diff --git a/src/tsconfig.json b/src/tsconfig.jsonindex 0460fbd08..84f8984eb 100644--- a/src/tsconfig.json+++ b/src/tsconfig.json@@ -19,11 +19,6 @@},"baseUrl": "."},- "include": [- "**/*.ts",- "**/*.tsx",- "**/*.js",- "**/*.jsx"- ],+ "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],"exclude": ["node_modules", "dist"]}