优化阿里云 DNS 权限验证等待时长
This commit is contained in:
1 parent
91eaf31d15
commit
d8205ae651
20 files changed
+560
-38
No files matched your search
@@ -1,6 +1,13 @@
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
||||
|
||||
const defaultDNSVerificationTimeoutSeconds = 60;
|
||||
const aliyunDNSVerificationTimeoutSeconds = 15;
|
||||
|
||||
function dnsVerificationTimeoutFor(providerID) {
|
||||
return String(providerID || "").trim().toLowerCase() === "aliyun"
|
||||
? aliyunDNSVerificationTimeoutSeconds
|
||||
: defaultDNSVerificationTimeoutSeconds;
|
||||
}
|
||||
|
||||
export function useDashboard() {
|
||||
const scertLogo = "/Scert.png";
|
||||
@@ -233,9 +240,9 @@ export function useDashboard() {
|
||||
dnsVerificationElapsedSeconds.value = 0;
|
||||
}
|
||||
|
||||
function startDNSVerificationTimer(requestVersion) {
|
||||
function startDNSVerificationTimer(requestVersion, providerID) {
|
||||
stopDNSVerificationTimer();
|
||||
dnsVerificationTimeoutSeconds.value = defaultDNSVerificationTimeoutSeconds;
|
||||
dnsVerificationTimeoutSeconds.value = dnsVerificationTimeoutFor(providerID);
|
||||
const startedAt = Date.now();
|
||||
const updateElapsedSeconds = () => {
|
||||
if (requestVersion !== dnsRequestVersion) return;
|
||||
@@ -801,7 +808,7 @@ export function useDashboard() {
|
||||
const requestVersion = dnsRequestVersion;
|
||||
dnsTesting.value = true;
|
||||
dns.verification_state = "pending";
|
||||
startDNSVerificationTimer(requestVersion);
|
||||
startDNSVerificationTimer(requestVersion, dns.provider);
|
||||
try {
|
||||
const response = await fetchAdmin("/api/v1/dns/test", {
|
||||
method: "POST",
|
||||
|
||||
@@ -103,7 +103,7 @@ test("管理设置 DNS 验证显示等待进度,并在结束后停止计时",
|
||||
|
||||
assert.equal(state.dnsTesting.value, true);
|
||||
assert.equal(state.dnsVerificationElapsedSeconds.value, 0);
|
||||
assert.equal(state.dnsVerificationTimeoutSeconds.value, 60);
|
||||
assert.equal(state.dnsVerificationTimeoutSeconds.value, 15);
|
||||
advanceTime(3200);
|
||||
runIntervals();
|
||||
assert.equal(state.dnsVerificationElapsedSeconds.value, 3);
|
||||
@@ -113,12 +113,12 @@ test("管理设置 DNS 验证显示等待进度,并在结束后停止计时",
|
||||
credential_ref: "secret://test/only",
|
||||
verification_token: "test-token",
|
||||
expires_at: new Date(Date.now() + 60000).toISOString(),
|
||||
verification_timeout_secs: 60,
|
||||
verification_timeout_secs: 15,
|
||||
}));
|
||||
await task;
|
||||
assert.equal(state.dnsTesting.value, false);
|
||||
assert.equal(state.dnsVerificationElapsedSeconds.value, 0);
|
||||
assert.equal(state.dnsVerificationTimeoutSeconds.value, 60);
|
||||
assert.equal(state.dnsVerificationTimeoutSeconds.value, 15);
|
||||
advanceTime(1000);
|
||||
runIntervals();
|
||||
assert.equal(state.dnsVerificationElapsedSeconds.value, 0);
|
||||
|
||||
@@ -583,7 +583,10 @@ const {
|
||||
已等待 {{ dnsVerificationElapsedSeconds }} 秒,最长等待
|
||||
{{ dnsVerificationTimeoutSeconds }} 秒。
|
||||
</span>
|
||||
<small>
|
||||
<small v-if="selectedDNSProvider?.id === 'aliyun'">
|
||||
正在通过阿里云 DNS API 创建、查询并清理临时 TXT 记录,不等待公网 DNS 传播,通常数秒即可完成;实际申请证书时,仍可能需要等待公网 DNS-01 记录传播。
|
||||
</small>
|
||||
<small v-else>
|
||||
系统正在创建临时 TXT、查询验证记录并自动清理。这是 DNS API 权限验证;实际申请证书时,仍可能需要等待公网 DNS-01 记录传播。
|
||||
</small>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import { computed, onMounted, onUnmounted, ref, watch } from "vue";
|
||||
|
||||
const defaultDNSVerificationTimeoutSeconds = 60;
|
||||
const aliyunDNSVerificationTimeoutSeconds = 15;
|
||||
|
||||
function dnsVerificationTimeoutFor(providerID) {
|
||||
return String(providerID || "").trim().toLowerCase() === "aliyun"
|
||||
? aliyunDNSVerificationTimeoutSeconds
|
||||
: defaultDNSVerificationTimeoutSeconds;
|
||||
}
|
||||
|
||||
const commonEmailDomains = [
|
||||
{ label: "常用邮箱", value: "" },
|
||||
@@ -170,9 +177,9 @@ export function useSetupWizard(props, emit) {
|
||||
dnsVerificationElapsedSeconds.value = 0;
|
||||
}
|
||||
|
||||
function startDNSVerificationTimer(requestVersion) {
|
||||
function startDNSVerificationTimer(requestVersion, providerID) {
|
||||
stopDNSVerificationTimer();
|
||||
dnsVerificationTimeoutSeconds.value = defaultDNSVerificationTimeoutSeconds;
|
||||
dnsVerificationTimeoutSeconds.value = dnsVerificationTimeoutFor(providerID);
|
||||
const startedAt = Date.now();
|
||||
const updateElapsedSeconds = () => {
|
||||
if (requestVersion !== dnsRequestVersion) return;
|
||||
@@ -456,7 +463,7 @@ export function useSetupWizard(props, emit) {
|
||||
|
||||
const requestVersion = dnsRequestVersion;
|
||||
dnsTesting.value = true;
|
||||
startDNSVerificationTimer(requestVersion);
|
||||
startDNSVerificationTimer(requestVersion, provider.id);
|
||||
try {
|
||||
const response = await fetch("/api/v1/setup/dns/test", {
|
||||
method: "POST",
|
||||
|
||||
@@ -34,7 +34,7 @@ test("初始化 DNS 验证显示等待进度,并采用服务端返回的最长
|
||||
|
||||
assert.equal(state.dnsTesting.value, true);
|
||||
assert.equal(state.dnsVerificationElapsedSeconds.value, 0);
|
||||
assert.equal(state.dnsVerificationTimeoutSeconds.value, 60);
|
||||
assert.equal(state.dnsVerificationTimeoutSeconds.value, 15);
|
||||
|
||||
advanceTime(2500);
|
||||
runIntervals();
|
||||
@@ -45,12 +45,12 @@ test("初始化 DNS 验证显示等待进度,并采用服务端返回的最长
|
||||
credential_ref: "secret://test/only",
|
||||
verification_token: "test-token",
|
||||
expires_at: new Date(Date.now() + 60000).toISOString(),
|
||||
verification_timeout_secs: 60,
|
||||
verification_timeout_secs: 15,
|
||||
}));
|
||||
await task;
|
||||
assert.equal(state.dnsTesting.value, false);
|
||||
assert.equal(state.dnsVerificationElapsedSeconds.value, 0);
|
||||
assert.equal(state.dnsVerificationTimeoutSeconds.value, 60);
|
||||
assert.equal(state.dnsVerificationTimeoutSeconds.value, 15);
|
||||
|
||||
advanceTime(1000);
|
||||
runIntervals();
|
||||
|
||||
@@ -810,7 +810,10 @@ const {
|
||||
已等待 {{ dnsVerificationElapsedSeconds }} 秒,最长等待
|
||||
{{ dnsVerificationTimeoutSeconds }} 秒。
|
||||
</span>
|
||||
<small>
|
||||
<small v-if="selectedDNSProvider?.id === 'aliyun'">
|
||||
正在通过阿里云 DNS API 创建、查询并清理临时 TXT 记录,不等待公网 DNS 传播,通常数秒即可完成;实际申请证书时,仍可能需要等待公网 DNS-01 记录传播。
|
||||
</small>
|
||||
<small v-else>
|
||||
系统正在创建临时 TXT、查询验证记录并自动清理。这是 DNS API 权限验证;实际申请证书时,仍可能需要等待公网 DNS-01 记录传播。
|
||||
</small>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user