diff --git a/internal/web/actions/default/clusters/cluster/settings/dns/index.go b/internal/web/actions/default/clusters/cluster/settings/dns/index.go index 951eeac9..a4e84c94 100644 --- a/internal/web/actions/default/clusters/cluster/settings/dns/index.go +++ b/internal/web/actions/default/clusters/cluster/settings/dns/index.go @@ -52,6 +52,7 @@ func (this *IndexAction) RunGet(params struct { this.Data["cnameRecords"] = dnsInfoResp.CnameRecords } this.Data["ttl"] = dnsInfoResp.Ttl + this.Data["cnameAsDomain"] = dnsInfoResp.CnameAsDomain this.Show() } @@ -65,6 +66,9 @@ func (this *IndexAction) RunPost(params struct { ServersAutoSync bool CnameRecords []string Ttl int32 + CnameAsDomain bool + + ConfirmResetDomain bool // 是否确认重置域名 Must *actions.Must CSRF *actionutils.CSRF @@ -72,13 +76,15 @@ func (this *IndexAction) RunPost(params struct { // 创建日志 defer this.CreateLog(oplogs.LevelInfo, "修改集群 %d DNS设置", params.ClusterId) - if params.DnsDomainId <= 0 { - this.Fail("请选择集群的主域名") - } + if !params.ConfirmResetDomain { + if params.DnsDomainId <= 0 { + this.Fail("请选择集群的主域名") + } - params.Must. - Field("dnsName", params.DnsName). - Require("请输入DNS子域名") + params.Must. + Field("dnsName", params.DnsName). + Require("请输入DNS子域名") + } // 检查DNS名称 if len(params.DnsName) > 0 { @@ -108,6 +114,7 @@ func (this *IndexAction) RunPost(params struct { ServersAutoSync: params.ServersAutoSync, CnameRecords: params.CnameRecords, Ttl: params.Ttl, + CnameAsDomain: params.CnameAsDomain, }) if err != nil { this.ErrorPage(err) diff --git a/web/views/@default/clusters/cluster/settings/dns/index.html b/web/views/@default/clusters/cluster/settings/dns/index.html index bfa6d297..52182a18 100644 --- a/web/views/@default/clusters/cluster/settings/dns/index.html +++ b/web/views/@default/clusters/cluster/settings/dns/index.html @@ -16,6 +16,13 @@
用于生成集群节点和网站服务的DNS解析记录,修改后将自动删除旧域名中的相关记录。
+选中后,表示确认当前集群不使用主域名;否则必须选择一个主域名。
+每个DNS服务商或者账号的TTL限制各有不同,请注意取值范围。0表示使用默认。
选中后,表示允许使用CNAME直接访问网站服务;如果取消选中,则表示CNAME只作为DNS解析记录使用。
+