mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-04 05:00:25 +08:00
修复创建网站时不启用访问日志导致Websocket、统计等选项失效的问题
This commit is contained in:
@@ -11,7 +11,6 @@ import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/nodes"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
|
||||
_ "github.com/TeaOSLab/EdgeAdmin/internal/web"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/nodeutils"
|
||||
_ "github.com/TeaOSLab/EdgeCommon/pkg/langs/messages"
|
||||
"github.com/iwind/TeaGo/Tea"
|
||||
_ "github.com/iwind/TeaGo/bootstrap"
|
||||
@@ -180,14 +179,6 @@ func main() {
|
||||
log.Println("restarting ...")
|
||||
app.RunRestart()
|
||||
})
|
||||
app.On("install-local-node", func() {
|
||||
err := nodeutils.InstallLocalNode()
|
||||
if err != nil {
|
||||
fmt.Println("[ERROR]" + err.Error())
|
||||
return
|
||||
}
|
||||
fmt.Println("success")
|
||||
})
|
||||
app.Run(func() {
|
||||
var adminNode = nodes.NewAdminNode()
|
||||
adminNode.Run()
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs"
|
||||
"github.com/iwind/TeaGo/actions"
|
||||
"github.com/iwind/TeaGo/logs"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
"strings"
|
||||
@@ -454,10 +453,11 @@ func (this *CreateAction) RunPost(params struct {
|
||||
|
||||
// 开启访问日志和Websocket
|
||||
if params.ServerType == serverconfigs.ServerTypeHTTPProxy {
|
||||
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), serverId)
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
} else {
|
||||
webConfig, findErr := dao.SharedHTTPWebDAO.FindWebConfigWithServerId(this.AdminContext(), serverId)
|
||||
if findErr != nil {
|
||||
this.ErrorPage(findErr)
|
||||
return
|
||||
}
|
||||
// 访问日志
|
||||
if params.AccessLogIsOn {
|
||||
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebAccessLog(this.AdminContext(), &pb.UpdateHTTPWebAccessLogRequest{
|
||||
@@ -479,7 +479,8 @@ func (this *CreateAction) RunPost(params struct {
|
||||
}`),
|
||||
})
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,8 +497,10 @@ func (this *CreateAction) RunPost(params struct {
|
||||
RequestOrigin: "",
|
||||
})
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
} else {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
|
||||
websocketId := createWebSocketResp.WebsocketId
|
||||
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebWebsocket(this.AdminContext(), &pb.UpdateHTTPWebWebsocketRequest{
|
||||
HttpWebId: webConfig.Id,
|
||||
@@ -508,8 +511,8 @@ func (this *CreateAction) RunPost(params struct {
|
||||
}`),
|
||||
})
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
}
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,6 +564,7 @@ func (this *CreateAction) RunPost(params struct {
|
||||
}
|
||||
|
||||
// remoteAddr
|
||||
{
|
||||
var remoteAddrConfig = &serverconfigs.HTTPRemoteAddrConfig{
|
||||
IsOn: true,
|
||||
Value: "${rawRemoteAddr}",
|
||||
@@ -583,6 +587,7 @@ func (this *CreateAction) RunPost(params struct {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 统计
|
||||
if params.StatIsOn {
|
||||
@@ -605,7 +610,6 @@ func (this *CreateAction) RunPost(params struct {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 创建日志
|
||||
defer this.CreateLogInfo(codes.Server_LogCreateServer, createResp.ServerId)
|
||||
|
||||
Reference in New Issue
Block a user