mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	实现对ACME用户的增删改
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
			
		||||
package teaconst
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	Version = "0.0.2"
 | 
			
		||||
	Version = "0.0.3"
 | 
			
		||||
 | 
			
		||||
	ProductName   = "Edge Admin"
 | 
			
		||||
	ProcessName   = "edge-admin"
 | 
			
		||||
 
 | 
			
		||||
@@ -216,6 +216,10 @@ func (this *RPCClient) DNSRPC() pb.DNSServiceClient {
 | 
			
		||||
	return pb.NewDNSServiceClient(this.pickConn())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *RPCClient) ACMEUserRPC() pb.ACMEUserServiceClient {
 | 
			
		||||
	return pb.NewACMEUserServiceClient(this.pickConn())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 构造Admin上下文
 | 
			
		||||
func (this *RPCClient) Context(adminId int64) context.Context {
 | 
			
		||||
	ctx := context.Background()
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								internal/web/actions/default/servers/certs/acme/create.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								internal/web/actions/default/servers/certs/acme/create.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
package acme
 | 
			
		||||
 | 
			
		||||
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
 | 
			
		||||
type CreateAction struct {
 | 
			
		||||
	actionutils.ParentAction
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *CreateAction) Init() {
 | 
			
		||||
	this.Nav("", "", "")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *CreateAction) RunGet(params struct{}) {
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										15
									
								
								internal/web/actions/default/servers/certs/acme/index.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								internal/web/actions/default/servers/certs/acme/index.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
package acme
 | 
			
		||||
 | 
			
		||||
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
 | 
			
		||||
type IndexAction struct {
 | 
			
		||||
	actionutils.ParentAction
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *IndexAction) Init() {
 | 
			
		||||
	this.Nav("", "", "cert")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *IndexAction) RunGet(params struct{}) {
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,46 @@
 | 
			
		||||
package users
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
			
		||||
	"github.com/iwind/TeaGo/actions"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type CreatePopupAction struct {
 | 
			
		||||
	actionutils.ParentAction
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *CreatePopupAction) Init() {
 | 
			
		||||
	this.Nav("", "", "")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *CreatePopupAction) RunGet(params struct{}) {
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *CreatePopupAction) RunPost(params struct {
 | 
			
		||||
	Email       string
 | 
			
		||||
	Description string
 | 
			
		||||
 | 
			
		||||
	Must *actions.Must
 | 
			
		||||
	CSRF *actionutils.CSRF
 | 
			
		||||
}) {
 | 
			
		||||
	params.Must.
 | 
			
		||||
		Field("email", params.Email).
 | 
			
		||||
		Require("请输入邮箱").
 | 
			
		||||
		Email("请输入正确的邮箱格式")
 | 
			
		||||
 | 
			
		||||
	createResp, err := this.RPC().ACMEUserRPC().CreateACMEUser(this.AdminContext(), &pb.CreateACMEUserRequest{
 | 
			
		||||
		Email:       params.Email,
 | 
			
		||||
		Description: params.Description,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 日志
 | 
			
		||||
	defer this.CreateLogInfo("创建ACME用户 %d", createResp.AcmeUserId)
 | 
			
		||||
 | 
			
		||||
	this.Success()
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,33 @@
 | 
			
		||||
package users
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type DeleteAction struct {
 | 
			
		||||
	actionutils.ParentAction
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *DeleteAction) RunPost(params struct {
 | 
			
		||||
	UserId int64
 | 
			
		||||
}) {
 | 
			
		||||
	defer this.CreateLogInfo("删除ACME用户 %d", params.UserId)
 | 
			
		||||
 | 
			
		||||
	countResp, err := this.RPC().SSLCertRPC().CountSSLCertsWithACMEUserId(this.AdminContext(), &pb.CountSSLCertsWithACMEUserIdRequest{AcmeUserId: params.UserId})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if countResp.Count > 0 {
 | 
			
		||||
		this.Fail("有证书正在和这个用户关联,所以不能删除")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	_, err = this.RPC().ACMEUserRPC().DeleteACMEUser(this.AdminContext(), &pb.DeleteACMEUserRequest{AcmeUserId: params.UserId})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Success()
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,53 @@
 | 
			
		||||
package users
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
			
		||||
	"github.com/iwind/TeaGo/maps"
 | 
			
		||||
	timeutil "github.com/iwind/TeaGo/utils/time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type IndexAction struct {
 | 
			
		||||
	actionutils.ParentAction
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *IndexAction) Init() {
 | 
			
		||||
	this.Nav("", "", "user")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *IndexAction) RunGet(params struct{}) {
 | 
			
		||||
	countResp, err := this.RPC().ACMEUserRPC().CountACMEUsers(this.AdminContext(), &pb.CountAcmeUsersRequest{
 | 
			
		||||
		AdminId: this.AdminId(),
 | 
			
		||||
		UserId:  0,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	count := countResp.Count
 | 
			
		||||
	page := this.NewPage(count)
 | 
			
		||||
	this.Data["page"] = page.AsHTML()
 | 
			
		||||
 | 
			
		||||
	usersResp, err := this.RPC().ACMEUserRPC().ListACMEUsers(this.AdminContext(), &pb.ListACMEUsersRequest{
 | 
			
		||||
		AdminId: this.AdminId(),
 | 
			
		||||
		UserId:  0,
 | 
			
		||||
		Offset:  page.Offset,
 | 
			
		||||
		Size:    page.Size,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	userMaps := []maps.Map{}
 | 
			
		||||
	for _, user := range usersResp.AcmeUsers {
 | 
			
		||||
		userMaps = append(userMaps, maps.Map{
 | 
			
		||||
			"id":          user.Id,
 | 
			
		||||
			"email":       user.Email,
 | 
			
		||||
			"description": user.Description,
 | 
			
		||||
			"createdTime": timeutil.FormatTime("Y-m-d H:i:s", user.CreatedAt),
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["users"] = userMaps
 | 
			
		||||
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,15 @@
 | 
			
		||||
package users
 | 
			
		||||
 | 
			
		||||
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
 | 
			
		||||
type SelectPopupAction struct {
 | 
			
		||||
	actionutils.ParentAction
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *SelectPopupAction) Init() {
 | 
			
		||||
	this.Nav("", "", "")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *SelectPopupAction) RunGet(params struct{}) {
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,60 @@
 | 
			
		||||
package users
 | 
			
		||||
 | 
			
		||||
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"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type UpdatePopupAction struct {
 | 
			
		||||
	actionutils.ParentAction
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *UpdatePopupAction) Init() {
 | 
			
		||||
	this.Nav("", "", "")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *UpdatePopupAction) RunGet(params struct {
 | 
			
		||||
	UserId int64
 | 
			
		||||
}) {
 | 
			
		||||
	userResp, err := this.RPC().ACMEUserRPC().FindEnabledACMEUser(this.AdminContext(), &pb.FindEnabledACMEUserRequest{AcmeUserId: params.UserId})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	user := userResp.AcmeUser
 | 
			
		||||
	if user == nil {
 | 
			
		||||
		this.NotFound("acmeUser", params.UserId)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Data["user"] = maps.Map{
 | 
			
		||||
		"id":          user.Id,
 | 
			
		||||
		"email":       user.Email,
 | 
			
		||||
		"description": user.Description,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *UpdatePopupAction) RunPost(params struct {
 | 
			
		||||
	UserId      int64
 | 
			
		||||
	Description string
 | 
			
		||||
 | 
			
		||||
	Must *actions.Must
 | 
			
		||||
	CSRF *actionutils.CSRF
 | 
			
		||||
}) {
 | 
			
		||||
	defer this.CreateLogInfo("修改ACME用户 %d", params.UserId)
 | 
			
		||||
 | 
			
		||||
	_, err := this.RPC().ACMEUserRPC().UpdateACMEUser(this.AdminContext(), &pb.UpdateACMEUserRequest{
 | 
			
		||||
		AcmeUserId:  params.UserId,
 | 
			
		||||
		Description: params.Description,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Success()
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package ssl
 | 
			
		||||
package certs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package ssl
 | 
			
		||||
package certs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package ssl
 | 
			
		||||
package certs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package ssl
 | 
			
		||||
package certs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package ssl
 | 
			
		||||
package certs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package ssl
 | 
			
		||||
package certs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"archive/zip"
 | 
			
		||||
							
								
								
									
										35
									
								
								internal/web/actions/default/servers/certs/helper.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								internal/web/actions/default/servers/certs/helper.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
package certs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/iwind/TeaGo/actions"
 | 
			
		||||
	"github.com/iwind/TeaGo/maps"
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Helper struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewHelper() *Helper {
 | 
			
		||||
	return &Helper{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *Helper) BeforeAction(action *actions.ActionObject) {
 | 
			
		||||
	if action.Request.Method != http.MethodGet {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	action.Data["teaMenu"] = "servers"
 | 
			
		||||
 | 
			
		||||
	action.Data["leftMenuItems"] = []maps.Map{
 | 
			
		||||
		{
 | 
			
		||||
			"name":     "证书",
 | 
			
		||||
			"url":      "/servers/certs",
 | 
			
		||||
			"isActive": action.Data.GetString("leftMenuItem") == "cert",
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			"name":     "免费证书",
 | 
			
		||||
			"url":      "/servers/certs/acme",
 | 
			
		||||
			"isActive": action.Data.GetString("leftMenuItem") == "acme",
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package ssl
 | 
			
		||||
package certs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
@@ -1,7 +1,8 @@
 | 
			
		||||
package ssl
 | 
			
		||||
package certs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/componentutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/certs/acme"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/certs/acme/users"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
 | 
			
		||||
	"github.com/iwind/TeaGo"
 | 
			
		||||
)
 | 
			
		||||
@@ -11,8 +12,11 @@ func init() {
 | 
			
		||||
		server.
 | 
			
		||||
			Helper(helpers.NewUserMustAuth()).
 | 
			
		||||
			Helper(NewHelper()).
 | 
			
		||||
			Helper(componentutils.NewComponentHelper()).
 | 
			
		||||
			Prefix("/servers/components/ssl").
 | 
			
		||||
 | 
			
		||||
			Data("teaSubMenu", "cert").
 | 
			
		||||
 | 
			
		||||
			Prefix("/servers/certs").
 | 
			
		||||
			Data("leftMenuItem", "cert").
 | 
			
		||||
			Get("", new(IndexAction)).
 | 
			
		||||
			GetPost("/uploadPopup", new(UploadPopupAction)).
 | 
			
		||||
			Post("/delete", new(DeleteAction)).
 | 
			
		||||
@@ -25,6 +29,20 @@ func init() {
 | 
			
		||||
			Get("/downloadZip", new(DownloadZipAction)).
 | 
			
		||||
			Get("/selectPopup", new(SelectPopupAction)).
 | 
			
		||||
			Get("/datajs", new(DatajsAction)).
 | 
			
		||||
 | 
			
		||||
			// ACME
 | 
			
		||||
			Prefix("/servers/certs/acme").
 | 
			
		||||
			Data("leftMenuItem", "acme").
 | 
			
		||||
			Get("", new(acme.IndexAction)).
 | 
			
		||||
			GetPost("/create", new(acme.CreateAction)).
 | 
			
		||||
 | 
			
		||||
			Prefix("/servers/certs/acme/users").
 | 
			
		||||
			Get("", new(users.IndexAction)).
 | 
			
		||||
			GetPost("/createPopup", new(users.CreatePopupAction)).
 | 
			
		||||
			GetPost("/updatePopup", new(users.UpdatePopupAction)).
 | 
			
		||||
			Post("/delete", new(users.DeleteAction)).
 | 
			
		||||
			GetPost("/selectPopup", new(users.SelectPopupAction)).
 | 
			
		||||
 | 
			
		||||
			EndAll()
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package ssl
 | 
			
		||||
package certs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package ssl
 | 
			
		||||
package certs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package ssl
 | 
			
		||||
package certs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package ssl
 | 
			
		||||
package certs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package ssl
 | 
			
		||||
package certs
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
@@ -52,11 +52,6 @@ func (this *ComponentHelper) createLeftMenus(secondMenuItem string) (items []map
 | 
			
		||||
		"url":      "/servers/components/log",
 | 
			
		||||
		"isActive": secondMenuItem == "log",
 | 
			
		||||
	})
 | 
			
		||||
	items = append(items, maps.Map{
 | 
			
		||||
		"name":     "SSL证书管理",
 | 
			
		||||
		"url":      "/servers/components/ssl",
 | 
			
		||||
		"isActive": secondMenuItem == "ssl",
 | 
			
		||||
	})
 | 
			
		||||
	items = append(items, maps.Map{
 | 
			
		||||
		"name":     "IP库",
 | 
			
		||||
		"url":      "/servers/components/ip-library",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,22 +0,0 @@
 | 
			
		||||
package ssl
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/iwind/TeaGo/actions"
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Helper struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewHelper() *Helper {
 | 
			
		||||
	return &Helper{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *Helper) BeforeAction(action *actions.ActionObject) {
 | 
			
		||||
	if action.Request.Method != http.MethodGet {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	action.Data["mainTab"] = "component"
 | 
			
		||||
	action.Data["secondMenuItem"] = "ssl"
 | 
			
		||||
}
 | 
			
		||||
@@ -153,6 +153,11 @@ func (this *UserMustAuth) modules() []maps.Map {
 | 
			
		||||
					"url":  "/servers/components",
 | 
			
		||||
					"code": "components",
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					"name": "证书管理",
 | 
			
		||||
					"url":  "/servers/certs",
 | 
			
		||||
					"code": "cert",
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -19,12 +19,12 @@ import (
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/messages"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/certs"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/cache"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/groups"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/ip-library"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/log"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/ssl"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/components/waf"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server"
 | 
			
		||||
	_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/board"
 | 
			
		||||
 
 | 
			
		||||
@@ -4,20 +4,25 @@
 | 
			
		||||
Vue.component("menu-item", {
 | 
			
		||||
	props: ["href", "active", "code"],
 | 
			
		||||
	data: function () {
 | 
			
		||||
		var active = this.active;
 | 
			
		||||
		if (typeof(active) =="undefined") {
 | 
			
		||||
			var itemCode = "";
 | 
			
		||||
		var active = this.active
 | 
			
		||||
		if (typeof (active) == "undefined") {
 | 
			
		||||
			var itemCode = ""
 | 
			
		||||
			if (typeof (window.TEA.ACTION.data.firstMenuItem) != "undefined") {
 | 
			
		||||
				itemCode = window.TEA.ACTION.data.firstMenuItem;
 | 
			
		||||
				itemCode = window.TEA.ACTION.data.firstMenuItem
 | 
			
		||||
			}
 | 
			
		||||
			active = (itemCode == this.code);
 | 
			
		||||
			active = (itemCode == this.code)
 | 
			
		||||
		}
 | 
			
		||||
		return {
 | 
			
		||||
			vHref: (this.href == null) ? "" : this.href,
 | 
			
		||||
			vActive: active
 | 
			
		||||
		};
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		click: function (e) {
 | 
			
		||||
			this.$emit("click", e)
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	template: '\
 | 
			
		||||
		<a :href="vHref" class="item" :class="{active:vActive}"><slot></slot></a> \
 | 
			
		||||
		<a :href="vHref" class="item" :class="{active:vActive}" @click="click"><slot></slot></a> \
 | 
			
		||||
		'
 | 
			
		||||
});
 | 
			
		||||
@@ -36,7 +36,7 @@ Vue.component("ssl-certs-box", {
 | 
			
		||||
				width = "35em"
 | 
			
		||||
				height = "20em"
 | 
			
		||||
			}
 | 
			
		||||
			teaweb.popup("/servers/components/ssl/selectPopup?viewSize=" + viewSize, {
 | 
			
		||||
			teaweb.popup("/servers/certs/selectPopup?viewSize=" + viewSize, {
 | 
			
		||||
				width: width,
 | 
			
		||||
				height: height,
 | 
			
		||||
				callback: function (resp) {
 | 
			
		||||
@@ -48,7 +48,7 @@ Vue.component("ssl-certs-box", {
 | 
			
		||||
		// 上传证书
 | 
			
		||||
		uploadCert: function () {
 | 
			
		||||
			let that = this
 | 
			
		||||
			teaweb.popup("/servers/components/ssl/uploadPopup", {
 | 
			
		||||
			teaweb.popup("/servers/certs/uploadPopup", {
 | 
			
		||||
				height: "28em",
 | 
			
		||||
				callback: function (resp) {
 | 
			
		||||
					teaweb.success("上传成功", function () {
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ Vue.component("ssl-certs-view", {
 | 
			
		||||
 | 
			
		||||
		// 查看详情
 | 
			
		||||
		viewCert: function (certId) {
 | 
			
		||||
			teaweb.popup("/servers/components/ssl/certPopup?certId=" + certId, {
 | 
			
		||||
			teaweb.popup("/servers/certs/certPopup?certId=" + certId, {
 | 
			
		||||
				height: "28em",
 | 
			
		||||
				width: "48em"
 | 
			
		||||
			})
 | 
			
		||||
 
 | 
			
		||||
@@ -95,7 +95,7 @@ Vue.component("ssl-config-box", {
 | 
			
		||||
		// 选择证书
 | 
			
		||||
		selectCert: function () {
 | 
			
		||||
			let that = this
 | 
			
		||||
			teaweb.popup("/servers/components/ssl/selectPopup", {
 | 
			
		||||
			teaweb.popup("/servers/certs/selectPopup", {
 | 
			
		||||
				width: "50em",
 | 
			
		||||
				height: "30em",
 | 
			
		||||
				callback: function (resp) {
 | 
			
		||||
@@ -108,7 +108,7 @@ Vue.component("ssl-config-box", {
 | 
			
		||||
		// 上传证书
 | 
			
		||||
		uploadCert: function () {
 | 
			
		||||
			let that = this
 | 
			
		||||
			teaweb.popup("/servers/components/ssl/uploadPopup", {
 | 
			
		||||
			teaweb.popup("/servers/certs/uploadPopup", {
 | 
			
		||||
				height: "28em",
 | 
			
		||||
				callback: function (resp) {
 | 
			
		||||
					teaweb.success("上传成功", function () {
 | 
			
		||||
@@ -277,7 +277,7 @@ Vue.component("ssl-config-box", {
 | 
			
		||||
		// 选择客户端CA证书
 | 
			
		||||
		selectClientCACert: function () {
 | 
			
		||||
			let that = this
 | 
			
		||||
			teaweb.popup("/servers/components/ssl/selectPopup?isCA=1", {
 | 
			
		||||
			teaweb.popup("/servers/certs/selectPopup?isCA=1", {
 | 
			
		||||
				width: "50em",
 | 
			
		||||
				height: "30em",
 | 
			
		||||
				callback: function (resp) {
 | 
			
		||||
@@ -290,7 +290,7 @@ Vue.component("ssl-config-box", {
 | 
			
		||||
		// 上传CA证书
 | 
			
		||||
		uploadClientCACert: function () {
 | 
			
		||||
			let that = this
 | 
			
		||||
			teaweb.popup("/servers/components/ssl/uploadPopup?isCA=1", {
 | 
			
		||||
			teaweb.popup("/servers/certs/uploadPopup?isCA=1", {
 | 
			
		||||
				height: "28em",
 | 
			
		||||
				callback: function (resp) {
 | 
			
		||||
					teaweb.success("上传成功", function () {
 | 
			
		||||
 
 | 
			
		||||
@@ -62,6 +62,13 @@ Tea.context(function () {
 | 
			
		||||
			height: "24em"
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 弹窗中默认成功回调
 | 
			
		||||
	 */
 | 
			
		||||
	if (window.IS_POPUP === true) {
 | 
			
		||||
		this.success = window.NotifyPopup
 | 
			
		||||
	}
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
window.NotifySuccess = function (message, url, params) {
 | 
			
		||||
 
 | 
			
		||||
@@ -17,19 +17,22 @@
 | 
			
		||||
	<script type="text/javascript" src="/js/sweetalert2/dist/sweetalert2.all.min.js"></script>
 | 
			
		||||
	<script type="text/javascript" src="/js/date.tea.js"></script>
 | 
			
		||||
	<style type="text/css">
 | 
			
		||||
		.main {
 | 
			
		||||
			left: 0;
 | 
			
		||||
			top: 0;
 | 
			
		||||
			bottom: 0;
 | 
			
		||||
			right: 0;
 | 
			
		||||
			overflow-y: auto;
 | 
			
		||||
			padding-bottom: 0;
 | 
			
		||||
		}
 | 
			
		||||
        .main {
 | 
			
		||||
            left: 0;
 | 
			
		||||
            top: 0;
 | 
			
		||||
            bottom: 0;
 | 
			
		||||
            right: 0;
 | 
			
		||||
            overflow-y: auto;
 | 
			
		||||
            padding-bottom: 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		.main::-webkit-scrollbar {
 | 
			
		||||
			width: 4px;
 | 
			
		||||
		}
 | 
			
		||||
        .main::-webkit-scrollbar {
 | 
			
		||||
            width: 4px;
 | 
			
		||||
        }
 | 
			
		||||
	</style>
 | 
			
		||||
	<script type="text/javascript">
 | 
			
		||||
		window.IS_POPUP = true
 | 
			
		||||
	</script>
 | 
			
		||||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,6 +1,4 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
 | 
			
		||||
	this.hasHTTPS = false
 | 
			
		||||
	this.changeListens = function (addrs) {
 | 
			
		||||
		this.hasHTTPS = addrs.$any(function (k, v) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,4 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
	let addr = window.parent.UPDATING_ADDR
 | 
			
		||||
	this.protocol = addr.protocol
 | 
			
		||||
	this.addr = addr.host + ":" + addr.portRange
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function (){
 | 
			
		||||
	this.success = NotifyPopup;
 | 
			
		||||
});
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup;
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										4
									
								
								web/views/@default/servers/certs/acme/@menu.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								web/views/@default/servers/certs/acme/@menu.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
<first-menu>
 | 
			
		||||
	<menu-item href="/servers/certs/acme" code="cert">证书</menu-item>
 | 
			
		||||
	<menu-item href="/servers/certs/acme/users" code="user">用户</menu-item>
 | 
			
		||||
</first-menu>
 | 
			
		||||
							
								
								
									
										6
									
								
								web/views/@default/servers/certs/acme/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								web/views/@default/servers/certs/acme/index.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
{$layout}
 | 
			
		||||
{$template "/left_menu_top"}
 | 
			
		||||
 | 
			
		||||
<div class="right-box without-tabbar">
 | 
			
		||||
	{$template "menu"}
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										22
									
								
								web/views/@default/servers/certs/acme/users/createPopup.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								web/views/@default/servers/certs/acme/users/createPopup.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
{$layout "layout_popup"}
 | 
			
		||||
 | 
			
		||||
<h3>创建用户</h3>
 | 
			
		||||
<form method="post" class="ui form" data-tea-success="success" data-tea-action="$">
 | 
			
		||||
	<csrf-token></csrf-token>
 | 
			
		||||
	<table class="ui table definition selectable">
 | 
			
		||||
		<tr>
 | 
			
		||||
			<td class="title">用户邮箱 *</td>
 | 
			
		||||
			<td>
 | 
			
		||||
				<input type="text" name="email" maxlength="100" ref="focus"/>
 | 
			
		||||
				<p class="comment">用于自动注册用户的邮箱。</p>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
		<tr>
 | 
			
		||||
			<td>备注</td>
 | 
			
		||||
			<td>
 | 
			
		||||
				<textarea name="description" rows="3" maxlength="100"></textarea>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
	</table>
 | 
			
		||||
	<submit-btn></submit-btn>
 | 
			
		||||
</form>
 | 
			
		||||
							
								
								
									
										36
									
								
								web/views/@default/servers/certs/acme/users/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								web/views/@default/servers/certs/acme/users/index.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
{$layout}
 | 
			
		||||
{$template "/left_menu_top"}
 | 
			
		||||
 | 
			
		||||
<div class="right-box without-tabbar">
 | 
			
		||||
	{$template "../menu"}
 | 
			
		||||
 | 
			
		||||
	<second-menu>
 | 
			
		||||
		<menu-item @click.prevent="createUser">[创建用户]</menu-item>
 | 
			
		||||
		<menu-item><tip-icon content="这里管理用于申请免费证书的用户信息"></tip-icon></menu-item>
 | 
			
		||||
	</second-menu>
 | 
			
		||||
 | 
			
		||||
	<p class="comment" v-if="users.length == 0">暂时还没有用户。</p>
 | 
			
		||||
 | 
			
		||||
	<table class="ui table selectable" v-if="users.length > 0">
 | 
			
		||||
		<thead>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<th>Email</th>
 | 
			
		||||
				<th>备注</th>
 | 
			
		||||
				<th class="two op">操作</th>
 | 
			
		||||
			</tr>
 | 
			
		||||
		</thead>
 | 
			
		||||
		<tr v-for="user in users">
 | 
			
		||||
			<td>{{user.email}}</td>
 | 
			
		||||
			<td>
 | 
			
		||||
				<span v-if="user.description.length > 0">{{user.description}}</span>
 | 
			
		||||
				<span v-else class="disabled">-</span>
 | 
			
		||||
			</td>
 | 
			
		||||
			<td>
 | 
			
		||||
				<a href="" @click.prevent="updateUser(user.id)">修改</a>  
 | 
			
		||||
				<a href="" @click.prevent="deleteUser(user.id)">删除</a>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
	</table>
 | 
			
		||||
 | 
			
		||||
	<div class="page" v-html="page"></div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										32
									
								
								web/views/@default/servers/certs/acme/users/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								web/views/@default/servers/certs/acme/users/index.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.createUser = function () {
 | 
			
		||||
		teaweb.popup(Tea.url(".createPopup"), {
 | 
			
		||||
			callback: function () {
 | 
			
		||||
				teaweb.success("创建成功", function () {
 | 
			
		||||
					teaweb.reload()
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.updateUser = function (userId) {
 | 
			
		||||
		teaweb.popup("/servers/certs/acme/users/updatePopup?userId=" + userId, {
 | 
			
		||||
			callback: function () {
 | 
			
		||||
				teaweb.success("保存成功", function () {
 | 
			
		||||
					teaweb.reload()
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.deleteUser = function (userId) {
 | 
			
		||||
		let that = this
 | 
			
		||||
		teaweb.confirm("确定要删除此用户吗?", function () {
 | 
			
		||||
			that.$post(".delete")
 | 
			
		||||
				.params({
 | 
			
		||||
					userId: userId
 | 
			
		||||
				})
 | 
			
		||||
				.refresh()
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
							
								
								
									
										23
									
								
								web/views/@default/servers/certs/acme/users/updatePopup.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								web/views/@default/servers/certs/acme/users/updatePopup.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
{$layout "layout_popup"}
 | 
			
		||||
 | 
			
		||||
<h3>修改用户</h3>
 | 
			
		||||
<form method="post" class="ui form" data-tea-success="success" data-tea-action="$">
 | 
			
		||||
	<csrf-token></csrf-token>
 | 
			
		||||
	<input type="hidden" name="userId" :value="user.id"/>
 | 
			
		||||
	<table class="ui table definition selectable">
 | 
			
		||||
		<tr>
 | 
			
		||||
			<td class="title">用户邮箱 *</td>
 | 
			
		||||
			<td>
 | 
			
		||||
				{{user.email}}
 | 
			
		||||
				<p class="comment">用于自动注册用户的邮箱,不允许修改。</p>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
		<tr>
 | 
			
		||||
			<td>备注</td>
 | 
			
		||||
			<td>
 | 
			
		||||
				<textarea name="description" rows="3" maxlength="100" v-model="user.description" ref="focus"></textarea>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
	</table>
 | 
			
		||||
	<submit-btn></submit-btn>
 | 
			
		||||
</form>
 | 
			
		||||
@@ -49,9 +49,9 @@
 | 
			
		||||
	<tr>
 | 
			
		||||
		<td>证书文件下载</td>
 | 
			
		||||
		<td>
 | 
			
		||||
			<a :href="'/servers/components/ssl/downloadZip?certId=' + info.id" target="_blank">[ZIP下载]</a>  
 | 
			
		||||
			<a :href="'/servers/components/ssl/downloadCert?certId=' + info.id" target="_blank">[证书下载]</a>  
 | 
			
		||||
			<a :href="'/servers/components/ssl/downloadKey?certId=' + info.id" v-if="!info.isCA" target="_blank">[私钥下载]</a>
 | 
			
		||||
			<a :href="'/servers/certs/downloadZip?certId=' + info.id" target="_blank">[ZIP下载]</a>  
 | 
			
		||||
			<a :href="'/servers/certs/downloadCert?certId=' + info.id" target="_blank">[证书下载]</a>  
 | 
			
		||||
			<a :href="'/servers/certs/downloadKey?certId=' + info.id" v-if="!info.isCA" target="_blank">[私钥下载]</a>
 | 
			
		||||
		</td>
 | 
			
		||||
	</tr>
 | 
			
		||||
	<tr>
 | 
			
		||||
@@ -59,7 +59,7 @@
 | 
			
		||||
		<td>
 | 
			
		||||
			<pre class="pre-box" style="font-family: Menlo, Monaco, 'Courier New', monospace !important">{{info.certString}}</pre>
 | 
			
		||||
			<div style="margin-top:1em">
 | 
			
		||||
				<a :href="'/servers/components/ssl/viewCert?certId=' + info.id" target="_blank">[浏览器新窗口打开]</a>
 | 
			
		||||
				<a :href="'/servers/certs/viewCert?certId=' + info.id" target="_blank">[浏览器新窗口打开]</a>
 | 
			
		||||
			</div>
 | 
			
		||||
		</td>
 | 
			
		||||
	</tr>
 | 
			
		||||
@@ -67,7 +67,7 @@
 | 
			
		||||
		<td>私钥预览</td>
 | 
			
		||||
		<td><pre class="pre-box" style="font-family: Menlo, Monaco, 'Courier New', monospace !important">{{info.keyString}}</pre>
 | 
			
		||||
			<div style="margin-top: 1em">
 | 
			
		||||
				<a :href="'/servers/components/ssl/viewKey?certId=' + info.id" target="_blank">[浏览器新窗口打开]</a>
 | 
			
		||||
				<a :href="'/servers/certs/viewKey?certId=' + info.id" target="_blank">[浏览器新窗口打开]</a>
 | 
			
		||||
			</div>
 | 
			
		||||
		</td>
 | 
			
		||||
	</tr>
 | 
			
		||||
@@ -3,12 +3,12 @@
 | 
			
		||||
 | 
			
		||||
<div class="right-box without-tabbar">
 | 
			
		||||
	<second-menu>
 | 
			
		||||
		<menu-item href="/servers/components/ssl" :active="type == ''">所有证书({{countAll}})</menu-item>
 | 
			
		||||
		<menu-item href="/servers/components/ssl?type=ca" :active="type == 'ca'">CA证书({{countCA}})</menu-item>
 | 
			
		||||
		<menu-item href="/servers/components/ssl?type=available" :active="type == 'available'">有效证书({{countAvailable}})</menu-item>
 | 
			
		||||
		<menu-item href="/servers/components/ssl?type=expired" :active="type == 'expired'">过期证书<span :class="{red: countExpired > 0}">({{countExpired}})</span></menu-item>
 | 
			
		||||
		<menu-item href="/servers/components/ssl?type=7days" :active="type == '7days'">7天内过期<span :class="{red: count7Days > 0}">({{count7Days}})</span></menu-item>
 | 
			
		||||
		<menu-item href="/servers/components/ssl?type=30days" :active="type == '30days'">30天过期({{count30Days}})</menu-item>
 | 
			
		||||
		<menu-item href="/servers/certs" :active="type == ''">所有证书({{countAll}})</menu-item>
 | 
			
		||||
		<menu-item href="/servers/certs?type=ca" :active="type == 'ca'">CA证书({{countCA}})</menu-item>
 | 
			
		||||
		<menu-item href="/servers/certs?type=available" :active="type == 'available'">有效证书({{countAvailable}})</menu-item>
 | 
			
		||||
		<menu-item href="/servers/certs?type=expired" :active="type == 'expired'">过期证书<span :class="{red: countExpired > 0}">({{countExpired}})</span></menu-item>
 | 
			
		||||
		<menu-item href="/servers/certs?type=7days" :active="type == '7days'">7天内过期<span :class="{red: count7Days > 0}">({{count7Days}})</span></menu-item>
 | 
			
		||||
		<menu-item href="/servers/certs?type=30days" :active="type == '30days'">30天过期({{count30Days}})</menu-item>
 | 
			
		||||
		<span class="item">|</span>
 | 
			
		||||
		<a href="" class="item" @click.prevent="uploadCert">[上传证书]</a>
 | 
			
		||||
	</second-menu>
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	// 上传证书
 | 
			
		||||
	this.uploadCert = function () {
 | 
			
		||||
		teaweb.popup("/servers/components/ssl/uploadPopup", {
 | 
			
		||||
		teaweb.popup("/servers/certs/uploadPopup", {
 | 
			
		||||
			height: "28em",
 | 
			
		||||
			callback: function () {
 | 
			
		||||
				teaweb.success("上传成功", function () {
 | 
			
		||||
@@ -15,7 +15,7 @@ Tea.context(function () {
 | 
			
		||||
	this.deleteCert = function (certId) {
 | 
			
		||||
		let that = this
 | 
			
		||||
		teaweb.confirm("确定要删除此证书吗?", function () {
 | 
			
		||||
			that.$post("/servers/components/ssl/delete")
 | 
			
		||||
			that.$post("/servers/certs/delete")
 | 
			
		||||
				.params({
 | 
			
		||||
					certId: certId
 | 
			
		||||
				})
 | 
			
		||||
@@ -25,7 +25,7 @@ Tea.context(function () {
 | 
			
		||||
 | 
			
		||||
	// 查看证书
 | 
			
		||||
	this.viewCert = function (certId) {
 | 
			
		||||
		teaweb.popup("/servers/components/ssl/certPopup?certId=" + certId, {
 | 
			
		||||
		teaweb.popup("/servers/certs/certPopup?certId=" + certId, {
 | 
			
		||||
			height: "28em",
 | 
			
		||||
			width: "48em"
 | 
			
		||||
		})
 | 
			
		||||
@@ -33,7 +33,7 @@ Tea.context(function () {
 | 
			
		||||
 | 
			
		||||
	// 修改证书
 | 
			
		||||
	this.updateCert = function (certId) {
 | 
			
		||||
		teaweb.popup("/servers/components/ssl/updatePopup?certId=" + certId, {
 | 
			
		||||
		teaweb.popup("/servers/certs/updatePopup?certId=" + certId, {
 | 
			
		||||
			height: "28em",
 | 
			
		||||
			callback: function () {
 | 
			
		||||
				teaweb.success("上传成功", function () {
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
{$template "/left_menu"}
 | 
			
		||||
 | 
			
		||||
{$var "header"}
 | 
			
		||||
	<script src="/servers/components/ssl/datajs" type="text/javascript"></script>
 | 
			
		||||
	<script src="/servers/certs/datajs" type="text/javascript"></script>
 | 
			
		||||
	<script src="/js/sortable.min.js" type="text/javascript"></script>
 | 
			
		||||
{$end}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup;
 | 
			
		||||
});
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup;
 | 
			
		||||
});
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
{$template "/left_menu"}
 | 
			
		||||
 | 
			
		||||
{$var "header"}
 | 
			
		||||
<script src="/servers/components/ssl/datajs" type="text/javascript"></script>
 | 
			
		||||
<script src="/servers/certs/datajs" type="text/javascript"></script>
 | 
			
		||||
<script src="/js/sortable.min.js" type="text/javascript"></script>
 | 
			
		||||
{$end}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
})
 | 
			
		||||
		Reference in New Issue
	
	Block a user