From 540f0a754decd9d38c0dfebbced670274f508256 Mon Sep 17 00:00:00 2001 From: Owen Date: Fri, 15 May 2026 16:11:23 -0700 Subject: [PATCH] Temp credential storage --- src/app/rdp/RdpClient.tsx | 29 ++++++++++++++++++++++------- src/app/ssh/SshClient.tsx | 19 +++++++++++++++---- src/app/vnc/VncClient.tsx | 17 +++++++++++++++-- 3 files changed, 52 insertions(+), 13 deletions(-) diff --git a/src/app/rdp/RdpClient.tsx b/src/app/rdp/RdpClient.tsx index adce7e44b..785387fad 100644 --- a/src/app/rdp/RdpClient.tsx +++ b/src/app/rdp/RdpClient.tsx @@ -62,13 +62,23 @@ export default function RdpClient({ target: Target | null; error: string | null; }) { - const [form, setForm] = useState({ - username: "", - password: "", - domain: "", - kdcProxyUrl: "", - pcb: "", - enableClipboard: true + const STORAGE_KEY = "pangolin_rdp_credentials"; + + const [form, setForm] = useState(() => { + try { + const saved = localStorage.getItem(STORAGE_KEY); + if (saved) return JSON.parse(saved) as FormState; + } catch { + // ignore + } + return { + username: "", + password: "", + domain: "", + kdcProxyUrl: "", + pcb: "", + enableClipboard: true + }; }); const [showLogin, setShowLogin] = useState(true); @@ -255,6 +265,11 @@ export default function RdpClient({ try { const sessionInfo = await userInteraction.connect(builder.build()); + try { + localStorage.setItem(STORAGE_KEY, JSON.stringify(form)); + } catch { + // ignore + } setConnecting(false); setShowLogin(false); userInteraction.setVisibility(true); diff --git a/src/app/ssh/SshClient.tsx b/src/app/ssh/SshClient.tsx index a84b1dacc..1fd388b47 100644 --- a/src/app/ssh/SshClient.tsx +++ b/src/app/ssh/SshClient.tsx @@ -26,10 +26,16 @@ export default function SshClient({ target: Target | null; error: string | null; }) { - const [form, setForm] = useState({ - username: "", - password: "", - privateKey: "" + const STORAGE_KEY = "pangolin_ssh_credentials"; + + const [form, setForm] = useState(() => { + try { + const saved = localStorage.getItem(STORAGE_KEY); + if (saved) return JSON.parse(saved) as FormState; + } catch { + // ignore + } + return { username: "", password: "", privateKey: "" }; }); const fileInputRef = useRef(null); @@ -172,6 +178,11 @@ export default function SshClient({ privateKey: form.privateKey }) ); + try { + localStorage.setItem(STORAGE_KEY, JSON.stringify(form)); + } catch { + // ignore + } setConnecting(false); setConnected(true); }; diff --git a/src/app/vnc/VncClient.tsx b/src/app/vnc/VncClient.tsx index 9df0d97b9..17593d6ba 100644 --- a/src/app/vnc/VncClient.tsx +++ b/src/app/vnc/VncClient.tsx @@ -23,8 +23,16 @@ export default function VncClient({ target: Target | null; error: string | null; }) { - const [form, setForm] = useState({ - password: "" + const STORAGE_KEY = "pangolin_vnc_credentials"; + + const [form, setForm] = useState(() => { + try { + const saved = localStorage.getItem(STORAGE_KEY); + if (saved) return JSON.parse(saved) as FormState; + } catch { + // ignore + } + return { password: "" }; }); const [connected, setConnected] = useState(false); @@ -111,6 +119,11 @@ export default function VncClient({ rfb.resizeSession = true; rfb.addEventListener("connect", () => { + try { + localStorage.setItem(STORAGE_KEY, JSON.stringify(form)); + } catch { + // ignore + } setConnected(true); });