mirror of https://github.com/certd/certd
refactor: ui
parent
cca33478e4
commit
86ddb72227
File diff suppressed because it is too large
Load Diff
|
@ -11,9 +11,7 @@ export class Registry {
|
||||||
if (this.collection == null) {
|
if (this.collection == null) {
|
||||||
this.collection = {}
|
this.collection = {}
|
||||||
}
|
}
|
||||||
const className = target.name
|
const defineName = (target.define && target.define().name) || target.name
|
||||||
this.register(className, target)
|
|
||||||
const defineName = target.define && target.define().name
|
|
||||||
this.register(defineName, target)
|
this.register(defineName, target)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
import Router from 'koa-router'
|
||||||
|
import { accessProviderRegistry } from '@certd/api'
|
||||||
|
import DefaultAccessProviders from '@certd/access-providers'
|
||||||
|
import _ from 'lodash-es'
|
||||||
|
import { Ret } from '../models/Ret.js'
|
||||||
|
const router = Router()
|
||||||
|
router.prefix('/access-providers')
|
||||||
|
|
||||||
|
DefaultAccessProviders.install()
|
||||||
|
|
||||||
|
router.get('/list', function (ctx, next) {
|
||||||
|
const list = []
|
||||||
|
_.forEach(accessProviderRegistry.collection, item => {
|
||||||
|
list.push(item.define())
|
||||||
|
})
|
||||||
|
ctx.body = Ret.success(list)
|
||||||
|
})
|
||||||
|
|
||||||
|
export default router
|
|
@ -1,16 +1,16 @@
|
||||||
import Router from 'koa-router'
|
import Router from 'koa-router'
|
||||||
import { providerRegistry } from '@certd/api'
|
import { dnsProviderRegistry } from '@certd/api'
|
||||||
import DefaultProviders from '@certd/dns-providers'
|
import DefaultDnsProviders from '@certd/dns-providers'
|
||||||
import _ from 'lodash-es'
|
import _ from 'lodash-es'
|
||||||
import { Ret } from '../models/Ret.js'
|
import { Ret } from '../models/Ret.js'
|
||||||
const router = Router()
|
const router = Router()
|
||||||
router.prefix('/providers')
|
router.prefix('/dns-providers')
|
||||||
|
|
||||||
DefaultProviders.install()
|
DefaultDnsProviders.install()
|
||||||
|
|
||||||
router.get('/list', function (ctx, next) {
|
router.get('/list', function (ctx, next) {
|
||||||
const list = []
|
const list = []
|
||||||
_.forEach(providerRegistry.providers, item => {
|
_.forEach(dnsProviderRegistry.collection, item => {
|
||||||
list.push(item.define())
|
list.push(item.define())
|
||||||
})
|
})
|
||||||
ctx.body = Ret.success(list)
|
ctx.body = Ret.success(list)
|
|
@ -10,7 +10,7 @@ DefaultPlugins.install()
|
||||||
|
|
||||||
router.get('/list', function (ctx, next) {
|
router.get('/list', function (ctx, next) {
|
||||||
const list = []
|
const list = []
|
||||||
_.forEach(pluginRegistry.plugins, item => {
|
_.forEach(pluginRegistry.collection, item => {
|
||||||
list.push(item.define())
|
list.push(item.define())
|
||||||
})
|
})
|
||||||
ctx.body = Ret.success(list)
|
ctx.body = Ret.success(list)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -14,6 +14,7 @@
|
||||||
"@certd/executor": "^0.1.11",
|
"@certd/executor": "^0.1.11",
|
||||||
"@certd/plugins": "^0.1.11",
|
"@certd/plugins": "^0.1.11",
|
||||||
"@certd/dns-providers": "^0.1.11",
|
"@certd/dns-providers": "^0.1.11",
|
||||||
|
"@certd/access-providers": "^0.1.11",
|
||||||
"compressing": "^1.5.1",
|
"compressing": "^1.5.1",
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"fs-extra": "^9.1.0",
|
"fs-extra": "^9.1.0",
|
||||||
|
|
|
@ -13,6 +13,10 @@ export default {
|
||||||
const targetProjectDir = path.join(targetDir, projectName)
|
const targetProjectDir = path.join(targetDir, projectName)
|
||||||
const templateDir = pathUtil.join('templates/' + projectName)
|
const templateDir = pathUtil.join('templates/' + projectName)
|
||||||
|
|
||||||
|
console.log('targetDir', targetDir)
|
||||||
|
console.log('projectName', projectName)
|
||||||
|
console.log('tempalteDir', templateDir)
|
||||||
|
console.log('targetProjectDir', targetProjectDir)
|
||||||
fs.copySync(templateDir, targetProjectDir)
|
fs.copySync(templateDir, targetProjectDir)
|
||||||
|
|
||||||
// const packageFilePath = path.join(targetProjectDir, 'package.json')
|
// const packageFilePath = path.join(targetProjectDir, 'package.json')
|
||||||
|
@ -23,10 +27,6 @@ export default {
|
||||||
const zipName = dirName + '.zip'
|
const zipName = dirName + '.zip'
|
||||||
const outputFilePath = path.join(targetDir, zipName)
|
const outputFilePath = path.join(targetDir, zipName)
|
||||||
|
|
||||||
console.log('targetDir', targetDir)
|
|
||||||
console.log('projectName', projectName)
|
|
||||||
console.log('tempalteDir', templateDir)
|
|
||||||
console.log('targetProjectDir', targetProjectDir)
|
|
||||||
console.log('outputFilePath', outputFilePath)
|
console.log('outputFilePath', outputFilePath)
|
||||||
await zipUtil.compress({ dir: targetProjectDir, output: outputFilePath })
|
await zipUtil.compress({ dir: targetProjectDir, output: outputFilePath })
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
export default {
|
export default {
|
||||||
join (...dirs) {
|
join (...dirs) {
|
||||||
const url = new URL('../' + dirs.join('/'), import.meta.url)
|
const url = new URL('../' + dirs.join('/'), import.meta.url)
|
||||||
return url.href.replace(/^file:\/\/\//, '').replace(/^file:\/\//, '')
|
console.log('url', url)
|
||||||
|
return url.pathname
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,14 @@
|
||||||
|
import { request } from './service'
|
||||||
|
import inputHandler from '@/api/util.input.handler'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
async list () {
|
||||||
|
const ret = await request({
|
||||||
|
url: '/access-providers/list'
|
||||||
|
})
|
||||||
|
|
||||||
|
inputHandler.handle(ret)
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ import inputHandler from '@/api/util.input.handler'
|
||||||
export default {
|
export default {
|
||||||
async list () {
|
async list () {
|
||||||
const ret = await request({
|
const ret = await request({
|
||||||
url: '/providers/list'
|
url: '/dns-providers/list'
|
||||||
})
|
})
|
||||||
|
|
||||||
inputHandler.handle(ret)
|
inputHandler.handle(ret)
|
|
@ -7,7 +7,7 @@
|
||||||
v-model:visible="visible"
|
v-model:visible="visible"
|
||||||
:after-visible-change="onAfterVisibleChange"
|
:after-visible-change="onAfterVisibleChange"
|
||||||
>
|
>
|
||||||
<div class="d-container provider-manager">
|
<div class="d-container access-provider-manager">
|
||||||
<a-button @click="add">
|
<a-button @click="add">
|
||||||
添加授权
|
添加授权
|
||||||
</a-button>
|
</a-button>
|
||||||
|
@ -76,7 +76,7 @@ import { ref, reactive, nextTick, watch, inject } from 'vue'
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
import { useForm } from '@ant-design-vue/use'
|
import { useForm } from '@ant-design-vue/use'
|
||||||
import _ from 'lodash-es'
|
import _ from 'lodash-es'
|
||||||
import providerApi from '@/api/api.providers'
|
import providerApi from '@/api/api.access-providers'
|
||||||
function useEdit (props, context, onEditSave) {
|
function useEdit (props, context, onEditSave) {
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
key: '',
|
key: '',
|
||||||
|
@ -281,7 +281,7 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.provider-manager{
|
.access-provider-manager{
|
||||||
padding:10px;
|
padding:10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="provider-selector">
|
<div class="access-provider-selector">
|
||||||
<a-select
|
<a-select
|
||||||
:value="value"
|
:value="value"
|
||||||
@update:value="valueUpdate"
|
@update:value="valueUpdate"
|
||||||
|
@ -12,20 +12,20 @@
|
||||||
管理授权
|
管理授权
|
||||||
</a-button>
|
</a-button>
|
||||||
</div>
|
</div>
|
||||||
<provider-manager ref="providerManagerRef"
|
<access-provider-manager ref="providerManagerRef"
|
||||||
:value="value"
|
:value="value"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
@update:value="valueUpdate"
|
@update:value="valueUpdate"
|
||||||
></provider-manager>
|
></access-provider-manager>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { ref, inject } from 'vue'
|
import { ref, inject } from 'vue'
|
||||||
import ProviderManager from './provider-manager'
|
import AccessProviderManager from './access-provider-manager'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'provider-selector',
|
name: 'provider-selector',
|
||||||
components: { ProviderManager },
|
components: { AccessProviderManager },
|
||||||
emits: ['update:providers', 'update:value'],
|
emits: ['update:providers', 'update:value'],
|
||||||
// 属性定义
|
// 属性定义
|
||||||
props: {
|
props: {
|
||||||
|
@ -71,7 +71,7 @@ export default {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.provider-selector{
|
.access-provider-selector{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
.ant-select{
|
.ant-select{
|
|
@ -1,11 +1,11 @@
|
||||||
import DContainer from './d-container'
|
import DContainer from './d-container'
|
||||||
import ComponentRender from './component-render'
|
import ComponentRender from './component-render'
|
||||||
import ProviderSelector from './provider-selector/provider-selector'
|
import AccessProviderSelector from './access-provider-selector/access-provider-selector'
|
||||||
|
|
||||||
const list = [
|
const list = [
|
||||||
DContainer,
|
DContainer,
|
||||||
ComponentRender,
|
ComponentRender,
|
||||||
ProviderSelector
|
AccessProviderSelector
|
||||||
]
|
]
|
||||||
export default {
|
export default {
|
||||||
install (app) {
|
install (app) {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
>
|
>
|
||||||
|
|
||||||
<d-container>
|
<d-container>
|
||||||
<a-form class="domain-form" :scrollToFirstError="true" :label-col="labelCol" :wrapper-col="wrapperCol">
|
<a-form class="domain-form" :model="formData" :scrollToFirstError="true" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||||
|
|
||||||
<h3>域名信息</h3>
|
<h3>域名信息</h3>
|
||||||
<a-form-item :label="$t('domain')" v-bind="validateInfos.domains">
|
<a-form-item :label="$t('domain')" v-bind="validateInfos.domains">
|
||||||
|
@ -28,9 +28,20 @@
|
||||||
<a-input v-model:value="formData.email"/>
|
<a-input v-model:value="formData.email"/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item label="dns验证" v-bind="validateInfos.dnsProvider">
|
<a-form-item label="dns验证" v-bind="validateInfos['dnsProvider.type']">
|
||||||
<provider-selector v-model:value="formData.dnsProvider"></provider-selector>
|
<a-select v-model:value="formData.dnsProvider.type" @change="onCurrentDnsProviderChanged">
|
||||||
|
<a-select-option v-for="item of dnsProviderDefineList" :key="item.name" :value="item.name">{{item.label}}</a-select-option>
|
||||||
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<template v-if="currentDnsProviderDefine">
|
||||||
|
<a-form-item v-for="(item,key) in currentDnsProviderDefine.input" v-bind="item.component || {}" :key="key" :label="item.label" :name="key">
|
||||||
|
<component-render v-model:value="formData.dnsProvider[key]" v-bind="item.component || {}"></component-render>
|
||||||
|
<template #extra v-if="item.desc" >
|
||||||
|
{{item.desc}}
|
||||||
|
</template>
|
||||||
|
</a-form-item>
|
||||||
|
</template>
|
||||||
|
|
||||||
<a-form-item label="CA" v-bind="validateInfos.ca">
|
<a-form-item label="CA" v-bind="validateInfos.ca">
|
||||||
<a-radio-group v-model:value="formData.ca" >
|
<a-radio-group v-model:value="formData.ca" >
|
||||||
<a-radio value="LetEncrypt">
|
<a-radio value="LetEncrypt">
|
||||||
|
@ -76,6 +87,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { reactive, toRaw, ref, watch } from 'vue'
|
import { reactive, toRaw, ref, watch } from 'vue'
|
||||||
import { useForm } from '@ant-design-vue/use'
|
import { useForm } from '@ant-design-vue/use'
|
||||||
|
import dnsProviderApi from '@/api/api.dns-providers'
|
||||||
import _ from 'lodash-es'
|
import _ from 'lodash-es'
|
||||||
|
|
||||||
function useDrawer () {
|
function useDrawer () {
|
||||||
|
@ -115,7 +127,7 @@ export default {
|
||||||
const certFormData = {
|
const certFormData = {
|
||||||
domains: [],
|
domains: [],
|
||||||
email: undefined,
|
email: undefined,
|
||||||
dnsProvider: '',
|
dnsProvider: {},
|
||||||
ca: 'LetEncrypt',
|
ca: 'LetEncrypt',
|
||||||
csr: {
|
csr: {
|
||||||
country: '',
|
country: '',
|
||||||
|
@ -143,7 +155,11 @@ export default {
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入正确的邮箱'
|
message: '请输入正确的邮箱'
|
||||||
}],
|
}],
|
||||||
dnsProvider: [{
|
'dnsProvider.type': [{
|
||||||
|
required: true,
|
||||||
|
message: '请选择dns类型'
|
||||||
|
}],
|
||||||
|
'dnsProvider.accessProvider': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请选择dns授权提供者'
|
message: '请选择dns授权提供者'
|
||||||
}],
|
}],
|
||||||
|
@ -185,6 +201,28 @@ export default {
|
||||||
console.log('accessUpdate', val)
|
console.log('accessUpdate', val)
|
||||||
context.emit('update:accessProviders', val)
|
context.emit('update:accessProviders', val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dnsProviderDefineList = ref()
|
||||||
|
const currentDnsProviderDefine = ref()
|
||||||
|
const onCreate = async () => {
|
||||||
|
const list = await dnsProviderApi.list()
|
||||||
|
dnsProviderDefineList.value = list
|
||||||
|
}
|
||||||
|
const onCurrentDnsProviderChanged = (type) => {
|
||||||
|
if (type == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
formData.dnsProvider.type = type
|
||||||
|
formData.dnsProvider.accessProvider = null
|
||||||
|
for (const item of dnsProviderDefineList.value) {
|
||||||
|
if (item.name === type) {
|
||||||
|
currentDnsProviderDefine.value = item
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onCreate()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
labelCol: { span: 4 },
|
labelCol: { span: 4 },
|
||||||
wrapperCol: { span: 18 },
|
wrapperCol: { span: 18 },
|
||||||
|
@ -195,6 +233,9 @@ export default {
|
||||||
providerManagerRef,
|
providerManagerRef,
|
||||||
providerManagerOpen,
|
providerManagerOpen,
|
||||||
accessProvidersUpdate,
|
accessProvidersUpdate,
|
||||||
|
dnsProviderDefineList,
|
||||||
|
onCurrentDnsProviderChanged,
|
||||||
|
currentDnsProviderDefine,
|
||||||
...drawer
|
...drawer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,16 @@
|
||||||
{{ options.cert.email }}
|
{{ options.cert.email }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="label-item">
|
||||||
|
<label>dns校验:</label>
|
||||||
|
<div>
|
||||||
|
<span v-if="options.cert?.dnsProvider">
|
||||||
|
{{ options.cert.dnsProvider?.type }}-
|
||||||
|
{{options.accessProviders[options.cert.dnsProvider.accessProvider]?.label}}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="label-item">
|
<div class="label-item">
|
||||||
<label>CA:</label>
|
<label>CA:</label>
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Reference in New Issue