Skip to content

Commit fcc2263

Browse files
committed
feat: added DNS credentials manager
1 parent 418a53f commit fcc2263

File tree

23 files changed

+970
-519
lines changed

23 files changed

+970
-519
lines changed

frontend/src/language/en/app.po

Lines changed: 102 additions & 71 deletions
Large diffs are not rendered by default.

frontend/src/language/messages.pot

Lines changed: 98 additions & 68 deletions
Large diffs are not rendered by default.

frontend/src/language/translations.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

frontend/src/language/zh_CN/app.mo

596 Bytes
Binary file not shown.

frontend/src/language/zh_CN/app.po

Lines changed: 105 additions & 74 deletions
Large diffs are not rendered by default.

frontend/src/language/zh_TW/app.mo

591 Bytes
Binary file not shown.

frontend/src/language/zh_TW/app.po

Lines changed: 105 additions & 74 deletions
Large diffs are not rendered by default.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<script setup lang="ts">
2+
import {computed, inject, ref, watch} from 'vue'
3+
import auto_cert from '@/api/auto_cert'
4+
import {useGettext} from 'vue3-gettext'
5+
import {SelectProps} from 'ant-design-vue'
6+
7+
const {$gettext} = useGettext()
8+
const providers: any = ref([])
9+
10+
const data: any = inject('data')!
11+
12+
const code = computed(() => {
13+
return data.code
14+
})
15+
16+
function init() {
17+
providers.value?.forEach((v: any, k: number) => {
18+
if (v.code === code.value) {
19+
provider_idx.value = k
20+
}
21+
})
22+
}
23+
24+
auto_cert.get_dns_providers().then(r => {
25+
providers.value = r
26+
}).then(() => {
27+
init()
28+
})
29+
30+
const provider_idx = ref()
31+
32+
const current: any = computed(() => {
33+
return providers.value?.[provider_idx.value]
34+
})
35+
36+
37+
watch(code, init)
38+
39+
watch(current, () => {
40+
data.code = current.value.code
41+
data.provider = current.value.name
42+
auto_cert.get_dns_provider(current.value.code).then(r => {
43+
Object.assign(current.value, r)
44+
})
45+
})
46+
47+
const options = computed<SelectProps['options']>(() => {
48+
let list: SelectProps['options'] = []
49+
50+
providers.value.forEach((v: any, k: number) => {
51+
list!.push({
52+
value: k,
53+
label: v.name
54+
})
55+
})
56+
57+
return list
58+
})
59+
60+
const filterOption = (input: string, option: any) => {
61+
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
62+
}
63+
</script>
64+
65+
<template>
66+
<a-form layout="vertical">
67+
<a-form-item :label="$gettext('DNS Provider')">
68+
<a-select v-model:value="provider_idx" show-search :options="options" :filter-option="filterOption"/>
69+
</a-form-item>
70+
<template v-if="current?.configuration?.credentials">
71+
<h4>{{ $gettext('Credentials') }}</h4>
72+
<a-form-item :label="k" v-for="(v,k) in current?.configuration?.credentials"
73+
:extra="v" :rules="[{ required: true }]">
74+
<a-input v-model:value="data.configuration.credentials[k]"/>
75+
</a-form-item>
76+
</template>
77+
<template v-if="current?.configuration?.additional">
78+
<h4>{{ $gettext('Additional') }}</h4>
79+
<a-form-item :label="k" v-for="(v,k) in current?.configuration?.additional" :extra="v">
80+
<a-input v-model:value="data.configuration.additional[k]"/>
81+
</a-form-item>
82+
</template>
83+
</a-form>
84+
</template>
85+
86+
<style lang="less" scoped>
87+
88+
</style>

frontend/src/views/cert/DNSCredential.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {datetime} from '@/components/StdDataDisplay/StdTableTransformer'
44
import dns_credential from '@/api/dns_credential'
55
import StdCurd from '@/components/StdDataDisplay/StdCurd.vue'
66
import Template from '@/views/template/Template.vue'
7-
import DNSChallenge from '@/views/domain/cert/components/DNSChallenge.vue'
7+
import DNSChallenge from './DNSChallenge.vue'
88
import {input} from '@/components/StdDataEntry'
99
1010
const {$gettext, interpolate} = useGettext()

frontend/src/views/domain/cert/components/AutoCertStepOne.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ const data: Ref = inject('data')!
4040
directory to HTTPChallengePort before obtaining the certificate.
4141
</p>
4242
<p v-else-if="data.challenge_method==='dns01'" v-translate>
43-
Please fill in the API authentication credentials provided by your DNS provider.
44-
We will add a TXT record to the DNS records of your domain for ownership verification.
45-
Once the verification is complete, the record will be removed.
46-
Please note that the time configurations below are all in seconds.
43+
Please first add credentials in Certification > DNS Credentials, and then select one of the credentials
44+
below to request the API of the DNS provider.
4745
</p>
4846
</template>
4947
</a-alert>

0 commit comments

Comments
 (0)