fix: terminal input reaches the shell in the order it was typed

This commit is contained in:
redtea committed 2026-10-14 15:18:14 +03:00
1 parent cb2673d941
commit 225b7ecfcc
3 files changed
+56 -7

No files matched your search

+7
View File
@@ -49,6 +49,9 @@ type panelInMsg struct {
D string `json:"d,omitempty"`
Cols uint16 `json:"cols,omitempty"`
Rows uint16 `json:"rows,omitempty"`
// Seq numbers the messages of a session from 1; 0 from a page that
// predates it.
Seq uint64 `json:"seq,omitempty"`
}
// POST /api/panel/term/{sid}/in - send keystrokes/resize to the agent PTY.
@@ -63,6 +66,10 @@ func (s *Server) handlePanelIn(w http.ResponseWriter, r *http.Request) {
http.Error(w, "bad request", http.StatusBadRequest)
return
}
if m.Seq > 0 && !sess.TakeSeq(m.Seq) {
w.WriteHeader(http.StatusNoContent) // a repeat of one already taken
return
}
switch m.T {
case "i":
sess.PushIn(proto.InFrame{Type: proto.FrameStdin, Data: m.D})