支持任意域名通过CNAME访问服务(开启选项后)/可以重新生成服务CNAME

This commit is contained in:
刘祥超
2021-10-16 12:03:21 +08:00
parent 6b0d875745
commit 63ee7d5211
6 changed files with 100 additions and 17 deletions

View File

@@ -3,6 +3,7 @@ package dns
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
)
type IndexAction struct {
@@ -28,6 +29,28 @@ func (this *IndexAction) RunGet(params struct {
} else {
this.Data["dnsDomain"] = ""
}
this.Data["supportCNAME"] = dnsInfoResp.SupportCNAME
this.Show()
}
func (this *IndexAction) RunPost(params struct {
ServerId int64
SupportCNAME bool
Must *actions.Must
CSRF *actionutils.CSRF
}) {
defer this.CreateLogInfo("修改服务 %d 的DNS设置", params.ServerId)
_, err := this.RPC().ServerRPC().UpdateServerDNS(this.AdminContext(), &pb.UpdateServerDNSRequest{
ServerId: params.ServerId,
SupportCNAME: params.SupportCNAME,
})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}