From 9669c0ddda97d286b3b2b88743c03e321adc82a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Tue, 13 Jul 2021 14:28:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E5=BE=84=E8=A7=84=E5=88=99=E6=94=B9?= =?UTF-8?q?=E6=88=90=E8=B7=AF=E7=94=B1=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/tasks/task_authority.go | 3 ++- internal/web/actions/default/ns/index.go | 6 +++++ .../server/settings/locations/create.go | 2 +- .../settings/locations/location/index.go | 6 ++--- .../settings/locations/locationutils/utils.go | 2 +- .../locations/reverseProxy/setting.go | 2 +- .../servers/serverutils/server_helper.go | 2 +- web/views/@default/@layout.html | 4 +-- web/views/@default/dashboard/boards/index.css | 2 +- .../@default/dashboard/boards/index.css.map | 2 +- .../@default/dashboard/boards/index.html | 25 ++++++++++++++----- .../@default/dashboard/boards/index.less | 10 +++++--- web/views/@default/dashboard/index.css | 2 +- web/views/@default/dashboard/index.css.map | 2 +- web/views/@default/dashboard/index.html | 14 ++++++----- web/views/@default/dashboard/index.less | 10 +++++--- .../settings/locations/@location_menu.html | 2 +- .../server/settings/locations/create.html | 2 +- .../server/settings/locations/index.html | 4 +-- .../server/settings/locations/index.js | 4 +-- .../settings/locations/location/index.html | 2 +- .../server/settings/rewrite/createPopup.html | 2 +- .../server/settings/rewrite/updatePopup.html | 2 +- 23 files changed, 69 insertions(+), 43 deletions(-) diff --git a/internal/tasks/task_authority.go b/internal/tasks/task_authority.go index ee3e4336..485efe71 100644 --- a/internal/tasks/task_authority.go +++ b/internal/tasks/task_authority.go @@ -11,6 +11,7 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/Tea" "github.com/iwind/TeaGo/logs" + timeutil "github.com/iwind/TeaGo/utils/time" "time" ) @@ -74,7 +75,7 @@ func (this *AuthorityTask) Loop() error { return err } var oldState = teaconst.IsPlus - if resp.AuthorityKey != nil { + if resp.AuthorityKey != nil && len(resp.AuthorityKey.Value) > 0 && resp.AuthorityKey.DayTo >= timeutil.Format("Y-m-d") { teaconst.IsPlus = true } else { teaconst.IsPlus = false diff --git a/internal/web/actions/default/ns/index.go b/internal/web/actions/default/ns/index.go index 8ff05dff..d9303619 100644 --- a/internal/web/actions/default/ns/index.go +++ b/internal/web/actions/default/ns/index.go @@ -1,6 +1,7 @@ package ns import ( + teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" @@ -19,6 +20,11 @@ func (this *IndexAction) RunGet(params struct { UserId int64 Keyword string }) { + if !teaconst.IsPlus { + this.RedirectURL("/") + return + } + this.Data["clusterId"] = params.ClusterId this.Data["userId"] = params.UserId this.Data["keyword"] = params.Keyword diff --git a/internal/web/actions/default/servers/server/settings/locations/create.go b/internal/web/actions/default/servers/server/settings/locations/create.go index b86d1fdb..472932a7 100644 --- a/internal/web/actions/default/servers/server/settings/locations/create.go +++ b/internal/web/actions/default/servers/server/settings/locations/create.go @@ -12,7 +12,7 @@ import ( "strings" ) -// 创建路径规则 +// CreateAction 创建路由规则 type CreateAction struct { actionutils.ParentAction } diff --git a/internal/web/actions/default/servers/server/settings/locations/location/index.go b/internal/web/actions/default/servers/server/settings/locations/location/index.go index 510c7628..f322073c 100644 --- a/internal/web/actions/default/servers/server/settings/locations/location/index.go +++ b/internal/web/actions/default/servers/server/settings/locations/location/index.go @@ -11,7 +11,7 @@ import ( "strings" ) -// 路径规则详情 +// IndexAction 路由规则详情 type IndexAction struct { actionutils.ParentAction } @@ -52,11 +52,11 @@ func (this *IndexAction) RunPost(params struct { Must *actions.Must }) { - defer this.CreateLogInfo("修改路径规则 %d 设置", params.LocationId) + defer this.CreateLogInfo("修改路由规则 %d 设置", params.LocationId) params.Must. Field("pattern", params.Pattern). - Require("请输入路径匹配规则") + Require("请输入路由匹配规则") // 校验正则 if params.PatternType == serverconfigs.HTTPLocationPatternTypeRegexp { diff --git a/internal/web/actions/default/servers/server/settings/locations/locationutils/utils.go b/internal/web/actions/default/servers/server/settings/locations/locationutils/utils.go index e2540c36..a5aae02d 100644 --- a/internal/web/actions/default/servers/server/settings/locations/locationutils/utils.go +++ b/internal/web/actions/default/servers/server/settings/locations/locationutils/utils.go @@ -7,7 +7,7 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" ) -// 查找路径规则配置 +// FindLocationConfig 查找路由规则配置 func FindLocationConfig(parentAction *actionutils.ParentAction, locationId int64) (locationConfig *serverconfigs.HTTPLocationConfig, isOk bool) { locationConfigResp, err := parentAction.RPC().HTTPLocationRPC().FindEnabledHTTPLocationConfig(parentAction.AdminContext(), &pb.FindEnabledHTTPLocationConfigRequest{LocationId: locationId}) if err != nil { diff --git a/internal/web/actions/default/servers/server/settings/locations/reverseProxy/setting.go b/internal/web/actions/default/servers/server/settings/locations/reverseProxy/setting.go index 9ad0c34a..9c520584 100644 --- a/internal/web/actions/default/servers/server/settings/locations/reverseProxy/setting.go +++ b/internal/web/actions/default/servers/server/settings/locations/reverseProxy/setting.go @@ -52,7 +52,7 @@ func (this *SettingAction) RunPost(params struct { Must *actions.Must }) { - defer this.CreateLogInfo("修改路径规则 %d 的反向代理设置", params.LocationId) + defer this.CreateLogInfo("修改路由规则 %d 的反向代理设置", params.LocationId) // TODO 校验配置 diff --git a/internal/web/actions/default/servers/serverutils/server_helper.go b/internal/web/actions/default/servers/serverutils/server_helper.go index dc6ffa63..540ee389 100644 --- a/internal/web/actions/default/servers/serverutils/server_helper.go +++ b/internal/web/actions/default/servers/serverutils/server_helper.go @@ -251,7 +251,7 @@ func (this *ServerHelper) createSettingsMenu(secondMenuItem string, serverIdStri "isOn": serverConfig.Web != nil && len(serverConfig.Web.HostRedirects) > 0, }) menuItems = append(menuItems, maps.Map{ - "name": "路径规则", + "name": "路由规则", "url": "/servers/server/settings/locations?serverId=" + serverIdString, "isActive": secondMenuItem == "locations", "isOn": serverConfig.Web != nil && len(serverConfig.Web.Locations) > 0, diff --git a/web/views/@default/@layout.html b/web/views/@default/@layout.html index 6b18a022..6b5d6bae 100644 --- a/web/views/@default/@layout.html +++ b/web/views/@default/@layout.html @@ -25,7 +25,7 @@
-