From 2734446d60c7f0c6ffa165aca17c6e2c376c5509 Mon Sep 17 00:00:00 2001 From: ACoolName Date: Tue, 28 May 2024 00:05:07 +0300 Subject: [PATCH] fixed commands not parsing --- servers/servers.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/servers/servers.go b/servers/servers.go index ea8c4a5..69a2379 100644 --- a/servers/servers.go +++ b/servers/servers.go @@ -499,7 +499,7 @@ func (con Connection) RunCommand(ctx *gin.Context) { type Commands struct { CommandType string `json:"CommandType"` - Arguments []any `json:"Arguments"` + Arguments [4]any `json:"Arguments"` } func (con Connection) AttachServer(ctx *gin.Context) { @@ -603,10 +603,10 @@ func (con Connection) AttachServer(ctx *gin.Context) { case "resize": log.Printf("Fake resize %dx%d", Command.Arguments[0].(uint), Command.Arguments[1].(uint)) - // err2 := con.dockerClient.ContainerResize(context.TODO(), containers[0].ID, container.ResizeOptions{Height: Command.Arguments[1].(uint), Width: Command.Arguments[0].(uint)}) - // if err2 != nil { - // log.Printf("Failed to resize container to %dx%d: %s", Command.Arguments[0].(uint), Command.Arguments[1].(uint), err) - // } + err2 := con.dockerClient.ContainerResize(context.TODO(), containers[0].ID, container.ResizeOptions{Height: Command.Arguments[1].(uint), Width: Command.Arguments[0].(uint)}) + if err2 != nil { + log.Printf("Failed to resize container to %dx%d: %s", Command.Arguments[0].(uint), Command.Arguments[1].(uint), err) + } // hijacked, err2 = con.dockerClient.ContainerAttach(context.TODO(), containers[0].ID, container.AttachOptions{Stream: true, Stdin: true, Stdout: true, Stderr: true}) // if err2 != nil {