added resize
This commit is contained in:
parent
dd6be85005
commit
62516f66ce
@ -496,8 +496,8 @@ func (con Connection) RunCommand(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
type Commands struct {
|
||||
CommandType string `json:"CommandType"`
|
||||
Arguments []string `json:"Arguments"`
|
||||
CommandType string `json:"CommandType"`
|
||||
Arguments []any `json:"Arguments"`
|
||||
}
|
||||
|
||||
func (con Connection) AttachServer(ctx *gin.Context) {
|
||||
@ -581,7 +581,7 @@ func (con Connection) AttachServer(ctx *gin.Context) {
|
||||
case Command := <-websocketRead:
|
||||
switch Command.CommandType {
|
||||
case "insert":
|
||||
_, err = hijacked.Conn.Write([]byte(Command.Arguments[0]))
|
||||
_, err = hijacked.Conn.Write([]byte(Command.Arguments[0].(string)))
|
||||
if err != nil {
|
||||
stop = true
|
||||
break
|
||||
@ -589,6 +589,11 @@ func (con Connection) AttachServer(ctx *gin.Context) {
|
||||
|
||||
case "close":
|
||||
stop = true
|
||||
case "resize":
|
||||
err = con.dockerClient.ContainerResize(context.TODO(), containers[0].ID, container.ResizeOptions{Height: Command.Arguments[0].(uint), Width: Command.Arguments[1].(uint)})
|
||||
if err != nil {
|
||||
log.Printf("Failed to resize terminal to %dx%d: %s", Command.Arguments[0].(uint), Command.Arguments[1].(uint), err)
|
||||
}
|
||||
}
|
||||
|
||||
case data := <-containerRead:
|
||||
|
Loading…
x
Reference in New Issue
Block a user