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 {
|
type Commands struct {
|
||||||
CommandType string `json:"CommandType"`
|
CommandType string `json:"CommandType"`
|
||||||
Arguments []string `json:"Arguments"`
|
Arguments []any `json:"Arguments"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (con Connection) AttachServer(ctx *gin.Context) {
|
func (con Connection) AttachServer(ctx *gin.Context) {
|
||||||
@ -581,7 +581,7 @@ func (con Connection) AttachServer(ctx *gin.Context) {
|
|||||||
case Command := <-websocketRead:
|
case Command := <-websocketRead:
|
||||||
switch Command.CommandType {
|
switch Command.CommandType {
|
||||||
case "insert":
|
case "insert":
|
||||||
_, err = hijacked.Conn.Write([]byte(Command.Arguments[0]))
|
_, err = hijacked.Conn.Write([]byte(Command.Arguments[0].(string)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
stop = true
|
stop = true
|
||||||
break
|
break
|
||||||
@ -589,6 +589,11 @@ func (con Connection) AttachServer(ctx *gin.Context) {
|
|||||||
|
|
||||||
case "close":
|
case "close":
|
||||||
stop = true
|
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:
|
case data := <-containerRead:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user