mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-13 02:00:26 +08:00
增加证书OCSP错误日志管理
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package certs
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/actions"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@@ -13,14 +16,29 @@ func NewHelper() *Helper {
|
||||
return &Helper{}
|
||||
}
|
||||
|
||||
func (this *Helper) BeforeAction(action *actions.ActionObject) {
|
||||
func (this *Helper) BeforeAction(actionWrapper actions.ActionWrapper) {
|
||||
var action = actionWrapper.Object()
|
||||
if action.Request.Method != http.MethodGet {
|
||||
return
|
||||
}
|
||||
|
||||
action.Data["teaMenu"] = "servers"
|
||||
|
||||
action.Data["leftMenuItems"] = []maps.Map{
|
||||
var countOCSP int64 = 0
|
||||
parentAction, ok := actionWrapper.(actionutils.ActionInterface)
|
||||
if ok {
|
||||
countOCSPResp, err := parentAction.RPC().SSLCertRPC().CountAllSSLCertsWithOCSPError(parentAction.AdminContext(), &pb.CountAllSSLCertsWithOCSPErrorRequest{})
|
||||
if err == nil {
|
||||
countOCSP = countOCSPResp.Count
|
||||
}
|
||||
}
|
||||
|
||||
var ocspMenuName = "OCSP日志"
|
||||
if countOCSP > 0 {
|
||||
ocspMenuName += "(" + types.String(countOCSP) + ")"
|
||||
}
|
||||
|
||||
var menu = []maps.Map{
|
||||
{
|
||||
"name": "证书",
|
||||
"url": "/servers/certs",
|
||||
@@ -31,5 +49,11 @@ func (this *Helper) BeforeAction(action *actions.ActionObject) {
|
||||
"url": "/servers/certs/acme",
|
||||
"isActive": action.Data.GetString("leftMenuItem") == "acme",
|
||||
},
|
||||
{
|
||||
"name": ocspMenuName,
|
||||
"url": "/servers/certs/ocsp",
|
||||
"isActive": action.Data.GetString("leftMenuItem") == "ocsp",
|
||||
},
|
||||
}
|
||||
action.Data["leftMenuItems"] = menu
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user