mirror of
https://github.com/certd/certd.git
synced 2026-06-20 00:17:37 +08:00
Merge branch 'codex/v2-persist-01' into v2-invite
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="flex">
|
||||
<div class="flex captcha-image-input">
|
||||
<a-input :value="valueRef" :placeholder="t('certd.captcha.inputImageCode')" autocomplete="off" @update:value="onChange">
|
||||
<template #prefix>
|
||||
<fs-icon icon="ion:image-outline"></fs-icon>
|
||||
@@ -71,3 +71,10 @@ function emitChange(value: any) {
|
||||
emit("change", value);
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
.captcha-image-input {
|
||||
.input-right {
|
||||
background-color: #cfcfcf;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+15
-8
@@ -11,14 +11,16 @@
|
||||
<td class="record-value" :title="cnameRecord.recordValue">
|
||||
<fs-copyable v-model="cnameRecord.recordValue"></fs-copyable>
|
||||
</td>
|
||||
<td class="status center flex-center">
|
||||
<fs-values-format v-model="cnameRecord.status" :dict="statusDict" />
|
||||
<a-tooltip v-if="cnameRecord.error" :title="cnameRecord.error">
|
||||
<fs-icon class="ml-5 color-red" icon="ion:warning-outline"></fs-icon>
|
||||
</a-tooltip>
|
||||
<a-tooltip v-if="cnameRecord.status === 'valid'" :title="t('certd.verifyPlan.resetStatusTooltip')">
|
||||
<fs-icon class="ml-2 color-yellow text-md pointer" icon="solar:undo-left-square-bold" @click="resetStatus"></fs-icon>
|
||||
</a-tooltip>
|
||||
<td class="status center">
|
||||
<span class="status-content">
|
||||
<fs-values-format v-model="cnameRecord.status" :dict="statusDict" />
|
||||
<a-tooltip v-if="cnameRecord.error" :title="cnameRecord.error">
|
||||
<fs-icon class="ml-5 color-red" icon="ion:warning-outline"></fs-icon>
|
||||
</a-tooltip>
|
||||
<a-tooltip v-if="cnameRecord.status === 'valid'" :title="t('certd.verifyPlan.resetStatusTooltip')">
|
||||
<fs-icon class="ml-2 color-yellow text-md pointer" icon="solar:undo-left-square-bold" @click="resetStatus"></fs-icon>
|
||||
</a-tooltip>
|
||||
</span>
|
||||
</td>
|
||||
<td class="center">
|
||||
<template v-if="cnameRecord.status !== 'valid'">
|
||||
@@ -142,5 +144,10 @@ async function resetStatus() {
|
||||
.fs-copyable {
|
||||
width: 100%;
|
||||
}
|
||||
.status-content {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+20
-5
@@ -2,11 +2,11 @@
|
||||
<table class="cname-verify-plan">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="width: 160px">{{ t("certd.verifyPlan.hostRecord") }}</td>
|
||||
<td style="width: 100px; text-align: center">{{ t("certd.verifyPlan.recordType") }}</td>
|
||||
<td style="width: 250px">{{ t("certd.verifyPlan.setCnameRecord") }}</td>
|
||||
<td style="width: 120px" class="center">{{ t("certd.status") }}</td>
|
||||
<td style="width: 90px" class="center">{{ t("certd.verifyPlan.operation") }}</td>
|
||||
<td class="col-host">{{ t("certd.verifyPlan.hostRecord") }}</td>
|
||||
<td class="col-type center">{{ t("certd.verifyPlan.recordType") }}</td>
|
||||
<td class="col-value">{{ t("certd.verifyPlan.setCnameRecord") }}</td>
|
||||
<td class="col-status center">{{ t("certd.status") }}</td>
|
||||
<td class="col-action center">{{ t("certd.verifyPlan.operation") }}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<template v-for="key in domains" :key="key">
|
||||
@@ -49,6 +49,21 @@ function onRecordChange(domain: string, record: CnameRecord) {
|
||||
.cname-verify-plan {
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
.col-host {
|
||||
width: 220px;
|
||||
}
|
||||
.col-type {
|
||||
width: 100px;
|
||||
}
|
||||
.col-value {
|
||||
width: 360px;
|
||||
}
|
||||
.col-status {
|
||||
width: 120px;
|
||||
}
|
||||
.col-action {
|
||||
width: 150px;
|
||||
}
|
||||
tbody tr td {
|
||||
border-top: 1px solid #e8e8e8 !important;
|
||||
}
|
||||
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<tbody class="dns-persist-record-info">
|
||||
<tr v-if="dnsPersistRecord">
|
||||
<td class="host-record" :title="dnsPersistRecord.hostRecord">
|
||||
<fs-copyable v-model="dnsPersistRecord.hostRecord"></fs-copyable>
|
||||
</td>
|
||||
<td style="text-align: center">TXT</td>
|
||||
<td class="record-value" :title="dnsPersistRecord.recordValue">
|
||||
<fs-copyable v-model="dnsPersistRecord.recordValue"></fs-copyable>
|
||||
</td>
|
||||
<td class="status center">
|
||||
<fs-values-format v-model="dnsPersistRecord.status" :dict="statusDict" />
|
||||
</td>
|
||||
<td class="center">
|
||||
<template v-if="dnsPersistRecord.status !== 'valid'">
|
||||
<a-space>
|
||||
<a-button type="primary" size="small" @click="openSettingDialog">设置TXT</a-button>
|
||||
<a-button type="primary" size="small" :loading="loading" @click="doVerify">校验</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<div v-else class="helper">请勿删除TXT记录</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td colspan="5" class="color-red">{{ errorMessage || "请先选择ACME账号授权" }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
import { message } from "ant-design-vue";
|
||||
import { ref, watch } from "vue";
|
||||
import { GetByDomain, Verify } from "/@/views/certd/cert/dns-persist/api";
|
||||
import { useDnsPersistSettingDialog } from "/@/views/certd/cert/dns-persist/use-setting-dialog";
|
||||
import { DnsPersistRecord } from "./type";
|
||||
|
||||
defineOptions({
|
||||
name: "DnsPersistRecordInfo",
|
||||
});
|
||||
|
||||
const props = defineProps<{
|
||||
domain: string;
|
||||
caType?: string;
|
||||
acmeAccountAccessId?: number;
|
||||
commonAcmeAccountAccessId?: number;
|
||||
wildcard?: boolean;
|
||||
persistUntil?: number;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
change: [DnsPersistRecord];
|
||||
}>();
|
||||
|
||||
const statusDict = dict({
|
||||
data: [
|
||||
{ value: "pending", label: "待设置", color: "warning" },
|
||||
{ value: "validating", label: "校验中", color: "blue" },
|
||||
{ value: "valid", label: "有效", color: "green" },
|
||||
{ value: "failed", label: "请重试", color: "red" },
|
||||
],
|
||||
});
|
||||
|
||||
const dnsPersistRecord = ref<DnsPersistRecord | null>(null);
|
||||
const loading = ref(false);
|
||||
const errorMessage = ref("");
|
||||
const { openDnsPersistSettingDialog } = useDnsPersistSettingDialog();
|
||||
|
||||
function onRecordChange() {
|
||||
if (dnsPersistRecord.value) {
|
||||
emit("change", dnsPersistRecord.value);
|
||||
} else {
|
||||
emit("change", {
|
||||
domain: props.domain,
|
||||
status: null,
|
||||
} as any);
|
||||
}
|
||||
}
|
||||
|
||||
async function loadRecord() {
|
||||
errorMessage.value = "";
|
||||
dnsPersistRecord.value = null;
|
||||
if (!props.domain || (!props.acmeAccountAccessId && !props.commonAcmeAccountAccessId)) {
|
||||
onRecordChange();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
dnsPersistRecord.value = await GetByDomain({
|
||||
domain: props.domain,
|
||||
caType: props.caType,
|
||||
acmeAccountAccessId: props.acmeAccountAccessId,
|
||||
commonAcmeAccountAccessId: props.commonAcmeAccountAccessId,
|
||||
wildcard: props.wildcard,
|
||||
persistUntil: props.persistUntil,
|
||||
createOnNotFound: true,
|
||||
});
|
||||
onRecordChange();
|
||||
} catch (e: any) {
|
||||
errorMessage.value = e.message;
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [props.domain, props.caType, props.acmeAccountAccessId, props.commonAcmeAccountAccessId, props.wildcard, props.persistUntil],
|
||||
async () => {
|
||||
await loadRecord();
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
|
||||
async function doVerify() {
|
||||
if (!dnsPersistRecord.value?.id) {
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
try {
|
||||
const ok = await Verify(dnsPersistRecord.value.id);
|
||||
message[ok ? "success" : "error"](ok ? "校验成功" : "未找到匹配的TXT记录,请稍后重试");
|
||||
await loadRecord();
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function openSettingDialog() {
|
||||
if (!dnsPersistRecord.value) {
|
||||
return;
|
||||
}
|
||||
openDnsPersistSettingDialog({
|
||||
record: dnsPersistRecord.value,
|
||||
onDone: loadRecord,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.dns-persist-record-info {
|
||||
.fs-copyable {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<table class="dns-persist-verify-plan">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="col-host">TXT主机名</td>
|
||||
<td class="col-type center">记录类型</td>
|
||||
<td class="col-value">请设置TXT记录(验证成功以后不要删除)</td>
|
||||
<td class="col-status center">状态</td>
|
||||
<td class="col-action center">操作</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<template v-for="key in domains" :key="key">
|
||||
<dns-persist-record-info
|
||||
:domain="key"
|
||||
:ca-type="caType"
|
||||
:acme-account-access-id="acmeAccountAccessId"
|
||||
:common-acme-account-access-id="commonAcmeAccountAccessId"
|
||||
:wildcard="modelValue[key]?.wildcard"
|
||||
:persist-until="modelValue[key]?.persistUntil"
|
||||
@change="onRecordChange(key, $event)"
|
||||
/>
|
||||
</template>
|
||||
</table>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from "vue";
|
||||
import DnsPersistRecordInfo from "./dns-persist-record-info.vue";
|
||||
import { DnsPersistRecord } from "./type";
|
||||
|
||||
defineOptions({
|
||||
name: "DnsPersistVerifyPlan",
|
||||
});
|
||||
|
||||
const emit = defineEmits(["update:modelValue", "change"]);
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: Record<string, DnsPersistRecord>;
|
||||
caType?: string;
|
||||
acmeAccountAccessId?: number;
|
||||
commonAcmeAccountAccessId?: number;
|
||||
}>();
|
||||
|
||||
const domains = computed(() => {
|
||||
return Object.keys(props.modelValue || {});
|
||||
});
|
||||
|
||||
function onRecordChange(domain: string, record: DnsPersistRecord) {
|
||||
const value = { ...props.modelValue };
|
||||
value[domain] = {
|
||||
...value[domain],
|
||||
...record,
|
||||
};
|
||||
emit("update:modelValue", value);
|
||||
emit("change", value);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.dns-persist-verify-plan {
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
.col-host {
|
||||
width: 220px;
|
||||
}
|
||||
.col-type {
|
||||
width: 100px;
|
||||
}
|
||||
.col-value {
|
||||
width: 360px;
|
||||
}
|
||||
.col-status {
|
||||
width: 120px;
|
||||
}
|
||||
.col-action {
|
||||
width: 150px;
|
||||
}
|
||||
tbody tr td {
|
||||
border-top: 1px solid #e8e8e8 !important;
|
||||
}
|
||||
tr {
|
||||
td {
|
||||
border: 0 !important;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
&.center {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
+48
-1
@@ -46,13 +46,28 @@
|
||||
<div class="form-item">
|
||||
<span class="label">{{ t("certd.verifyPlan.dnsAccess") }}:</span>
|
||||
<span class="input">
|
||||
<access-selector v-model="item.dnsProviderAccessId" size="small" :type="item.dnsProviderAccessType || item.dnsProviderType" :placeholder="t('certd.verifyPlan.pleaseSelect')" @change="onPlanChanged"></access-selector>
|
||||
<access-selector
|
||||
v-model="item.dnsProviderAccessId"
|
||||
size="small"
|
||||
:type="item.dnsProviderAccessType || item.dnsProviderType"
|
||||
:placeholder="t('certd.verifyPlan.pleaseSelect')"
|
||||
@change="onPlanChanged"
|
||||
></access-selector>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="item.type === 'cname'" class="plan-cname">
|
||||
<cname-verify-plan v-model="item.cnameVerifyPlan" @change="onPlanChanged" />
|
||||
</div>
|
||||
<div v-if="item.type === 'dns-persist'" class="plan-dns-persist">
|
||||
<dns-persist-verify-plan
|
||||
v-model="item.dnsPersistVerifyPlan"
|
||||
:ca-type="caType"
|
||||
:acme-account-access-id="acmeAccountAccessId"
|
||||
:common-acme-account-access-id="commonAcmeAccountAccessId"
|
||||
@change="onPlanChanged"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="item.type === 'http'" class="plan-http">
|
||||
<http-verify-plan v-model="item.httpVerifyPlan" @change="onPlanChanged" />
|
||||
<div class="helper">{{ t("certd.verifyPlan.httpHelper") }}</div>
|
||||
@@ -76,6 +91,7 @@ import { useI18n } from "vue-i18n";
|
||||
import { dict, FsDictSelect } from "@fast-crud/fast-crud";
|
||||
import AccessSelector from "/@/views/certd/access/access-selector/index.vue";
|
||||
import CnameVerifyPlan from "./cname-verify-plan.vue";
|
||||
import DnsPersistVerifyPlan from "./dns-persist-verify-plan.vue";
|
||||
import HttpVerifyPlan from "./http-verify-plan.vue";
|
||||
import { Form } from "ant-design-vue";
|
||||
import { DomainsVerifyPlanInput } from "./type";
|
||||
@@ -92,6 +108,10 @@ const challengeTypeOptions = ref<any[]>([
|
||||
label: t("certd.verifyPlan.dnsChallenge"),
|
||||
value: "dns",
|
||||
},
|
||||
{
|
||||
label: "DNS持久验证",
|
||||
value: "dns-persist",
|
||||
},
|
||||
{
|
||||
label: t("certd.verifyPlan.cnameChallenge"),
|
||||
value: "cname",
|
||||
@@ -106,6 +126,9 @@ const props = defineProps<{
|
||||
modelValue?: DomainsVerifyPlanInput;
|
||||
domains?: string[];
|
||||
defaultType?: string;
|
||||
caType?: string;
|
||||
acmeAccountAccessId?: number;
|
||||
commonAcmeAccountAccessId?: number;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -189,11 +212,15 @@ async function onDomainsChanged(domains: string[]) {
|
||||
|
||||
const cnameOrigin = planItem.cnameVerifyPlan;
|
||||
const httpOrigin = planItem.httpVerifyPlan;
|
||||
const dnsPersistOrigin = planItem.dnsPersistVerifyPlan;
|
||||
planItem.cnameVerifyPlan = {};
|
||||
planItem.httpVerifyPlan = {};
|
||||
planItem.dnsPersistVerifyPlan = {};
|
||||
const cnamePlan = planItem.cnameVerifyPlan;
|
||||
const httpPlan = planItem.httpVerifyPlan;
|
||||
const dnsPersistPlan = planItem.dnsPersistVerifyPlan;
|
||||
for (const subDomain of domainGroupItem.keySubDomains) {
|
||||
const wildcard = true;
|
||||
if (!cnameOrigin[subDomain]) {
|
||||
//@ts-ignore
|
||||
planItem.cnameVerifyPlan[subDomain] = {
|
||||
@@ -225,6 +252,19 @@ async function onDomainsChanged(domains: string[]) {
|
||||
domain: subDomain,
|
||||
};
|
||||
}
|
||||
|
||||
if (!dnsPersistOrigin?.[subDomain]) {
|
||||
//@ts-ignore
|
||||
dnsPersistPlan[subDomain] = {
|
||||
domain: subDomain,
|
||||
wildcard,
|
||||
};
|
||||
} else {
|
||||
dnsPersistPlan[subDomain] = {
|
||||
...dnsPersistOrigin[subDomain],
|
||||
wildcard,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
for (const subDomain of Object.keys(cnamePlan)) {
|
||||
@@ -238,6 +278,12 @@ async function onDomainsChanged(domains: string[]) {
|
||||
delete httpPlan[subDomain];
|
||||
}
|
||||
}
|
||||
|
||||
for (const subDomain of Object.keys(dnsPersistPlan)) {
|
||||
if (!domainGroupItem.keySubDomains.includes(subDomain)) {
|
||||
delete dnsPersistPlan[subDomain];
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const domain of Object.keys(planRef.value)) {
|
||||
const mainDomains = Object.keys(domainGroups);
|
||||
@@ -268,6 +314,7 @@ watch(
|
||||
overflow-x: auto;
|
||||
.fullscreen-modal {
|
||||
display: none;
|
||||
background-color: rgba(0, 0, 0, 0.42);
|
||||
}
|
||||
|
||||
&.fullscreen {
|
||||
|
||||
+18
-1
@@ -7,15 +7,32 @@ export type HttpRecord = {
|
||||
httpUploadRootDir: string;
|
||||
};
|
||||
|
||||
export type DnsPersistRecord = {
|
||||
id?: number;
|
||||
domain: string;
|
||||
mainDomain?: string;
|
||||
status?: string;
|
||||
hostRecord?: string;
|
||||
recordValue?: string;
|
||||
caType?: string;
|
||||
acmeAccountAccessId?: number;
|
||||
accountUri?: string;
|
||||
wildcard?: boolean;
|
||||
persistUntil?: number;
|
||||
dnsProviderType?: string;
|
||||
dnsProviderAccess?: number;
|
||||
};
|
||||
|
||||
export type DomainVerifyPlanInput = {
|
||||
domain: string;
|
||||
domains: string[];
|
||||
type: "cname" | "dns" | "http";
|
||||
type: "cname" | "dns" | "http" | "dns-persist";
|
||||
dnsProviderType?: string;
|
||||
dnsProviderAccessType?: string;
|
||||
dnsProviderAccessId?: number;
|
||||
cnameVerifyPlan?: Record<string, CnameRecord>;
|
||||
httpVerifyPlan?: Record<string, HttpRecord>;
|
||||
dnsPersistVerifyPlan?: Record<string, DnsPersistRecord>;
|
||||
};
|
||||
export type DomainsVerifyPlanInput = {
|
||||
[key: string]: DomainVerifyPlanInput;
|
||||
|
||||
+8
@@ -46,6 +46,14 @@ function checkDomainVerifyPlan(rule: any, value: DomainsVerifyPlanInput) {
|
||||
if (!value[domain].dnsProviderType || !value[domain].dnsProviderAccessId) {
|
||||
throw new Error($t("certd.verifyPlan.errors.dnsProviderRequired", { domain }));
|
||||
}
|
||||
} else if (type === "dns-persist") {
|
||||
const subDomains = Object.keys(value[domain].dnsPersistVerifyPlan || {});
|
||||
for (const subDomain of subDomains) {
|
||||
const plan = value[domain].dnsPersistVerifyPlan[subDomain];
|
||||
if (plan.status !== "valid") {
|
||||
throw new Error(`DNS持久验证记录(${subDomain})还未校验成功`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div class="refresh-input">
|
||||
<div class="refresh-input-line">
|
||||
<a-input class="refresh-input-control" :value="value" :placeholder="placeholder" allow-clear @update:value="emit('update:value', $event)"></a-input>
|
||||
<fs-button :loading="loading" type="primary" :text="buttonText" :icon="icon" @click="doRefresh"></fs-button>
|
||||
<a-input class="refresh-input-control" :value="value" :placeholder="placeholder" :allow-clear="!disabled" :disabled="disabled" @update:value="emit('update:value', $event)"></a-input>
|
||||
<fs-button :loading="loading" :disabled="disabled" type="primary" :text="buttonText" :icon="icon" @click="doRefresh"></fs-button>
|
||||
</div>
|
||||
<div class="helper" :class="{ error: hasError }">
|
||||
{{ message }}
|
||||
@@ -25,6 +25,7 @@ type RefreshInputProps = ComponentPropsType & {
|
||||
icon?: string;
|
||||
placeholder?: string;
|
||||
successMessage?: string;
|
||||
disabled?: boolean;
|
||||
};
|
||||
|
||||
const fromType: any = inject("getFromType");
|
||||
@@ -49,6 +50,9 @@ const placeholder = computed(() => props.placeholder || "");
|
||||
const successMessage = computed(() => props.successMessage || "刷新成功,请保存配置");
|
||||
|
||||
const doRefresh = async () => {
|
||||
if (props.disabled) {
|
||||
return;
|
||||
}
|
||||
if (loading.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ function createChallengeTypeDict() {
|
||||
return dict({
|
||||
data: [
|
||||
{ value: "dns", label: $t("certd.verifyPlan.dnsChallenge"), color: "green" },
|
||||
{ value: "dns-persist", label: "DNS持久验证", color: "cyan" },
|
||||
{ value: "cname", label: $t("certd.verifyPlan.cnameProxyChallenge"), color: "blue" },
|
||||
{ value: "http", label: $t("certd.verifyPlan.httpChallenge"), color: "yellow" },
|
||||
],
|
||||
@@ -39,7 +40,12 @@ export const Dicts = {
|
||||
sslProviderDict: dict({
|
||||
data: [
|
||||
{ value: "letsencrypt", label: "Let's Encrypt" },
|
||||
{ value: "letsencrypt_staging", label: "Let's Encrypt测试环境" },
|
||||
{ value: "google", label: "Google" },
|
||||
{ value: "zerossl", label: "ZeroSSL" },
|
||||
{ value: "sslcom", label: "SSL.com" },
|
||||
{ value: "litessl", label: "litessl" },
|
||||
{ value: "custom", label: "自定义ACME" },
|
||||
],
|
||||
}),
|
||||
get challengeTypeDict() {
|
||||
|
||||
@@ -11,6 +11,7 @@ export default {
|
||||
siteMonitor: "Site Certificate Monitor",
|
||||
settings: "Settings",
|
||||
accessManager: "Access Management",
|
||||
dnsPersistRecord: "DNS Persist Records",
|
||||
subDomain: "Subdomain Delegation Settings",
|
||||
pipelineGroup: "Pipeline Group Management",
|
||||
openKey: "Open API Key",
|
||||
|
||||
@@ -11,6 +11,7 @@ export default {
|
||||
siteMonitor: "站点证书监控",
|
||||
settings: "设置",
|
||||
accessManager: "授权管理",
|
||||
dnsPersistRecord: "DNS持久验证记录",
|
||||
subDomain: "子域名托管设置",
|
||||
pipelineGroup: "流水线分组管理",
|
||||
openKey: "开放接口密钥",
|
||||
|
||||
@@ -186,6 +186,17 @@ export const certdResources = [
|
||||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "certd.dnsPersistRecord",
|
||||
name: "DnsPersistRecord",
|
||||
path: "/certd/cert/dns-persist",
|
||||
component: "/certd/cert/dns-persist/index.vue",
|
||||
meta: {
|
||||
icon: "ion:shield-half-outline",
|
||||
auth: true,
|
||||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "certd.subDomain",
|
||||
name: "SubDomain",
|
||||
|
||||
@@ -12,6 +12,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
const { props, ctx, api } = context;
|
||||
const lastResRef = ref();
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
query.query = query.query || {};
|
||||
if (props.subtype) {
|
||||
query.query.subtype = props.subtype;
|
||||
} else {
|
||||
delete query.query.subtype;
|
||||
}
|
||||
return await context.api.GetList(query);
|
||||
};
|
||||
const editRequest = async (req: EditReq) => {
|
||||
@@ -47,7 +53,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
const { myProjectDict } = useDicts();
|
||||
const typeRef = ref("aliyun");
|
||||
context.typeRef = typeRef;
|
||||
const commonColumnsDefine = getCommonColumnDefine(crudExpose, typeRef, api);
|
||||
const commonColumnsDefine = getCommonColumnDefine(crudExpose, typeRef, api, props.subtype);
|
||||
commonColumnsDefine.type.form.component.disabled = true;
|
||||
const projectStore = useProjectStore();
|
||||
return {
|
||||
|
||||
@@ -21,6 +21,10 @@ export default defineComponent({
|
||||
type: String, //user | sys
|
||||
default: "user",
|
||||
},
|
||||
subtype: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
modelValue: {},
|
||||
},
|
||||
emits: ["update:modelValue"],
|
||||
@@ -30,10 +34,17 @@ export default defineComponent({
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
|
||||
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
function refreshSearch() {
|
||||
const form: any = { type: props.type };
|
||||
if (props.subtype) {
|
||||
form.subtype = props.subtype;
|
||||
}
|
||||
crudExpose.setSearchFormData({ form, mergeForm: true });
|
||||
crudExpose.doRefresh();
|
||||
}
|
||||
function onTypeChanged(value: any) {
|
||||
context.typeRef.value = value;
|
||||
crudExpose.setSearchFormData({ form: { type: value }, mergeForm: true });
|
||||
crudExpose.doRefresh();
|
||||
refreshSearch();
|
||||
}
|
||||
watch(
|
||||
() => {
|
||||
@@ -44,6 +55,14 @@ export default defineComponent({
|
||||
onTypeChanged(value);
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => {
|
||||
return props.subtype;
|
||||
},
|
||||
() => {
|
||||
refreshSearch();
|
||||
}
|
||||
);
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
onTypeChanged(props.type);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<a-form-item-rest v-if="chooseForm.show">
|
||||
<a-modal v-model:open="chooseForm.show" title="选择授权提供者" width="900px" @ok="chooseForm.ok">
|
||||
<div style="height: 400px; position: relative">
|
||||
<cert-access-modal v-model="selectedId" :type="type" :from="from"></cert-access-modal>
|
||||
<cert-access-modal v-model="selectedId" :type="type" :subtype="subtype" :from="from"></cert-access-modal>
|
||||
</div>
|
||||
</a-modal>
|
||||
</a-form-item-rest>
|
||||
@@ -35,6 +35,10 @@ export default defineComponent({
|
||||
type: String,
|
||||
default: "aliyun",
|
||||
},
|
||||
subtype: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: "请选择",
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { ColumnCompositionProps, dict } from "@fast-crud/fast-crud";
|
||||
import { computed, provide, ref, toRef } from "vue";
|
||||
import { provide, ref, toRef } from "vue";
|
||||
import { useReference } from "/@/use/use-refrence";
|
||||
import { forEach, get, merge, set } from "lodash-es";
|
||||
import SecretPlainGetter from "/@/views/certd/access/access-selector/access/secret-plain-getter.vue";
|
||||
import { utils } from "/@/utils";
|
||||
|
||||
export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any, fixedSubtype?: string) {
|
||||
provide("getFromType", api.from);
|
||||
provide("accessApi", api);
|
||||
provide("get:plugin:type", () => {
|
||||
@@ -34,6 +34,13 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
}
|
||||
}
|
||||
console.log('crudBinding.value[mode + "Form"].columns', columnsRef.value);
|
||||
if (mode === "add" && define.subtype && fixedSubtype) {
|
||||
form.access = form.access || {};
|
||||
const subtypeKey = `access.${define.subtype}`;
|
||||
if (get(form, subtypeKey) == null) {
|
||||
set(form, subtypeKey, fixedSubtype);
|
||||
}
|
||||
}
|
||||
forEach(define.input, (value: any, mapKey: any) => {
|
||||
const key = "access." + mapKey;
|
||||
const field = {
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
import { request } from "/src/api/service";
|
||||
|
||||
const apiPrefix = "/cert/dns-persist";
|
||||
|
||||
export async function GetList(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query,
|
||||
});
|
||||
}
|
||||
|
||||
export async function AddObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
export async function UpdateObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
export async function DelObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
export async function BuildRecord(body: { domain: string; accountUri: string; wildcard?: boolean; persistUntil?: number }) {
|
||||
return await request({
|
||||
url: apiPrefix + "/build",
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
}
|
||||
|
||||
export async function GetByDomain(body: { domain: string; caType?: string; acmeAccountAccessId?: number; commonAcmeAccountAccessId?: number; wildcard?: boolean; persistUntil?: number; createOnNotFound?: boolean }) {
|
||||
return await request({
|
||||
url: apiPrefix + "/getByDomain",
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
}
|
||||
|
||||
export async function CheckRecord(body: { hostRecord: string; recordValue: string }) {
|
||||
return await request({
|
||||
url: apiPrefix + "/check",
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
}
|
||||
|
||||
export async function Verify(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/verify",
|
||||
method: "post",
|
||||
data: { id },
|
||||
});
|
||||
}
|
||||
|
||||
export async function TriggerVerify(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/triggerVerify",
|
||||
method: "post",
|
||||
data: { id },
|
||||
});
|
||||
}
|
||||
|
||||
export async function CreateTxt(body: { id: number; dnsProviderType?: string; dnsProviderAccess?: number }) {
|
||||
return await request({
|
||||
url: apiPrefix + "/createTxt",
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,349 @@
|
||||
import { AddReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { message, Modal, notification } from "ant-design-vue";
|
||||
import * as api from "./api";
|
||||
import { Dicts } from "/@/components/plugins/lib/dicts";
|
||||
import { createAccessApi } from "/@/views/certd/access/api";
|
||||
import { useDnsPersistSettingDialog } from "./use-setting-dialog";
|
||||
|
||||
function parseAccount(account: any) {
|
||||
if (!account) {
|
||||
return null;
|
||||
}
|
||||
if (typeof account === "string") {
|
||||
return JSON.parse(account);
|
||||
}
|
||||
return account;
|
||||
}
|
||||
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const accessApi = createAccessApi();
|
||||
const { openDnsPersistSettingDialog } = useDnsPersistSettingDialog();
|
||||
const accessDict = dict({
|
||||
value: "id",
|
||||
label: "name",
|
||||
url: "accessDict",
|
||||
async getNodesByValues(ids: number[]) {
|
||||
return await accessApi.GetDictByIds(ids);
|
||||
},
|
||||
});
|
||||
|
||||
const dnsProviderTypeDict = dict({
|
||||
url: "pi/dnsProvider/dnsProviderTypeDict",
|
||||
});
|
||||
const statusDict = dict({
|
||||
data: [
|
||||
{ value: "pending", label: "待设置", color: "warning" },
|
||||
{ value: "created", label: "已创建", color: "blue" },
|
||||
{ value: "validating", label: "校验中", color: "blue" },
|
||||
{ value: "valid", label: "有效", color: "green" },
|
||||
{ value: "failed", label: "请重试", color: "red" },
|
||||
],
|
||||
});
|
||||
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
const res = await api.DelObj(row.id);
|
||||
if (res?.message) {
|
||||
notification.warning({
|
||||
message: "请到供应商删除TXT记录",
|
||||
description: res.message,
|
||||
duration: 0,
|
||||
});
|
||||
}
|
||||
return res;
|
||||
};
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
async function fillRecord(form: any) {
|
||||
if (!form.domain || !form.acmeAccountAccessId) {
|
||||
return;
|
||||
}
|
||||
const access: any = await accessApi.GetObj(form.acmeAccountAccessId);
|
||||
const setting = JSON.parse(access.setting || "{}");
|
||||
const account = parseAccount(setting.account);
|
||||
if (!account?.accountUri) {
|
||||
message.error("ACME账号授权缺少accountUri,请重新生成账号");
|
||||
return;
|
||||
}
|
||||
const record = await api.BuildRecord({
|
||||
domain: form.domain,
|
||||
accountUri: account.accountUri,
|
||||
wildcard: true,
|
||||
persistUntil: form.persistUntil,
|
||||
});
|
||||
form.caType = account.caType;
|
||||
form.accountUri = account.accountUri;
|
||||
form.hostRecord = record.hostRecord;
|
||||
form.recordValue = record.recordValue;
|
||||
form.status = "pending";
|
||||
}
|
||||
|
||||
async function verifyRecord(row: any) {
|
||||
const ok = await api.Verify(row.id);
|
||||
message[ok ? "success" : "error"](ok ? "校验成功" : "未找到匹配的TXT记录,请稍后重试");
|
||||
await crudExpose.doRefresh();
|
||||
return ok;
|
||||
}
|
||||
|
||||
function showRecordHelp(row: any) {
|
||||
openDnsPersistSettingDialog({
|
||||
record: row,
|
||||
async onDone() {
|
||||
await crudExpose.doRefresh();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest,
|
||||
},
|
||||
actionbar: {
|
||||
buttons: {
|
||||
add: {
|
||||
icon: "ion:add-circle-outline",
|
||||
},
|
||||
},
|
||||
},
|
||||
rowHandle: {
|
||||
minWidth: 120,
|
||||
fixed: "right",
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
key: "id",
|
||||
type: "number",
|
||||
column: { width: 80, order: -999 },
|
||||
form: { show: false },
|
||||
},
|
||||
domain: {
|
||||
title: "域名",
|
||||
type: "text",
|
||||
search: { show: true },
|
||||
form: {
|
||||
required: true,
|
||||
valueChange({ form }) {
|
||||
fillRecord(form);
|
||||
},
|
||||
},
|
||||
},
|
||||
mainDomain: {
|
||||
title: "主域名",
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 160,
|
||||
order: 901,
|
||||
},
|
||||
},
|
||||
wildcard: {
|
||||
title: "通配符",
|
||||
type: "dict-switch",
|
||||
form: {
|
||||
show: false,
|
||||
value: true,
|
||||
},
|
||||
column: { show: false },
|
||||
},
|
||||
acmeAccountAccessId: {
|
||||
title: "ACME账号授权",
|
||||
type: "dict-select",
|
||||
dict: accessDict,
|
||||
form: {
|
||||
required: true,
|
||||
order: -9,
|
||||
component: {
|
||||
name: "AccessSelector",
|
||||
vModel: "modelValue",
|
||||
type: "acmeAccount",
|
||||
subtype: compute(({ form }) => {
|
||||
return form.caType;
|
||||
}),
|
||||
},
|
||||
valueChange({ form }) {
|
||||
fillRecord(form);
|
||||
},
|
||||
},
|
||||
column: {
|
||||
width: 180,
|
||||
},
|
||||
},
|
||||
caType: {
|
||||
title: "颁发机构",
|
||||
type: "dict-select",
|
||||
dict: Dicts.sslProviderDict,
|
||||
form: {
|
||||
required: true,
|
||||
value: "letsencrypt",
|
||||
order: -10,
|
||||
valueChange({ form }) {
|
||||
form.acmeAccountAccessId = null;
|
||||
fillRecord(form);
|
||||
},
|
||||
},
|
||||
column: { width: 120 },
|
||||
},
|
||||
persistUntil: {
|
||||
title: "有效期至",
|
||||
type: "datetime",
|
||||
form: {
|
||||
helper: "可选;为空表示长期有效",
|
||||
order: 20,
|
||||
valueChange({ form }) {
|
||||
fillRecord(form);
|
||||
},
|
||||
},
|
||||
column: { width: 180, order: 900 },
|
||||
},
|
||||
hostRecord: {
|
||||
title: "TXT主机名",
|
||||
type: "copyable",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 220,
|
||||
cellRender({ value }) {
|
||||
return (
|
||||
<a-tooltip title={value}>
|
||||
<fs-copyable modelValue={value}></fs-copyable>
|
||||
</a-tooltip>
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
recordValue: {
|
||||
title: "请设置TXT记录",
|
||||
type: "copyable",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 380,
|
||||
cellRender({ value }) {
|
||||
return (
|
||||
<a-tooltip title={value}>
|
||||
<fs-copyable modelValue={value}></fs-copyable>
|
||||
</a-tooltip>
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
dnsProviderType: {
|
||||
title: "DNS服务商",
|
||||
type: "dict-select",
|
||||
dict: dnsProviderTypeDict,
|
||||
form: {
|
||||
show: false,
|
||||
component: {
|
||||
name: "DnsProviderSelector",
|
||||
},
|
||||
},
|
||||
column: { show: false },
|
||||
},
|
||||
dnsProviderAccess: {
|
||||
title: "DNS授权",
|
||||
type: "dict-select",
|
||||
dict: accessDict,
|
||||
form: {
|
||||
show: false,
|
||||
component: {
|
||||
name: "AccessSelector",
|
||||
vModel: "modelValue",
|
||||
type: compute(({ form }) => {
|
||||
const type = form.dnsProviderType || "aliyun";
|
||||
return dnsProviderTypeDict?.dataMap[type]?.accessType || type;
|
||||
}),
|
||||
},
|
||||
},
|
||||
column: { show: false },
|
||||
},
|
||||
status: {
|
||||
title: "状态",
|
||||
type: "dict-select",
|
||||
dict: statusDict,
|
||||
form: {
|
||||
show: false,
|
||||
value: "pending",
|
||||
},
|
||||
column: {
|
||||
width: 120,
|
||||
cellRender({ value, row }) {
|
||||
async function resetStatus() {
|
||||
Modal.confirm({
|
||||
title: "重新校验",
|
||||
content: "确认将该记录状态重置为待设置,并重新校验吗?",
|
||||
onOk: async () => {
|
||||
await api.UpdateObj({ id: row.id, status: "pending" });
|
||||
await verifyRecord(row);
|
||||
},
|
||||
});
|
||||
}
|
||||
return (
|
||||
<div class={"flex flex-left"}>
|
||||
<fs-values-format modelValue={value} dict={statusDict}></fs-values-format>
|
||||
{row.status === "valid" && (
|
||||
<a-tooltip title="撤销并重新校验">
|
||||
<fs-icon class={"ml-5 pointer color-yellow"} icon="solar:undo-left-square-bold" onClick={resetStatus}></fs-icon>
|
||||
</a-tooltip>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
triggerValidate: {
|
||||
title: "校验",
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
conditionalRenderDisabled: true,
|
||||
width: 210,
|
||||
align: "center",
|
||||
cellRender({ row }) {
|
||||
return (
|
||||
<a-space>
|
||||
{row.status === "valid" ? (
|
||||
<span class="text-gray-500">请勿删除TXT记录</span>
|
||||
) : (
|
||||
<>
|
||||
<a-button type="primary" size="small" onClick={() => showRecordHelp(row)}>
|
||||
设置TXT
|
||||
</a-button>
|
||||
<a-button type="primary" size="small" onClick={() => verifyRecord(row)}>
|
||||
校验
|
||||
</a-button>
|
||||
</>
|
||||
)}
|
||||
</a-space>
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
accountUri: {
|
||||
title: "Account URI",
|
||||
type: "text",
|
||||
form: { show: false },
|
||||
column: { show: false },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<fs-page class="page-cert-dns-persist">
|
||||
<template #header>
|
||||
<div>
|
||||
<div class="title">DNS持久验证记录</div>
|
||||
<div class="text-orange-500 mt-5">当前仅 Let's Encrypt 测试环境可以申请 DNS 持久验证证书。</div>
|
||||
</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding"></fs-crud>
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onActivated, onMounted } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
|
||||
defineOptions({
|
||||
name: "DnsPersistRecord",
|
||||
});
|
||||
|
||||
const context: any = {
|
||||
permission: { isProjectPermission: true },
|
||||
};
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
|
||||
|
||||
onMounted(() => {
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
onActivated(async () => {
|
||||
await crudExpose.doRefresh();
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,133 @@
|
||||
import { message } from "ant-design-vue";
|
||||
import { reactive } from "vue";
|
||||
import AccessSelector from "/@/views/certd/access/access-selector/index.vue";
|
||||
import DnsProviderSelector from "/@/components/plugins/cert/dns-provider-selector/index.vue";
|
||||
import { useFormDialog } from "/@/use/use-dialog";
|
||||
import { CreateTxt, TriggerVerify } from "./api";
|
||||
|
||||
export type DnsPersistSettingRecord = {
|
||||
id?: number;
|
||||
mainDomain?: string;
|
||||
hostRecord?: string;
|
||||
recordValue?: string;
|
||||
dnsProviderType?: string;
|
||||
dnsProviderAccess?: number;
|
||||
};
|
||||
|
||||
export function useDnsPersistSettingDialog() {
|
||||
const { openFormDialog } = useFormDialog();
|
||||
|
||||
function copyableRow(label: string, value?: string) {
|
||||
return (
|
||||
<div class="mb-10 flex items-center">
|
||||
<div style={{ width: "90px", flexShrink: 0 }}>{label}</div>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
<fs-copyable class="w-full" model-value={value || ""}></fs-copyable>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
async function openDnsPersistSettingDialog(req: { record: DnsPersistSettingRecord; onDone?: () => Promise<void> | void }) {
|
||||
const record = req.record;
|
||||
const form = reactive({
|
||||
mode: "manual",
|
||||
dnsProviderType: record.dnsProviderType || "",
|
||||
dnsProviderAccessType: "",
|
||||
dnsProviderAccess: record.dnsProviderAccess || null,
|
||||
});
|
||||
|
||||
async function submit() {
|
||||
if (!record.id) {
|
||||
return;
|
||||
}
|
||||
if (form.mode === "manual") {
|
||||
await TriggerVerify(record.id);
|
||||
message.success("已提交校验");
|
||||
await req.onDone?.();
|
||||
return;
|
||||
}
|
||||
if (!form.dnsProviderType || !form.dnsProviderAccess) {
|
||||
throw new Error("请选择DNS服务商和授权");
|
||||
}
|
||||
await CreateTxt({
|
||||
id: record.id,
|
||||
dnsProviderType: form.dnsProviderType,
|
||||
dnsProviderAccess: form.dnsProviderAccess,
|
||||
});
|
||||
message.success("TXT记录已创建");
|
||||
await req.onDone?.();
|
||||
}
|
||||
|
||||
await openFormDialog({
|
||||
title: "设置DNS TXT记录",
|
||||
wrapper: {
|
||||
width: 680,
|
||||
buttons: {
|
||||
reset: {
|
||||
show: false,
|
||||
},
|
||||
ok: {
|
||||
show: true,
|
||||
text: "确定",
|
||||
},
|
||||
},
|
||||
},
|
||||
body: () => (
|
||||
<div>
|
||||
<a-radio-group value={form.mode} buttonStyle="solid" class="mb-10" onUpdate:value={(value: string) => (form.mode = value)}>
|
||||
<a-radio-button value="manual">手动添加</a-radio-button>
|
||||
<a-radio-button value="auto">选择授权添加</a-radio-button>
|
||||
</a-radio-group>
|
||||
{form.mode === "manual" ? (
|
||||
<div>
|
||||
<a-alert class="mb-10" type="info" show-icon message="请到DNS解析控制台添加以下TXT记录,添加后点击确定会立即校验。" />
|
||||
{copyableRow("主域名", record.mainDomain)}
|
||||
{copyableRow("TXT主机名", record.hostRecord)}
|
||||
{copyableRow("TXT值", record.recordValue)}
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
<a-alert class="mb-10" type="info" show-icon message="请选择DNS服务商和授权,系统会创建TXT记录,后续校验由后台完成。" />
|
||||
{copyableRow("主域名", record.mainDomain)}
|
||||
<div class="mb-10 flex items-center">
|
||||
<div style={{ width: "90px", flexShrink: 0 }}>DNS服务商</div>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
<DnsProviderSelector
|
||||
class="w-full"
|
||||
style={{ width: "100%" }}
|
||||
modelValue={form.dnsProviderType}
|
||||
onUpdate:modelValue={(value: string) => {
|
||||
form.dnsProviderType = value;
|
||||
form.dnsProviderAccess = null;
|
||||
}}
|
||||
onSelectedChange={(option: any) => {
|
||||
form.dnsProviderAccessType = option?.accessType || form.dnsProviderType;
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-10 flex items-center">
|
||||
<div style={{ width: "90px", flexShrink: 0 }}>DNS授权</div>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
<AccessSelector
|
||||
modelValue={form.dnsProviderAccess}
|
||||
type={form.dnsProviderAccessType || form.dnsProviderType || "aliyun"}
|
||||
onUpdate:modelValue={(value: number) => {
|
||||
form.dnsProviderAccess = value;
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
onSubmit: submit,
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
openDnsPersistSettingDialog,
|
||||
};
|
||||
}
|
||||
@@ -92,6 +92,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
if (form.challengeType === "cname") {
|
||||
throw new Error(t("certd.domain.cnameManagedInCnamePage"));
|
||||
}
|
||||
if (form.challengeType === "dns-persist") {
|
||||
throw new Error("DNS持久验证记录请在DNS持久验证记录页面管理");
|
||||
}
|
||||
if (form.challengeType === "dns") {
|
||||
const isSubdomain = await api.IsSubdomain({ domain: form.domain });
|
||||
if (isSubdomain && !subdomainConfirmed.value) {
|
||||
@@ -221,6 +224,17 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
crudExpose.getFormWrapperRef().close();
|
||||
},
|
||||
});
|
||||
} else if (value === "dns-persist") {
|
||||
Modal.confirm({
|
||||
title: "请前往DNS持久验证记录页面添加记录",
|
||||
content: "DNS持久验证需要先配置ACME账号和_validation-persist持久TXT记录,续期时不再增删DNS记录;当前仅 Let's Encrypt 测试环境可以申请。",
|
||||
async onOk() {
|
||||
router.push({
|
||||
path: "/certd/cert/dns-persist",
|
||||
});
|
||||
crudExpose.getFormWrapperRef().close();
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
+4
@@ -213,6 +213,10 @@ function useStepForm() {
|
||||
const stepOpen = (step: any, emit: any) => {
|
||||
callback.value = emit;
|
||||
currentStep.value = merge({ input: {}, strategy: {} }, step);
|
||||
// 旧版证书申请任务没有 version 字段,编辑时补成 1,保持旧任务继续走兼容逻辑。
|
||||
if (mode.value === "edit" && currentStep.value.type === "CertApply" && currentStep.value.input?.version == null) {
|
||||
currentStep.value.input.version = 1;
|
||||
}
|
||||
if (step.type) {
|
||||
changeCurrentPlugin(currentStep.value);
|
||||
}
|
||||
|
||||
@@ -204,6 +204,7 @@ const hasNewVersion = computed(() => {
|
||||
return isNewVersion(version.value, latestVersion.value);
|
||||
});
|
||||
async function loadLatestVersion() {
|
||||
// version.value = settingsStore.app.version; //前端有缓存 可能不准确
|
||||
latestVersion.value = await api.GetLatestVersion();
|
||||
console.log("latestVersion", latestVersion.value);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</div>
|
||||
<div class="flex-between mt-5">
|
||||
<div class="flex-o"><fs-icon icon="ant-design:check-outlined" class="color-green mr-5" /> 监控站点数:</div>
|
||||
<suite-value :model-value="detail.monitorCount.max" :used="detail.monitorCount.used" unit="次" />
|
||||
<suite-value :model-value="detail.monitorCount.max" :used="detail.monitorCount.used" unit="个" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -265,7 +265,6 @@ onMounted(() => {});
|
||||
.input-right {
|
||||
width: 160px;
|
||||
margin-left: 10px;
|
||||
background: #cfcfcf !important;
|
||||
}
|
||||
|
||||
.forge-password {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<passkey-login></passkey-login>
|
||||
<template v-for="item in oauthProviderList" :key="buildProviderKey(item)">
|
||||
<div v-if="item.addonId" class="oauth-icon-button pointer" @click="goOauthLogin(item)">
|
||||
<div><fs-icon :icon="item.icon" class="text-blue-600 text-40" /></div>
|
||||
<div><fs-icon :icon="item.icon" class="text-40" /></div>
|
||||
<div class="ellipsis title" :title="item.addonTitle || item.title">{{ item.addonTitle || item.title }}</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -125,7 +125,6 @@ async function goOauthLogin(item: OauthProviderItem) {
|
||||
}
|
||||
.fs-icon {
|
||||
font-size: 36px;
|
||||
color: #006be6;
|
||||
margin: 0px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<div class="sys-plugin-config settings-form">
|
||||
<a-form :model="formState" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onFinish" @finish-failed="onFinishFailed">
|
||||
<a-form-item label="公共Google EAB授权" :name="['CertApply', 'sysSetting', 'input', 'googleCommonEabAccessId']">
|
||||
<a-form-item v-show="false" label="公共Google EAB授权" :name="['CertApply', 'sysSetting', 'input', 'googleCommonEabAccessId']">
|
||||
<access-selector v-model:model-value="formState.CertApply.sysSetting.input.googleCommonEabAccessId" type="eab" from="sys"></access-selector>
|
||||
<div class="helper">
|
||||
<div>设置公共Google EAB授权给用户使用,避免用户自己去翻墙获取Google EAB授权</div>
|
||||
@@ -16,7 +16,14 @@
|
||||
</div>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="公共ZeroSSL EAB授权" :name="['CertApply', 'sysSetting', 'input', 'zerosslCommonEabAccessId']">
|
||||
<a-form-item label="公共Google ACME账号" :name="['CertApply', 'sysSetting', 'input', 'googleCommonAcmeAccountAccessId']">
|
||||
<access-selector v-model:model-value="formState.CertApply.sysSetting.input.googleCommonAcmeAccountAccessId" type="acmeAccount" subtype="google" from="sys"></access-selector>
|
||||
<div class="helper">
|
||||
<div>优先推荐配置公共ACME账号。配置后普通用户申请Google证书时无需选择账号,也不会重复消费公共EAB。</div>
|
||||
</div>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item v-show="false" label="公共ZeroSSL EAB授权" :name="['CertApply', 'sysSetting', 'input', 'zerosslCommonEabAccessId']">
|
||||
<access-selector v-model:model-value="formState.CertApply.sysSetting.input.zerosslCommonEabAccessId" type="eab" from="sys"></access-selector>
|
||||
<div class="helper">
|
||||
<div>设置公共ZeroSSL EAB授权给用户使用,避免用户自己去翻墙获取Zero EAB授权</div>
|
||||
@@ -26,7 +33,11 @@
|
||||
</div>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="公共litessl EAB授权" :name="['CertApply', 'sysSetting', 'input', 'litesslCommonEabAccessId']">
|
||||
<a-form-item label="公共ZeroSSL ACME账号" :name="['CertApply', 'sysSetting', 'input', 'zerosslCommonAcmeAccountAccessId']">
|
||||
<access-selector v-model:model-value="formState.CertApply.sysSetting.input.zerosslCommonAcmeAccountAccessId" type="acmeAccount" subtype="zerossl" from="sys"></access-selector>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item v-show="false" label="公共litessl EAB授权" :name="['CertApply', 'sysSetting', 'input', 'litesslCommonEabAccessId']">
|
||||
<access-selector v-model:model-value="formState.CertApply.sysSetting.input.litesslCommonEabAccessId" type="eab" from="sys"></access-selector>
|
||||
<div class="helper">
|
||||
<div>设置公共litessl EAB授权给用户使用,避免用户自己获取litessl EAB授权</div>
|
||||
@@ -36,6 +47,10 @@
|
||||
</div>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="公共litessl ACME账号" :name="['CertApply', 'sysSetting', 'input', 'litesslCommonAcmeAccountAccessId']">
|
||||
<access-selector v-model:model-value="formState.CertApply.sysSetting.input.litesslCommonAcmeAccountAccessId" type="acmeAccount" subtype="litessl" from="sys"></access-selector>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="其他配置">
|
||||
<a-button type="primary" @click="doPluginConfig">证书申请插件默认值设置</a-button>
|
||||
<div class="helper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<a-tag color="green"> {{ durationDict.dataMap[modelValue]?.label }}</a-tag>
|
||||
<a-tag color="green"> {{ durationDict.dataMap[modelValue]?.label || modelValue + "天" }}</a-tag>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
|
||||
@@ -123,10 +123,15 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
value: "id",
|
||||
label: "nickName",
|
||||
}),
|
||||
editForm: {
|
||||
component: {
|
||||
disabled: true,
|
||||
},
|
||||
},
|
||||
form: {
|
||||
show: true,
|
||||
component: {
|
||||
disabled: true,
|
||||
disabled: false,
|
||||
crossPage: true,
|
||||
multiple: false,
|
||||
select: {
|
||||
@@ -170,11 +175,6 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
productType: {
|
||||
title: t("certd.type"),
|
||||
type: "dict-select",
|
||||
editForm: {
|
||||
component: {
|
||||
disabled: true,
|
||||
},
|
||||
},
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t("certd.package"), value: "suite", color: "green" },
|
||||
@@ -182,7 +182,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
show: true,
|
||||
show: false,
|
||||
component: {
|
||||
disabled: true,
|
||||
},
|
||||
@@ -205,6 +205,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
"content.maxDomainCount": {
|
||||
title: t("certd.domain_count"),
|
||||
type: "text",
|
||||
addForm: {
|
||||
show: false,
|
||||
},
|
||||
form: {
|
||||
key: ["content", "maxDomainCount"],
|
||||
component: {
|
||||
@@ -227,6 +230,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
"content.maxWildcardDomainCount": {
|
||||
title: t("certd.wildcardDomainCountPart"),
|
||||
type: "text",
|
||||
addForm: {
|
||||
show: false,
|
||||
},
|
||||
form: {
|
||||
key: ["content", "maxWildcardDomainCount"],
|
||||
component: {
|
||||
@@ -249,6 +255,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
"content.maxPipelineCount": {
|
||||
title: t("certd.pipeline_count"),
|
||||
type: "text",
|
||||
addForm: {
|
||||
show: false,
|
||||
},
|
||||
form: {
|
||||
key: ["content", "maxPipelineCount"],
|
||||
component: {
|
||||
@@ -271,6 +280,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
"content.maxDeployCount": {
|
||||
title: t("certd.deploy_count"),
|
||||
type: "text",
|
||||
addForm: {
|
||||
show: false,
|
||||
},
|
||||
form: {
|
||||
key: ["content", "maxDeployCount"],
|
||||
component: {
|
||||
@@ -296,6 +308,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
"content.maxMonitorCount": {
|
||||
title: t("certd.monitor_count"),
|
||||
type: "text",
|
||||
addForm: {
|
||||
show: false,
|
||||
},
|
||||
form: {
|
||||
key: ["content", "maxMonitorCount"],
|
||||
component: {
|
||||
@@ -317,7 +332,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
duration: {
|
||||
title: t("certd.duration"),
|
||||
type: "text",
|
||||
type: "number",
|
||||
addForm: {
|
||||
show: false,
|
||||
},
|
||||
form: {
|
||||
rules: [{ required: true, message: t("certd.field_required") }],
|
||||
},
|
||||
@@ -363,6 +381,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
expiresTime: {
|
||||
title: t("certd.expires_time"),
|
||||
type: "date",
|
||||
addForm: {
|
||||
show: false,
|
||||
},
|
||||
form: {
|
||||
valueBuilder: ({ value }) => {
|
||||
return dayjs(value);
|
||||
@@ -393,6 +414,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
{ label: t("certd.is_present_no"), value: false, color: "blue" },
|
||||
],
|
||||
}),
|
||||
addForm: {
|
||||
show: false,
|
||||
},
|
||||
form: {
|
||||
value: true,
|
||||
},
|
||||
@@ -404,6 +428,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
deployCountUsed: {
|
||||
title: t("certd.deploy_count_used"),
|
||||
type: "number",
|
||||
addForm: {
|
||||
show: false,
|
||||
},
|
||||
form: {
|
||||
value: 0,
|
||||
rules: [{ required: true, message: t("certd.field_required") }],
|
||||
|
||||
Reference in New Issue
Block a user