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}
+        
+ )}
{">"}