优化 Websocket 连接

This commit is contained in:
奶爸
2019-12-10 18:05:02 +08:00
parent 3c39e1537d
commit 7b5aae3e67
5 changed files with 9 additions and 7 deletions

View File

@@ -35,6 +35,7 @@ func (cp *commonPage) home(c *gin.Context) {
defer dao.ServerLock.RUnlock()
c.HTML(http.StatusOK, "page/home", mygin.CommonEnvironment(c, gin.H{
"Admin": admin,
"Domain": dao.Conf.Site.Domain,
"Servers": dao.ServerList,
}))
}

View File

@@ -13,7 +13,7 @@ import (
)
// ServeWeb ..
func ServeWeb() {
func ServeWeb(port uint) {
gin.SetMode(gin.ReleaseMode)
if dao.Conf.Debug {
gin.SetMode(gin.DebugMode)
@@ -43,7 +43,7 @@ func ServeWeb() {
r.Static("/static", "resource/static")
r.LoadHTMLGlob("resource/template/**/*")
routers(r)
r.Run()
r.Run(fmt.Sprintf(":%d", port))
}
func routers(r *gin.Engine) {