diff --git a/api/certificate/issue.go b/api/certificate/issue.go index 36724832..f5a7e78d 100644 --- a/api/certificate/issue.go +++ b/api/certificate/issue.go @@ -117,14 +117,16 @@ func IssueCert(c *gin.Context) { } err = certModel.Updates(&model.Cert{ - Domains: payload.ServerName, - SSLCertificatePath: payload.GetCertificatePath(), - SSLCertificateKeyPath: payload.GetCertificateKeyPath(), - AutoCert: model.AutoCertEnabled, - KeyType: payload.KeyType, - ChallengeMethod: payload.ChallengeMethod, - DnsCredentialID: payload.DNSCredentialID, - Resource: payload.Resource, + Domains: payload.ServerName, + SSLCertificatePath: payload.GetCertificatePath(), + SSLCertificateKeyPath: payload.GetCertificateKeyPath(), + AutoCert: model.AutoCertEnabled, + KeyType: payload.KeyType, + ChallengeMethod: payload.ChallengeMethod, + DnsCredentialID: payload.DNSCredentialID, + Resource: payload.Resource, + MustStaple: payload.MustStaple, + LegoDisableCNAMESupport: payload.LegoDisableCNAMESupport, }) if err != nil { diff --git a/app/src/api/auto_cert.ts b/app/src/api/auto_cert.ts index 3fa99e88..cd776153 100644 --- a/app/src/api/auto_cert.ts +++ b/app/src/api/auto_cert.ts @@ -5,21 +5,27 @@ export interface DNSProvider { code?: string provider?: string configuration: { - credentials: { - [key: string]: string - } - additional: { - [key: string]: string - } + credentials: Record + additional: Record } links?: { api: string go_client: string } } -export interface DnsChallenge extends DNSProvider { - dns_credential_id: number | null - challenge_method: string + +export interface AutoCertOptions { + name?: string + domains: string[] + code?: string + dns_credential_id?: number | null + challenge_method?: string + configuration?: DNSProvider['configuration'] + key_type: string + acme_user_id?: number + provider?: string + must_staple?: boolean + lego_disable_cname_support?: boolean } const auto_cert = { diff --git a/app/src/views/certificate/ACMEUserSelector.vue b/app/src/views/certificate/ACMEUserSelector.vue index 0e7b4df6..3bc91497 100644 --- a/app/src/views/certificate/ACMEUserSelector.vue +++ b/app/src/views/certificate/ACMEUserSelector.vue @@ -3,18 +3,19 @@ import type { SelectProps } from 'ant-design-vue' import type { Ref } from 'vue' import type { AcmeUser } from '@/api/acme_user' import acme_user from '@/api/acme_user' -import type { Cert } from '@/api/cert' +import type { AutoCertOptions } from '@/api/auto_cert' const users = ref([]) as Ref -// This data is provided by the Top StdCurd component, -// is the object that you are trying to modify it -// we externalize the dns_credential_id to the parent component, -// this is used to tell the backend which dns_credential to use -const data = inject('data') as Ref +const data = defineModel('options', { + default: () => { + return {} + }, + required: true, +}) const id = computed(() => { - return data.value.acme_user_id + return data.value?.acme_user_id }) const user_idx = ref() @@ -35,7 +36,7 @@ watch(id, init) watch(current, () => { if (mounted.value) - data.value.acme_user_id = current.value.id + data.value!.acme_user_id = current.value.id }) onMounted(async () => { @@ -84,8 +85,9 @@ const filterOption = (input: string, option: { label: string }) => { diff --git a/app/src/views/certificate/CertificateEditor.vue b/app/src/views/certificate/CertificateEditor.vue index 0135b849..09fdd2ec 100644 --- a/app/src/views/certificate/CertificateEditor.vue +++ b/app/src/views/certificate/CertificateEditor.vue @@ -52,12 +52,6 @@ function save() { }) } -provide('data', data) - -provide('no_server_name', computed(() => { - return false -})) - const log = computed(() => { const logs = data.value.log?.split('\n') @@ -134,9 +128,17 @@ const isManaged = computed(() => { diff --git a/app/src/views/domain/cert/components/DNSChallenge.vue b/app/src/views/domain/cert/components/DNSChallenge.vue index 21c40a08..354827e1 100644 --- a/app/src/views/domain/cert/components/DNSChallenge.vue +++ b/app/src/views/domain/cert/components/DNSChallenge.vue @@ -1,19 +1,19 @@