added console size and removed resized feature

This commit is contained in:
ACoolName 2024-05-27 21:43:58 +03:00
parent 20ede52053
commit 1fedda4bf1

View File

@ -595,15 +595,7 @@ 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)
} else {
log.Printf("Resized terminal to %dx%d", Command.Arguments[0].(uint), Command.Arguments[1].(uint))
} }
}
case data := <-containerRead: case data := <-containerRead:
err := ws.WriteJSON(data) err := ws.WriteJSON(data)
if err != nil { if err != nil {
@ -730,6 +722,7 @@ func (con Connection) BrowseServer(ctx *gin.Context) {
&container.HostConfig{ &container.HostConfig{
Mounts: []mount.Mount{{Source: serverInfo.Id, Target: "/tmp/data", Type: "volume"}}, Mounts: []mount.Mount{{Source: serverInfo.Id, Target: "/tmp/data", Type: "volume"}},
AutoRemove: true, AutoRemove: true,
ConsoleSize: [2]uint{1000, 1000},
}, },
&network.NetworkingConfig{ &network.NetworkingConfig{
EndpointsConfig: map[string]*network.EndpointSettings{"test": { EndpointsConfig: map[string]*network.EndpointSettings{"test": {