修复setup server时DNSPod新建a记录的问题

This commit is contained in:
jingrow 2025-05-13 20:51:34 +08:00
parent f49dbd27a1
commit 2c20d4eec6

View File

@ -248,6 +248,9 @@ class BaseServer(Document, TagHelpers):
# 分离子域名
if self.name.endswith("." + domain.name):
sub_domain = self.name[:-len(domain.name)-1]
if not sub_domain:
log_error("主机记录为空拒绝将主域名作为A记录", domain=domain.name, server=self.name)
return
else:
log_error("域名配置错误", domain=domain.name, server=self.name)
return
@ -314,6 +317,7 @@ class BaseServer(Document, TagHelpers):
"RecordType": "A",
"RecordLine": "默认",
"Value": self.ip,
"SubDomain": sub_domain, # 添加子域名参数,修复主机记录变为@的问题
"TTL": ttl_value
}
req.from_json_string(json.dumps(params))
@ -348,6 +352,7 @@ class BaseServer(Document, TagHelpers):
"RecordType": "A",
"RecordLine": "默认",
"Value": self.ip,
"SubDomain": sub_domain, # 同样在这里也添加子域名参数
"TTL": ttl_value
}
req.from_json_string(json.dumps(params))