Show connected clients and their last human action in Status
This commit is contained in:
@@ -232,7 +232,7 @@ func (s *Server) GetTaskTerminal(w http.ResponseWriter, r *http.Request, taskID
|
||||
defer cancel()
|
||||
go func() {
|
||||
defer cancel()
|
||||
terminalInput(ctx, conn, term)
|
||||
terminalInput(ctx, conn, term, func() { s.acted(actor(r), r) })
|
||||
}()
|
||||
|
||||
if len(backlog) > 0 {
|
||||
@@ -264,13 +264,14 @@ func (s *Server) GetTaskTerminal(w http.ResponseWriter, r *http.Request, taskID
|
||||
}
|
||||
}
|
||||
|
||||
func terminalInput(ctx context.Context, conn *websocket.Conn, term *terminal) {
|
||||
func terminalInput(ctx context.Context, conn *websocket.Conn, term *terminal, acted func()) {
|
||||
for {
|
||||
typ, b, err := conn.Read(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if typ == websocket.MessageBinary {
|
||||
acted()
|
||||
_, err = term.ptmx.Write(b)
|
||||
if err != nil {
|
||||
slog.Debug("terminal input", "err", err)
|
||||
|
||||
Reference in New Issue
Block a user