mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
83cd65ef63
- 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>
45 lines
1.2 KiB
TypeScript
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 };
|
|
};
|
|
|