perf: 支持公共cname服务

This commit is contained in:
xiaojunnuo
2024-11-08 01:31:20 +08:00
parent fdc6eef921
commit 3c919ee5d1
9 changed files with 90 additions and 34 deletions
@@ -20,7 +20,7 @@
<cname-tip :record="cnameRecord"></cname-tip>
</template>
<div v-else class="helper">不要删除CNAME</div>
<div v-else class="helper" title="后续自动申请证书需要">不要删除CNAME</div>
</td>
</tr>
</tbody>
@@ -37,7 +37,8 @@ const statusDict = dict({
{ label: "待设置CNAME", value: "cname", color: "warning" },
{ label: "验证中", value: "validating", color: "blue" },
{ label: "验证成功", value: "valid", color: "green" },
{ label: "验证失败", value: "failed", color: "red" }
{ label: "验证失败", value: "failed", color: "red" },
{ label: "验证超时", value: "timeout", color: "red" }
]
});
@@ -67,12 +68,24 @@ function onRecordChange() {
});
}
let refreshIntervalId: any = null;
async function doRefresh() {
if (!props.domain) {
return;
}
cnameRecord.value = await GetByDomain(props.domain);
onRecordChange();
if (cnameRecord.value.status === "validating") {
if (!refreshIntervalId) {
refreshIntervalId = setInterval(async () => {
await doRefresh();
}, 9000);
}
} else {
clearInterval(refreshIntervalId);
refreshIntervalId = null;
}
}
watch(