Files
Netcatty/application/state/useApplicationBackend.ts
T
bincxz 83cd65ef63 feat: add default SSH key fallback and Windows SSH Agent status check
- Auto-discover and use default SSH keys (~/.ssh/id_ed25519, id_ecdsa, id_rsa) when no credentials configured
- Add Windows SSH Agent service status detection with UI warning
- Remove file extension filter on key import to allow any file type
- Unify Host Details panel card styles with consistent icons and titles

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-21 01:43:05 +08:00

45 lines
1.2 KiB
TypeScript

import { useCallback } from "react";
import { netcattyBridge } from "../../infrastructure/services/netcattyBridge";
export type ApplicationInfo = {
name: string;
version: string;
platform: string;
};
export type SshAgentStatus = {
running: boolean;
startupType: string | null;
error: string | null;
};
export const useApplicationBackend = () => {
const openExternal = useCallback(async (url: string) => {
try {
const bridge = netcattyBridge.get();
if (bridge?.openExternal) {
await bridge.openExternal(url);
return;
}
} catch {
// Ignore and fall back below
}
window.open(url, "_blank", "noopener,noreferrer");
}, []);
const getApplicationInfo = useCallback(async (): Promise<ApplicationInfo | null> => {
const bridge = netcattyBridge.get();
const info = await bridge?.getAppInfo?.();
return info ?? null;
}, []);
const checkSshAgent = useCallback(async (): Promise<SshAgentStatus | null> => {
const bridge = netcattyBridge.get();
const status = await bridge?.checkSshAgent?.();
return status ?? null;
}, []);
return { openExternal, getApplicationInfo, checkSshAgent };
};