部分中文转换为多语言代号

This commit is contained in:
GoEdgeLab
2023-06-30 18:08:30 +08:00
parent 4724f2ac96
commit 29f87ab9c4
322 changed files with 884 additions and 733 deletions

View File

@@ -7,6 +7,7 @@ import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/iwind/TeaGo/actions"
@@ -141,7 +142,7 @@ func (this *CreatePopupAction) RunPost(params struct {
this.ErrorPage(err)
return
}
defer this.CreateLogInfo("创建HTTP鉴权 %d", createResp.HttpAuthPolicyId)
defer this.CreateLogInfo(codes.HTTPAuthPolicy_LogCreateHTTPAuthPolicy, createResp.HttpAuthPolicyId)
ref.AuthPolicyId = createResp.HttpAuthPolicyId
ref.AuthPolicy = &serverconfigs.HTTPAuthPolicy{
Id: createResp.HttpAuthPolicyId,

View File

@@ -3,6 +3,7 @@ package access
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -62,7 +63,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的鉴权设置", params.WebId)
defer this.CreateLogInfo(codes.ServerAuth_LogUpdateHTTPAuthSettings, params.WebId)
var authConfig = &serverconfigs.HTTPAuthConfig{}
err := json.Unmarshal(params.AuthJSON, authConfig)

View File

@@ -7,6 +7,7 @@ import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/iwind/TeaGo/actions"
@@ -79,7 +80,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("修改HTTP鉴权 %d", params.PolicyId)
defer this.CreateLogInfo(codes.HTTPAuthPolicy_LogUpdateHTTPAuthPolicy, params.PolicyId)
policyResp, err := this.RPC().HTTPAuthPolicyRPC().FindEnabledHTTPAuthPolicy(this.AdminContext(), &pb.FindEnabledHTTPAuthPolicyRequest{HttpAuthPolicyId: params.PolicyId})
if err != nil {

View File

@@ -1,8 +1,7 @@
package accessLog
import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -56,7 +55,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "修改Web %d 的访问日志设置", params.WebId)
defer this.CreateLogInfo(codes.ServerAccessLog_LogUpdateAccessLogSetting, params.WebId)
// TODO 检查参数

View File

@@ -3,9 +3,9 @@
package cache
import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/cache/cacheutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -48,7 +48,7 @@ func (this *FetchAction) RunPost(params struct {
}) {
// 创建日志
defer this.CreateLog(oplogs.LevelInfo, "预热服务 %d 缓存", params.ServerId)
defer this.CreateLogInfo(codes.ServerCache_LogFetchCaches, params.ServerId)
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithId(this.AdminContext(), params.WebId)
if err != nil {

View File

@@ -2,8 +2,8 @@ package cache
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -70,7 +70,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "修改Web %d 的缓存设置", params.WebId)
defer this.CreateLogInfo(codes.ServerCache_LogUpdateCacheSettings, params.WebId)
// 校验配置
cacheConfig := &serverconfigs.HTTPCacheConfig{}

View File

@@ -2,10 +2,9 @@
package cache
import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/cache/cacheutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -49,7 +48,7 @@ func (this *PurgeAction) RunPost(params struct {
}) {
// 创建日志
defer this.CreateLog(oplogs.LevelInfo, "删除服务 %d 缓存", params.ServerId)
defer this.CreateLogInfo(codes.ServerCache_LogPurgeCaches, params.ServerId)
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithId(this.AdminContext(), params.WebId)
if err != nil {

View File

@@ -5,8 +5,8 @@ package cache
import (
"encoding/json"
"errors"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
)
@@ -20,7 +20,7 @@ func (this *UpdateRefsAction) RunPost(params struct {
RefsJSON []byte
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "修改Web %d 的缓存设置", params.WebId)
defer this.CreateLogInfo(codes.ServerCache_LogUpdateCacheSettings, params.WebId)
this.Data["isUpdated"] = false

View File

@@ -1,9 +1,8 @@
package charset
import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -54,7 +53,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLog(oplogs.LevelInfo, "修改Web %d 的字符集设置", params.WebId)
defer this.CreateLogInfo(codes.ServerCharset_LogUpdateCharsetSetting, params.WebId)
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebCharset(this.AdminContext(), &pb.UpdateHTTPWebCharsetRequest{
HttpWebId: params.WebId,

View File

@@ -4,6 +4,7 @@ package common
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -46,7 +47,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("修改服务Web %d 设置的其他设置", params.WebId)
defer this.CreateLogInfo(codes.ServerCommon_LogUpdateCommonSettings, params.WebId)
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebCommon(this.AdminContext(), &pb.UpdateHTTPWebCommonRequest{
HttpWebId: params.WebId,

View File

@@ -5,6 +5,7 @@ package compression
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -56,7 +57,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("修改Web %d 的压缩设置", params.WebId)
defer this.CreateLogInfo(codes.ServerCompression_LogUpdateCompressionSettings, params.WebId)
// 校验配置
var compressionConfig = &serverconfigs.HTTPCompressionConfig{}

View File

@@ -2,6 +2,7 @@ package dns
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
)
@@ -41,7 +42,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("修改服务 %d 的DNS设置", params.ServerId)
defer this.CreateLogInfo(codes.ServerDNS_LogUpdateDNSSettings, params.ServerId)
_, err := this.RPC().ServerRPC().UpdateServerDNS(this.AdminContext(), &pb.UpdateServerDNSRequest{
ServerId: params.ServerId,

View File

@@ -4,6 +4,7 @@ package dns
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
@@ -14,7 +15,7 @@ type RegenerateCNAMEAction struct {
func (this *RegenerateCNAMEAction) RunPost(params struct {
ServerId int64
}) {
defer this.CreateLogInfo("重新生成服务 %d 的CNAME", params.ServerId)
defer this.CreateLogInfo(codes.ServerDNS_LogRegenerateDNSName, params.ServerId)
_, err := this.RPC().ServerRPC().RegenerateServerDNSName(this.AdminContext(), &pb.RegenerateServerDNSNameRequest{ServerId: params.ServerId})
if err != nil {

View File

@@ -4,6 +4,7 @@ package dns
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/types"
"regexp"
@@ -33,7 +34,7 @@ func (this *UpdateCNAMEPopupAction) RunPost(params struct {
ServerId int64
DnsName string
}) {
defer this.CreateLogInfo("修改服务 %d CNAME为 %s", params.ServerId, params.DnsName)
defer this.CreateLogInfo(codes.ServerDNS_LogUpdateDNSName, params.ServerId, params.DnsName)
var dnsName = strings.ToLower(params.DnsName)
if len(dnsName) == 0 {

View File

@@ -5,6 +5,7 @@ package fastcgi
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -37,11 +38,7 @@ func (this *CreatePopupAction) RunPost(params struct {
}) {
var fastcgiId = int64(0)
defer func() {
if fastcgiId > 0 {
this.CreateLogInfo("创建Fastcgi %d", fastcgiId)
} else {
this.CreateLogInfo("创建Fastcgi")
}
this.CreateLogInfo(codes.HTTPFastcgi_LogCreateHTTPFastcgi, fastcgiId)
}()
params.Must.

View File

@@ -3,6 +3,7 @@ package fastcgi
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -41,7 +42,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的Fastcgi设置", params.WebId)
defer this.CreateLogInfo(codes.ServerFastcgi_LogUpdateHTTPFastcgi, params.WebId)
// TODO 检查配置

View File

@@ -5,6 +5,7 @@ package fastcgi
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -52,7 +53,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("修改Fastcgi %d", params.FastcgiId)
defer this.CreateLogInfo(codes.HTTPFastcgi_LogUpdateHTTPFastcgi, params.FastcgiId)
params.Must.
Field("address", params.Address).

View File

@@ -2,8 +2,8 @@ package headers
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
"github.com/iwind/TeaGo/actions"
@@ -34,7 +34,7 @@ func (this *CreateDeletePopupAction) RunPost(params struct {
Must *actions.Must
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "添加删除的Header HeaderPolicyId: %d, Name: %s", params.HeaderPolicyId, params.Name)
defer this.CreateLogInfo(codes.ServerHTTPHeader_LogCreateDeletingHeader, params.HeaderPolicyId, params.Name)
params.Must.
Field("name", params.Name).

View File

@@ -2,8 +2,8 @@ package headers
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
"github.com/iwind/TeaGo/actions"
@@ -34,7 +34,7 @@ func (this *CreateNonStandardPopupAction) RunPost(params struct {
Must *actions.Must
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "添加非标的Header HeaderPolicyId: %d, Name: %s", params.HeaderPolicyId, params.Name)
defer this.CreateLogInfo(codes.ServerHTTPHeader_LogCreateNonStandardHeader, params.HeaderPolicyId, params.Name)
params.Must.
Field("name", params.Name).

View File

@@ -2,8 +2,8 @@ package headers
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
"github.com/iwind/TeaGo/actions"
@@ -44,7 +44,7 @@ func (this *CreateSetPopupAction) RunPost(params struct {
Must *actions.Must
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "设置请求HeaderHeaderPolicyId:%d, Name:%s, Value:%s", params.HeaderPolicyId, params.Name, params.Value)
defer this.CreateLogInfo(codes.ServerHTTPHeader_LogCreateSettingHeader, params.HeaderPolicyId, params.Name, params.Value)
params.Name = strings.TrimSuffix(params.Name, ":")

View File

@@ -2,8 +2,8 @@ package headers
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
)
@@ -18,7 +18,7 @@ func (this *DeleteAction) RunPost(params struct {
Type string
HeaderId int64
}) {
defer this.CreateLog(oplogs.LevelInfo, "删除请求HeaderHeaderPolicyId:%d, HeaderId:%d", params.HeaderPolicyId, params.HeaderId)
defer this.CreateLogInfo(codes.ServerHTTPHeader_LogDeleteHeader, params.HeaderPolicyId, params.HeaderId)
policyConfigResp, err := this.RPC().HTTPHeaderPolicyRPC().FindEnabledHTTPHeaderPolicyConfig(this.AdminContext(), &pb.FindEnabledHTTPHeaderPolicyConfigRequest{
HttpHeaderPolicyId: params.HeaderPolicyId,

View File

@@ -2,8 +2,8 @@ package headers
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
)
@@ -17,7 +17,7 @@ func (this *DeleteDeletingHeaderAction) RunPost(params struct {
HeaderName string
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "删除需要删除的HeaderHeaderPolicyId:%d, HeaderName:%s", params.HeaderPolicyId, params.HeaderName)
defer this.CreateLogInfo(codes.ServerHTTPHeader_LogDeleteDeletingHeader, params.HeaderPolicyId, params.HeaderName)
policyConfigResp, err := this.RPC().HTTPHeaderPolicyRPC().FindEnabledHTTPHeaderPolicyConfig(this.AdminContext(), &pb.FindEnabledHTTPHeaderPolicyConfigRequest{HttpHeaderPolicyId: params.HeaderPolicyId})
if err != nil {

View File

@@ -2,8 +2,8 @@ package headers
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
)
@@ -17,7 +17,7 @@ func (this *DeleteNonStandardHeaderAction) RunPost(params struct {
HeaderName string
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "删除需要非标的HeaderHeaderPolicyId:%d, HeaderName:%s", params.HeaderPolicyId, params.HeaderName)
defer this.CreateLogInfo(codes.ServerHTTPHeader_LogDeleteNonStandardHeader, params.HeaderPolicyId, params.HeaderName)
policyConfigResp, err := this.RPC().HTTPHeaderPolicyRPC().FindEnabledHTTPHeaderPolicyConfig(this.AdminContext(), &pb.FindEnabledHTTPHeaderPolicyConfigRequest{HttpHeaderPolicyId: params.HeaderPolicyId})
if err != nil {

View File

@@ -2,8 +2,8 @@ package headers
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
"github.com/iwind/TeaGo/actions"
@@ -59,7 +59,7 @@ func (this *UpdateSetPopupAction) RunPost(params struct {
Must *actions.Must
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "修改设置请求HeaderHeaderPolicyId:%d, Name:%s, Value:%s", params.HeaderId, params.Name, params.Value)
defer this.CreateLogInfo(codes.ServerHTTPHeader_LogUpdateSettingHeader, params.HeaderId, params.Name, params.Value)
params.Name = strings.TrimSuffix(params.Name, ":")

View File

@@ -2,9 +2,9 @@ package http
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -91,7 +91,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
// 记录日志
defer this.CreateLog(oplogs.LevelInfo, "修改服务 %d 的HTTP设置", params.ServerId)
defer this.CreateLogInfo(codes.ServerHTTP_LogUpdateHTTPSettings, params.ServerId)
var addresses = []*serverconfigs.NetworkAddressConfig{}
err := json.Unmarshal([]byte(params.Addresses), &addresses)

View File

@@ -3,9 +3,9 @@ package https
import (
"encoding/json"
"errors"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs"
@@ -117,7 +117,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
// 记录日志
defer this.CreateLog(oplogs.LevelInfo, "修改服务 %d 的HTTPS设置", params.ServerId)
defer this.CreateLogInfo(codes.ServerHTTPS_LogUpdateHTTPSSettings, params.ServerId)
var addresses = []*serverconfigs.NetworkAddressConfig{}
err := json.Unmarshal([]byte(params.Addresses), &addresses)

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains/domainutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs"
@@ -113,7 +114,7 @@ func (this *RequestCertPopupAction) RunPost(params struct {
this.ErrorPage(err)
return
}
defer this.CreateLogInfo("创建ACME用户 %d", createUserResp.AcmeUserId)
defer this.CreateLogInfo(codes.ACMEUser_LogCreateACMEUser, createUserResp.AcmeUserId)
acmeUserId = createUserResp.AcmeUserId
this.Data["acmeUser"] = maps.Map{
@@ -139,7 +140,7 @@ func (this *RequestCertPopupAction) RunPost(params struct {
taskId := createTaskResp.AcmeTaskId
defer this.CreateLogInfo("自动申请证书,任务 %d", taskId)
defer this.CreateLogInfo(codes.ACMETask_LogRunACMETask, taskId)
runResp, err := this.RPC().ACMETaskRPC().RunACMETask(this.AdminContext(), &pb.RunACMETaskRequest{AcmeTaskId: taskId})
if err != nil {

View File

@@ -2,8 +2,8 @@ package settings
import (
"errors"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/iwind/TeaGo/actions"
@@ -136,7 +136,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
// 记录日志
defer this.CreateLog(oplogs.LevelInfo, "修改代理服务 %d 基本信息", params.ServerId)
defer this.CreateLogInfo(codes.Server_LogUpdateServerBasic, params.ServerId)
params.Must.
Field("name", params.Name).

View File

@@ -3,6 +3,7 @@ package access
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -62,7 +63,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的认证设置", params.WebId)
defer this.CreateLogInfo(codes.ServerAuth_LogUpdateHTTPAuthSettings, params.WebId)
var authConfig = &serverconfigs.HTTPAuthConfig{}
err := json.Unmarshal(params.AuthJSON, authConfig)

View File

@@ -2,6 +2,7 @@ package accessLog
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -40,7 +41,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的访问日志设置", params.WebId)
defer this.CreateLogInfo(codes.ServerAccessLog_LogUpdateAccessLogSetting, params.WebId)
// TODO 检查参数

View File

@@ -3,6 +3,7 @@ package cache
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -55,7 +56,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的缓存设置", params.WebId)
defer this.CreateLogInfo(codes.ServerCache_LogUpdateCacheSettings, params.WebId)
// 校验配置
cacheConfig := &serverconfigs.HTTPCacheConfig{}

View File

@@ -3,6 +3,7 @@ package charset
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -39,7 +40,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的字符集设置", params.WebId)
defer this.CreateLogInfo(codes.ServerCharset_LogUpdateCharsetSetting, params.WebId)
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebCharset(this.AdminContext(), &pb.UpdateHTTPWebCharsetRequest{
HttpWebId: params.WebId,

View File

@@ -5,6 +5,7 @@ package compression
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -42,7 +43,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("修改Web %d 的压缩设置", params.WebId)
defer this.CreateLogInfo(codes.ServerCompression_LogUpdateCompressionSettings, params.WebId)
// 校验配置
var compressionConfig = &serverconfigs.HTTPCompressionConfig{}

View File

@@ -3,6 +3,7 @@ package locations
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -55,7 +56,7 @@ func (this *CreateAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("创建路由规则:%s", params.Pattern)
defer this.CreateLogInfo(codes.HTTPLocation_LogCreateHTTPLocation, params.Pattern)
params.Must.
Field("pattern", params.Pattern).

View File

@@ -3,6 +3,7 @@ package fastcgi
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -40,7 +41,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的Fastcgi设置", params.WebId)
defer this.CreateLogInfo(codes.ServerFastcgi_LogUpdateHTTPFastcgi, params.WebId)
// TODO 检查配置

View File

@@ -3,6 +3,7 @@ package headers
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -102,7 +103,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的Header设置", params.WebId)
defer this.CreateLogInfo(codes.ServerHTTPHeader_LogUpdateHTTPHeaders, params.WebId)
// TODO 检查配置

View File

@@ -2,6 +2,7 @@ package http
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -35,7 +36,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的通用设置", params.WebId)
defer this.CreateLogInfo(codes.ServerRedirect_LogUpdateRedirects, params.WebId)
// 设置跳转到HTTPS
// TODO 校验设置

View File

@@ -3,6 +3,7 @@ package location
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -55,7 +56,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改路由规则 %d 设置", params.LocationId)
defer this.CreateLogInfo(codes.HTTPLocation_LogUpdateHTTPLocation, params.LocationId)
params.Must.
Field("pattern", params.Pattern).

View File

@@ -57,19 +57,19 @@ func (this *LocationHelper) BeforeAction(actionPtr actions.ActionWrapper) {
func (this *LocationHelper) createMenus(serverIdString string, locationIdString string, secondMenuItem string, locationConfig *serverconfigs.HTTPLocationConfig, actionPtr actions.ActionWrapper) []maps.Map {
menuItems := []maps.Map{}
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingBasic),
"name": this.Lang(actionPtr, codes.Server_MenuSettingBasic),
"url": "/servers/server/settings/locations/location?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "basic",
"isOff": locationConfig != nil && !locationConfig.IsOn,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingHTTP),
"name": this.Lang(actionPtr, codes.Server_MenuSettingHTTP),
"url": "/servers/server/settings/locations/http?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "http",
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.RedirectToHttps != nil && locationConfig.Web.RedirectToHttps.IsPrior,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingOrigins),
"name": this.Lang(actionPtr, codes.Server_MenuSettingOrigins),
"url": "/servers/server/settings/locations/reverseProxy?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "reverseProxy",
"isOn": locationConfig != nil && locationConfig.ReverseProxyRef != nil && locationConfig.ReverseProxyRef.IsPrior,
@@ -83,97 +83,97 @@ func (this *LocationHelper) createMenus(serverIdString string, locationIdString
"isActive": false,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingRewriteRules),
"name": this.Lang(actionPtr, codes.Server_MenuSettingRewriteRules),
"url": "/servers/server/settings/locations/rewrite?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "rewrite",
"isOn": locationConfig != nil && locationConfig.Web != nil && len(locationConfig.Web.RewriteRefs) > 0,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingWAF),
"name": this.Lang(actionPtr, codes.Server_MenuSettingWAF),
"url": "/servers/server/settings/locations/waf?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "waf",
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.FirewallRef != nil && locationConfig.Web.FirewallRef.IsPrior,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingCache),
"name": this.Lang(actionPtr, codes.Server_MenuSettingCache),
"url": "/servers/server/settings/locations/cache?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "cache",
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.Cache != nil && locationConfig.Web.Cache.IsPrior && locationConfig.Web.Cache.IsOn,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingAuth),
"name": this.Lang(actionPtr, codes.Server_MenuSettingAuth),
"url": "/servers/server/settings/locations/access?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "access",
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.Auth != nil && locationConfig.Web.Auth.IsPrior,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingReferers),
"name": this.Lang(actionPtr, codes.Server_MenuSettingReferers),
"url": "/servers/server/settings/locations/referers?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "referer",
"isOn": locationConfig.Web != nil && locationConfig.Web.Referers != nil && locationConfig.Web.Referers.IsPrior,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingUserAgents),
"name": this.Lang(actionPtr, codes.Server_MenuSettingUserAgents),
"url": "/servers/server/settings/locations/userAgent?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "userAgent",
"isOn": locationConfig.Web != nil && locationConfig.Web.UserAgent != nil && locationConfig.Web.UserAgent.IsPrior,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingCharset),
"name": this.Lang(actionPtr, codes.Server_MenuSettingCharset),
"url": "/servers/server/settings/locations/charset?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "charset",
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.Charset != nil && locationConfig.Web.Charset.IsPrior,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingAccessLog),
"name": this.Lang(actionPtr, codes.Server_MenuSettingAccessLog),
"url": "/servers/server/settings/locations/accessLog?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "accessLog",
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.AccessLogRef != nil && locationConfig.Web.AccessLogRef.IsPrior,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingStat),
"name": this.Lang(actionPtr, codes.Server_MenuSettingStat),
"url": "/servers/server/settings/locations/stat?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "stat",
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.StatRef != nil && locationConfig.Web.StatRef.IsPrior,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingCompress),
"name": this.Lang(actionPtr, codes.Server_MenuSettingCompress),
"url": "/servers/server/settings/locations/compression?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "compression",
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.Compression != nil && locationConfig.Web.Compression.IsPrior,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingPages),
"name": this.Lang(actionPtr, codes.Server_MenuSettingPages),
"url": "/servers/server/settings/locations/pages?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "pages",
"isOn": locationConfig != nil && locationConfig.Web != nil && (len(locationConfig.Web.Pages) > 0 || (locationConfig.Web.Shutdown != nil && locationConfig.Web.Shutdown.IsPrior)),
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingHTTPHeaders),
"name": this.Lang(actionPtr, codes.Server_MenuSettingHTTPHeaders),
"url": "/servers/server/settings/locations/headers?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "header",
"isOn": locationConfig != nil && this.hasHTTPHeaders(locationConfig.Web),
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingWebsocket),
"name": this.Lang(actionPtr, codes.Server_MenuSettingWebsocket),
"url": "/servers/server/settings/locations/websocket?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "websocket",
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.WebsocketRef != nil && locationConfig.Web.WebsocketRef.IsPrior,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingWebP),
"name": this.Lang(actionPtr, codes.Server_MenuSettingWebP),
"url": "/servers/server/settings/locations/webp?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "webp",
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.WebP != nil && locationConfig.Web.WebP.IsPrior,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingRoot),
"name": this.Lang(actionPtr, codes.Server_MenuSettingRoot),
"url": "/servers/server/settings/locations/web?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "web",
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.Root != nil && locationConfig.Web.Root.IsPrior,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingFastcgi),
"name": this.Lang(actionPtr, codes.Server_MenuSettingFastcgi),
"url": "/servers/server/settings/locations/fastcgi?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "fastcgi",
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.FastcgiRef != nil && locationConfig.Web.FastcgiRef.IsPrior,
@@ -188,14 +188,14 @@ func (this *LocationHelper) createMenus(serverIdString string, locationIdString
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingClientIP),
"name": this.Lang(actionPtr, codes.Server_MenuSettingClientIP),
"url": "/servers/server/settings/locations/remoteAddr?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "remoteAddr",
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.RemoteAddr != nil && locationConfig.Web.RemoteAddr.IsOn,
})
menuItems = append(menuItems, maps.Map{
"name": this.Lang(actionPtr, codes.AdminServerMenuSettingRequestLimit),
"name": this.Lang(actionPtr, codes.Server_MenuSettingRequestLimit),
"url": "/servers/server/settings/locations/requestLimit?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "requestLimit",
"isOn": locationConfig != nil && locationConfig.Web != nil && locationConfig.Web.RequestLimit != nil && locationConfig.Web.RequestLimit.IsOn,

View File

@@ -2,6 +2,7 @@ package pages
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -36,7 +37,7 @@ func (this *IndexAction) RunPost(params struct {
ShutdownJSON string
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的自定义页面设置", params.WebId)
defer this.CreateLogInfo(codes.ServerPage_LogUpdatePages, params.WebId)
// TODO 检查配置

View File

@@ -4,6 +4,7 @@ package referers
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -54,7 +55,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("修改Web %d 防盗链设置", params.WebId)
defer this.CreateLogInfo(codes.ServerReferer_LogUpdateReferers, params.WebId)
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebReferers(this.AdminContext(), &pb.UpdateHTTPWebReferersRequest{
HttpWebId: params.WebId,

View File

@@ -4,6 +4,7 @@ package requestlimit
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -40,7 +41,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("修改Web %d 请求限制", params.WebId)
defer this.CreateLogInfo(codes.ServerRequestLimit_LogUpdateRequestLimitSettings, params.WebId)
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebRequestLimit(this.AdminContext(), &pb.UpdateHTTPWebRequestLimitRequest{
HttpWebId: params.WebId,

View File

@@ -3,6 +3,7 @@ package reverseProxy
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/iwind/TeaGo/actions"
@@ -52,7 +53,7 @@ func (this *SettingAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改路由规则 %d 的反向代理设置", params.LocationId)
defer this.CreateLogInfo(codes.ServerReverseProxy_LogUpdateLocationReverseProxySettings, params.LocationId)
// TODO 校验配置

View File

@@ -2,6 +2,7 @@ package stat
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -35,7 +36,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的统计设置", params.WebId)
defer this.CreateLogInfo(codes.ServerStat_LogUpdateStatSettings, params.WebId)
// TODO 校验配置

View File

@@ -4,6 +4,7 @@ package userAgent
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -47,7 +48,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("修改Web %d User-Agent设置", params.WebId)
defer this.CreateLogInfo(codes.ServerUserAgent_LogUpdateUserAgents, params.WebId)
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebUserAgent(this.AdminContext(), &pb.UpdateHTTPWebUserAgentRequest{
HttpWebId: params.WebId,

View File

@@ -2,6 +2,7 @@ package waf
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
@@ -56,7 +57,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的WAF设置", params.WebId)
defer this.CreateLogInfo(codes.ServerWAF_LogUpdateWAFSettings, params.WebId)
// TODO 检查配置

View File

@@ -2,6 +2,7 @@ package web
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -35,7 +36,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的根目录等设置", params.WebId)
defer this.CreateLogInfo(codes.ServerRoot_LogUpdateRoot, params.WebId)
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWeb(this.AdminContext(), &pb.UpdateHTTPWebRequest{
HttpWebId: params.WebId,

View File

@@ -3,6 +3,7 @@ package websocket
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -40,7 +41,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的Websocket设置", params.WebId)
defer this.CreateLogInfo(codes.ServerWebsocket_LogUpdateWebsocketSettings, params.WebId)
// TODO 检查配置

View File

@@ -3,9 +3,9 @@ package origins
import (
"encoding/json"
"errors"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -315,7 +315,7 @@ func (this *AddPopupAction) RunPost(params struct {
}
// 日志
defer this.CreateLog(oplogs.LevelInfo, "为反向代理服务 %d 添加源站 %d", params.ReverseProxyId, originId)
defer this.CreateLogInfo(codes.ServerOrigin_LogCreateOrigin, originId)
this.Success()
}

View File

@@ -3,8 +3,8 @@ package origins
import (
"encoding/json"
"errors"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
)
@@ -83,7 +83,7 @@ func (this *DeleteAction) RunPost(params struct {
}
// 日志
defer this.CreateLog(oplogs.LevelInfo, "删除反向代理服务 %d 的源站 %d", params.ReverseProxyId, params.OriginId)
defer this.CreateLogInfo(codes.ServerOrigin_LogDeleteOrigin, params.OriginId)
this.Success()
}

View File

@@ -2,9 +2,9 @@ package origins
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -333,7 +333,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
}
// 日志
defer this.CreateLog(oplogs.LevelInfo, "修改反向代理服务 %d 的源站 %d", params.ReverseProxyId, params.OriginId)
defer this.CreateLogInfo(codes.ServerOrigin_LogUpdateOrigin, params.OriginId)
this.Success()
}

View File

@@ -2,8 +2,8 @@ package pages
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -80,7 +80,7 @@ func (this *CreatePopupAction) RunPost(params struct {
this.Data["page"] = pageConfig
// 日志
defer this.CreateLog(oplogs.LevelInfo, "创建自定义页面 %d", pageId)
defer this.CreateLogInfo(codes.ServerPage_LogCreatePage, pageId)
this.Success()
}

View File

@@ -1,8 +1,7 @@
package pages
import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -52,7 +51,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "修改Web %d 的设置", params.WebId)
defer this.CreateLogInfo(codes.ServerPage_LogUpdatePages, params.WebId)
// TODO 检查配置

View File

@@ -2,8 +2,8 @@ package pages
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -55,7 +55,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
Must *actions.Must
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "修改自定义页面 %d", params.PageId)
defer this.CreateLogInfo(codes.ServerPage_LogUpdatePage, params.PageId)
params.Must.
Field("status", params.Status).

View File

@@ -2,6 +2,7 @@ package redirects
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -39,7 +40,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的URL跳转设置", params.WebId)
defer this.CreateLogInfo(codes.ServerRedirect_LogUpdateRedirects, params.WebId)
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebHostRedirects(this.AdminContext(), &pb.UpdateHTTPWebHostRedirectsRequest{
HttpWebId: params.WebId,

View File

@@ -4,6 +4,7 @@ package referers
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -56,7 +57,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("修改Web %d 防盗链设置", params.WebId)
defer this.CreateLogInfo(codes.ServerReferer_LogUpdateReferers, params.WebId)
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebReferers(this.AdminContext(), &pb.UpdateHTTPWebReferersRequest{
HttpWebId: params.WebId,

View File

@@ -4,6 +4,7 @@ package requestlimit
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -54,7 +55,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("修改Web %d 请求限制", params.WebId)
defer this.CreateLogInfo(codes.ServerRequestLimit_LogUpdateRequestLimitSettings, params.WebId)
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebRequestLimit(this.AdminContext(), &pb.UpdateHTTPWebRequestLimitRequest{
HttpWebId: params.WebId,

View File

@@ -3,6 +3,7 @@ package reverseProxy
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -53,7 +54,7 @@ func (this *SettingAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改代理服务 %d 的反向代理设置", params.ServerId)
defer this.CreateLogInfo(codes.ServerReverseProxy_LogUpdateServerReverseProxySettings, params.ServerId)
var reverseProxyConfig = &serverconfigs.ReverseProxyConfig{}
err := json.Unmarshal(params.ReverseProxyJSON, reverseProxyConfig)

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/schedulingconfigs"
@@ -118,7 +119,7 @@ func (this *UpdateSchedulingPopupAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改反向代理 %d 负载均衡算法", params.ReverseProxyId)
defer this.CreateLogInfo(codes.ReverseProxy_LogUpdateReverseProxyScheduling, params.ReverseProxyId)
reverseProxyResp, err := this.RPC().ReverseProxyRPC().FindEnabledReverseProxyConfig(this.AdminContext(), &pb.FindEnabledReverseProxyConfigRequest{ReverseProxyId: params.ReverseProxyId})
if err != nil {

View File

@@ -3,6 +3,7 @@ package rewrite
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -117,7 +118,7 @@ func (this *CreatePopupAction) RunPost(params struct {
}
// 日志
defer this.CreateLogInfo("在Web %d 中创建重写规则 %d", params.WebId, createResp.RewriteRuleId)
defer this.CreateLogInfo(codes.HTTPRewriteRule_LogCreateRewriteRule, params.WebId, createResp.RewriteRuleId)
this.Success()
}

View File

@@ -3,6 +3,7 @@ package rewrite
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -16,7 +17,7 @@ func (this *DeleteAction) RunPost(params struct {
WebId int64
RewriteRuleId int64
}) {
defer this.CreateLogInfo("从Web %d 中删除重写规则 %d", params.WebId, params.RewriteRuleId)
defer this.CreateLogInfo(codes.HTTPRewriteRule_LogDeleteRewriteRule, params.WebId, params.RewriteRuleId)
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithId(this.AdminContext(), params.WebId)
if err != nil {

View File

@@ -3,6 +3,7 @@ package rewrite
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -16,7 +17,7 @@ func (this *SortAction) RunPost(params struct {
WebId int64
RewriteRuleIds []int64
}) {
defer this.CreateLogInfo("对Web %d 中的重写规则进行排序", params.WebId)
defer this.CreateLogInfo(codes.HTTPRewriteRule_LogSortRewriteRules, params.WebId)
webConfig, err := dao.SharedHTTPWebDAO.FindWebConfigWithId(this.AdminContext(), params.WebId)
if err != nil {

View File

@@ -3,6 +3,7 @@ package rewrite
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -62,7 +63,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 中的重写规则 %d", params.WebId, params.RewriteRuleId)
defer this.CreateLogInfo(codes.HTTPRewriteRule_LogUpdateRewriteRule, params.WebId, params.RewriteRuleId)
params.Must.
Field("pattern", params.Pattern).

View File

@@ -2,6 +2,7 @@ package serverNames
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
@@ -17,7 +18,7 @@ func (this *AuditAction) RunPost(params struct {
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("提交服务 %d 域名审核", params.ServerId)
defer this.CreateLogInfo(codes.Server_LogSubmitAuditingServer, params.ServerId)
if !params.AuditingOK && len(params.AuditingReason) == 0 {
this.FailField("auditingReason", "请输入审核不通过原因")

View File

@@ -2,8 +2,8 @@ package serverNames
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/iwind/TeaGo/actions"
@@ -88,7 +88,7 @@ func (this *IndexAction) RunPost(params struct {
CSRF *actionutils.CSRF
}) {
// 记录日志
defer this.CreateLog(oplogs.LevelInfo, "修改代理服务 %d 域名", params.ServerId)
defer this.CreateLogInfo(codes.Server_ServerNamesLogUpdateServerNames, params.ServerId)
serverNames := []*serverconfigs.ServerNameConfig{}
err := json.Unmarshal([]byte(params.ServerNames), &serverNames)

View File

@@ -2,6 +2,7 @@ package stat
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -49,7 +50,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的统计设置", params.WebId)
defer this.CreateLogInfo(codes.ServerStat_LogUpdateStatSettings, params.WebId)
// TODO 校验配置

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/iwind/TeaGo/actions"
@@ -49,7 +50,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改代理服务 %d TCP设置", params.ServerId)
defer this.CreateLogInfo(codes.ServerTCP_LogUpdateTCPSettings, params.ServerId)
server, _, isOk := serverutils.FindServer(this.Parent(), params.ServerId)
if !isOk {

View File

@@ -5,6 +5,7 @@ import (
"errors"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs"
@@ -81,7 +82,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改代理服务 %d TLS设置", params.ServerId)
defer this.CreateLogInfo(codes.ServerTLS_LogUpdateTLSSettings, params.ServerId)
server, _, isOk := serverutils.FindServer(this.Parent(), params.ServerId)
if !isOk {

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/iwind/TeaGo/actions"
@@ -49,7 +50,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改代理服务 %d UDP设置", params.ServerId)
defer this.CreateLogInfo(codes.NSCluster_LogUpdateNSClusterSettingsUDP, params.ServerId)
server, _, isOk := serverutils.FindServer(this.Parent(), params.ServerId)
if !isOk {

View File

@@ -4,6 +4,7 @@ package userAgent
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -49,7 +50,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("修改Web %d User-Agent设置", params.WebId)
defer this.CreateLogInfo(codes.ServerUserAgent_LogUpdateUserAgents, params.WebId)
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebUserAgent(this.AdminContext(), &pb.UpdateHTTPWebUserAgentRequest{
HttpWebId: params.WebId,

View File

@@ -2,6 +2,7 @@ package waf
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
@@ -81,7 +82,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的WAF设置", params.WebId)
defer this.CreateLogInfo(codes.ServerWAF_LogUpdateWAFSettings, params.WebId)
// TODO 检查配置

View File

@@ -2,8 +2,8 @@ package ipadmin
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
@@ -96,7 +96,7 @@ func (this *CountriesAction) RunPost(params struct {
Must *actions.Must
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "WAF策略 %d 设置禁止访问的国家和地区", params.FirewallPolicyId)
defer this.CreateLogInfo(codes.WAF_LogUpdateForbiddenCountries, params.FirewallPolicyId)
policyConfig, err := dao.SharedHTTPFirewallPolicyDAO.FindEnabledHTTPFirewallPolicyConfig(this.AdminContext(), params.FirewallPolicyId)
if err != nil {

View File

@@ -1,8 +1,7 @@
package ipadmin
import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
@@ -15,7 +14,7 @@ func (this *DeleteIPAction) RunPost(params struct {
ItemId int64
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "从WAF策略 %d 名单中删除IP %d", params.FirewallPolicyId, params.ItemId)
defer this.CreateLogInfo(codes.WAF_LogDeleteIPFromWAFPolicy, params.FirewallPolicyId, params.ItemId)
// TODO 判断权限

View File

@@ -2,8 +2,8 @@ package ipadmin
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
@@ -97,7 +97,7 @@ func (this *ProvincesAction) RunPost(params struct {
Must *actions.Must
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "WAF策略 %d 设置禁止访问的省份", params.FirewallPolicyId)
defer this.CreateLogInfo(codes.WAF_LogUpdateForbiddenProvinces, params.FirewallPolicyId)
policyConfig, err := dao.SharedHTTPFirewallPolicyDAO.FindEnabledHTTPFirewallPolicyConfig(this.AdminContext(), params.FirewallPolicyId)
if err != nil {

View File

@@ -1,9 +1,8 @@
package ipadmin
import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
import ( "github.com/TeaOSLab/EdgeAdmin/internal/utils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/maps"
@@ -60,7 +59,7 @@ func (this *UpdateIPPopupAction) RunPost(params struct {
CSRF *actionutils.CSRF
}) {
// 日志
defer this.CreateLog(oplogs.LevelInfo, "修改WAF策略名单中的IP %d", params.ItemId)
defer this.CreateLogInfo(codes.IPItem_LogUpdateIPItem, params.ItemId)
// TODO 校验ItemId所属用户

View File

@@ -2,6 +2,7 @@ package web
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
@@ -50,7 +51,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的首页文件名", params.WebId)
defer this.CreateLogInfo(codes.ServerRoot_LogUpdateRoot, params.WebId)
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWeb(this.AdminContext(), &pb.UpdateHTTPWebRequest{
HttpWebId: params.WebId,

View File

@@ -3,6 +3,7 @@ package websocket
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -53,7 +54,7 @@ func (this *IndexAction) RunPost(params struct {
Must *actions.Must
}) {
defer this.CreateLogInfo("修改Web %d 的Websocket设置", params.WebId)
defer this.CreateLogInfo(codes.ServerWebsocket_LogUpdateWebsocketSettings, params.WebId)
// TODO 检查配置