[HTTPS]可以直接点击按钮申请免费证书

This commit is contained in:
刘祥超
2020-12-03 21:07:12 +08:00
parent c46de3ae04
commit 2f47e9527a
2 changed files with 47 additions and 18 deletions

View File

@@ -413,6 +413,21 @@ func (this *ServerDAO) InitServerWeb(serverId int64) (int64, error) {
return webId, nil return webId, nil
} }
// 查找ServerNames配置
func (this *ServerDAO) FindServerNames(serverId int64) (serverNamesJSON []byte, err error) {
col, err := this.Query().
Pk(serverId).
Result("serverNames").
FindStringCol("")
if err != nil {
return nil, err
}
if len(col) == 0 || col == "null" {
return []byte("[]"), nil
}
return []byte(col), nil
}
// 修改ServerNames配置 // 修改ServerNames配置
func (this *ServerDAO) UpdateServerNames(serverId int64, config []byte) error { func (this *ServerDAO) UpdateServerNames(serverId int64, config []byte) error {
if serverId <= 0 { if serverId <= 0 {

View File

@@ -330,6 +330,20 @@ func (this *ServerService) UpdateServerReverseProxy(ctx context.Context, req *pb
return this.Success() return this.Success()
} }
// 查找服务的域名设置
func (this *ServerService) FindServerNames(ctx context.Context, req *pb.FindServerNamesRequest) (*pb.FindServerNamesResponse, error) {
_, err := this.ValidateAdmin(ctx, 0)
if err != nil {
return nil, err
}
serverNamesJSON, err := models.SharedServerDAO.FindServerNames(req.ServerId)
if err != nil {
return nil, err
}
return &pb.FindServerNamesResponse{ServerNamesJSON: serverNamesJSON}, nil
}
// 修改域名服务 // 修改域名服务
func (this *ServerService) UpdateServerNames(ctx context.Context, req *pb.UpdateServerNamesRequest) (*pb.RPCSuccess, error) { func (this *ServerService) UpdateServerNames(ctx context.Context, req *pb.UpdateServerNamesRequest) (*pb.RPCSuccess, error) {
// 校验请求 // 校验请求
@@ -431,7 +445,7 @@ func (this *ServerService) ListEnabledServersMatch(ctx context.Context, req *pb.
UdpJSON: []byte(server.Udp), UdpJSON: []byte(server.Udp),
IncludeNodes: []byte(server.IncludeNodes), IncludeNodes: []byte(server.IncludeNodes),
ExcludeNodes: []byte(server.ExcludeNodes), ExcludeNodes: []byte(server.ExcludeNodes),
ServerNamesJON: []byte(server.ServerNames), ServerNamesJSON: []byte(server.ServerNames),
CreatedAt: int64(server.CreatedAt), CreatedAt: int64(server.CreatedAt),
DnsName: server.DnsName, DnsName: server.DnsName,
Cluster: &pb.NodeCluster{ Cluster: &pb.NodeCluster{
@@ -531,7 +545,7 @@ func (this *ServerService) FindEnabledServer(ctx context.Context, req *pb.FindEn
Description: server.Description, Description: server.Description,
DnsName: server.DnsName, DnsName: server.DnsName,
Config: []byte(server.Config), Config: []byte(server.Config),
ServerNamesJON: []byte(server.ServerNames), ServerNamesJSON: []byte(server.ServerNames),
HttpJSON: []byte(server.Http), HttpJSON: []byte(server.Http),
HttpsJSON: []byte(server.Https), HttpsJSON: []byte(server.Https),
TcpJSON: []byte(server.Tcp), TcpJSON: []byte(server.Tcp),