mirror of
https://github.com/certd/certd.git
synced 2026-07-10 15:17:32 +08:00
Merge branch 'codex/v2-persist-01' into v2-invite
This commit is contained in:
@@ -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