代码拉取完成,页面将自动刷新
package route
import (
"bytes"
"fmt"
"net/http"
"github.com/gin-gonic/gin"
)
func (server *Server) handleWSIndex(c *gin.Context) {
// c.Keys
// WebCtx
var (
containerID = c.Param("cid")
execID = c.Param("eid")
_foundExecID bool
)
if containerID == "" {
containerID, _foundExecID = server.getContainerID(execID)
if !_foundExecID {
c.String(http.StatusBadRequest, fmt.Sprintf("exec id %s not found", execID))
return
}
}
cInfo := server.containerCli.GetInfo(c.Request.Context(), containerID)
titleVars := server.titleVariables(
[]string{"server"},
map[string]map[string]interface{}{
"server": map[string]interface{}{
"containerName": cInfo.Name,
},
},
)
titleBuf := new(bytes.Buffer)
err := titleTemplate.Execute(titleBuf, titleVars)
if err != nil {
c.Error(err)
}
indexVars := map[string]interface{}{
"title": titleBuf.String(),
"ctx": WebCtx,
}
indexBuf := new(bytes.Buffer)
err = indexTemplate.Execute(indexBuf, indexVars)
if err != nil {
c.Error(err)
}
c.Writer.Write(indexBuf.Bytes())
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。