From 70c988e7023d98657b04ee3b865bc452d0d0a2e3 Mon Sep 17 00:00:00 2001 From: Lemon-miaow Date: Wed, 23 Sep 2026 22:08:19 +0800 Subject: [PATCH] fix(panel): render the console command's reply (#57) sendCommand returns the RCON reply and the component's own contract says it "displays its plain-text reply", but the reply was discarded and the pod log does not echo command output, so a sent command produced no visible result at all (verified live with 'list'). The last command echo + reply now render above the prompt, terminal-style. --- panel/src/pages/ServerConsole.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/panel/src/pages/ServerConsole.tsx b/panel/src/pages/ServerConsole.tsx index be9a9ad..efd8725 100644 --- a/panel/src/pages/ServerConsole.tsx +++ b/panel/src/pages/ServerConsole.tsx @@ -93,6 +93,10 @@ function CommandInput({ name }: { name: string }) { const [command, setCommand] = useState(""); const [sending, setSending] = useState(false); const [err, setErr] = useState(null); + // The last command's echo + the server's reply, rendered above the prompt the + // way a terminal does. The reply IS the result of a write: RCON returns text + // only, so dropping it would leave the user with no way to see what happened. + const [last, setLast] = useState<{ cmd: string; out: string } | null>(null); const historyRef = useRef(loadHistory(name)); const cursorRef = useRef(-1); const inputRef = useRef(null); @@ -111,7 +115,8 @@ function CommandInput({ name }: { name: string }) { } cursorRef.current = h.length; try { - await api.sendCommand(name, text); + const res = await api.sendCommand(name, text); + setLast({ cmd: text, out: (res.output ?? "").trim() }); } catch (ex) { setErr(humanizeError(ex)); } finally { @@ -152,6 +157,12 @@ function CommandInput({ name }: { name: string }) { return (
+ {last && ( +
+          {"> " + last.cmd + "\n"}
+          {last.out}
+        
+ )}
{">"}