mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 09:13:08 +00:00
Merge pull request #9 from AutoMaker-Org/feature/auth-status-fetch-fix
Added status fetch to auth system in api-settings menu. Works after t…
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#added by trueheads > will remove once supercombo adds multi-os support
|
||||||
|
launch.sh
|
||||||
@@ -41,6 +41,7 @@ import {
|
|||||||
Settings2,
|
Settings2,
|
||||||
RefreshCw,
|
RefreshCw,
|
||||||
Info,
|
Info,
|
||||||
|
RotateCcw,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { getElectronAPI } from "@/lib/electron";
|
import { getElectronAPI } from "@/lib/electron";
|
||||||
import { Checkbox } from "@/components/ui/checkbox";
|
import { Checkbox } from "@/components/ui/checkbox";
|
||||||
@@ -162,10 +163,13 @@ export function SettingsView() {
|
|||||||
hasOpenAIKey: boolean;
|
hasOpenAIKey: boolean;
|
||||||
hasGoogleKey: boolean;
|
hasGoogleKey: boolean;
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
|
const [editingShortcut, setEditingShortcut] = useState<string | null>(null);
|
||||||
|
const [shortcutValue, setShortcutValue] = useState("");
|
||||||
|
const [shortcutError, setShortcutError] = useState<string | null>(null);
|
||||||
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
// Get authentication status from setup store
|
// Get authentication status from setup store
|
||||||
const { claudeAuthStatus, codexAuthStatus } = useSetupStore();
|
const { claudeAuthStatus, codexAuthStatus, setClaudeAuthStatus, setCodexAuthStatus } = useSetupStore();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setAnthropicKey(apiKeys.anthropic);
|
setAnthropicKey(apiKeys.anthropic);
|
||||||
@@ -207,9 +211,52 @@ export function SettingsView() {
|
|||||||
console.error("Failed to check API key status:", error);
|
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();
|
checkCliStatus();
|
||||||
}, []);
|
}, [setClaudeAuthStatus, setCodexAuthStatus]);
|
||||||
|
|
||||||
// Track scroll position to highlight active nav item
|
// Track scroll position to highlight active nav item
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user