From 1176050b033b875493845c3559683b5bd0587693 Mon Sep 17 00:00:00 2001 From: trueheads Date: Wed, 10 Dec 2025 14:01:16 -0600 Subject: [PATCH] Added status fetch to auth system in api-settings menu. Works after testing --- .gitignore | 2 + app/src/components/views/settings-view.tsx | 51 +++++++++++++++++++++- 2 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..b1470dff --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +#added by trueheads > will remove once supercombo adds multi-os support +launch.sh diff --git a/app/src/components/views/settings-view.tsx b/app/src/components/views/settings-view.tsx index b8c386b7..39555c19 100644 --- a/app/src/components/views/settings-view.tsx +++ b/app/src/components/views/settings-view.tsx @@ -41,6 +41,7 @@ import { Settings2, RefreshCw, Info, + RotateCcw, } from "lucide-react"; import { getElectronAPI } from "@/lib/electron"; import { Checkbox } from "@/components/ui/checkbox"; @@ -162,10 +163,13 @@ export function SettingsView() { hasOpenAIKey: boolean; hasGoogleKey: boolean; } | null>(null); + const [editingShortcut, setEditingShortcut] = useState(null); + const [shortcutValue, setShortcutValue] = useState(""); + const [shortcutError, setShortcutError] = useState(null); const scrollContainerRef = useRef(null); // Get authentication status from setup store - const { claudeAuthStatus, codexAuthStatus } = useSetupStore(); + const { claudeAuthStatus, codexAuthStatus, setClaudeAuthStatus, setCodexAuthStatus } = useSetupStore(); useEffect(() => { setAnthropicKey(apiKeys.anthropic); @@ -207,9 +211,52 @@ export function SettingsView() { console.error("Failed to check API key status:", error); } } + + // Check Claude auth status (re-fetch on mount to ensure persistence) + if (api?.setup?.getClaudeStatus) { + try { + const result = await api.setup.getClaudeStatus(); + if (result.success && result.auth) { + // Cast to any because runtime API returns more properties than type definition + const auth = result.auth as any; + const authStatus = { + authenticated: auth.authenticated, + method: auth.method === "oauth_token" + ? "oauth" + : auth.method?.includes("api_key") + ? "api_key" + : "none", + hasCredentialsFile: false, + oauthTokenValid: auth.hasStoredOAuthToken, + apiKeyValid: auth.hasStoredApiKey || auth.hasEnvApiKey, + }; + setClaudeAuthStatus(authStatus as any); + } + } catch (error) { + console.error("Failed to check Claude auth status:", error); + } + } + + // Check Codex auth status (re-fetch on mount to ensure persistence) + if (api?.setup?.getCodexStatus) { + try { + const result = await api.setup.getCodexStatus(); + if (result.success && result.auth) { + // Cast to any because runtime API returns more properties than type definition + const auth = result.auth as any; + setCodexAuthStatus({ + authenticated: auth.authenticated, + method: auth.hasEnvApiKey ? "env" : auth.hasStoredApiKey ? "api_key" : "none", + apiKeyValid: auth.hasStoredApiKey || auth.hasEnvApiKey, + }); + } + } catch (error) { + console.error("Failed to check Codex auth status:", error); + } + } }; checkCliStatus(); - }, []); + }, [setClaudeAuthStatus, setCodexAuthStatus]); // Track scroll position to highlight active nav item useEffect(() => {