mirror of https://github.com/certd/certd
				
				
				
			refactor: define
							parent
							
								
									2669f509e1
								
							
						
					
					
						commit
						fd130f86fd
					
				| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
import { util, Store, pluginRegistry } from '@certd/api'
 | 
					import { util, Store, providerRegistry } from '@certd/api'
 | 
				
			||||||
import { AcmeService } from './acme.js'
 | 
					import { AcmeService } from './acme.js'
 | 
				
			||||||
import { FileStore } from './store/file-store.js'
 | 
					import { FileStore } from './store/file-store.js'
 | 
				
			||||||
import { CertStore } from './store/cert-store.js'
 | 
					import { CertStore } from './store/cert-store.js'
 | 
				
			||||||
| 
						 | 
					@ -124,7 +124,7 @@ export class Certd {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  createProviderByType (type, options) {
 | 
					  createProviderByType (type, options) {
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
      const Provider = pluginRegistry.get(type)
 | 
					      const Provider = providerRegistry.get(type)
 | 
				
			||||||
      return new Provider(options)
 | 
					      return new Provider(options)
 | 
				
			||||||
    } catch (e) {
 | 
					    } catch (e) {
 | 
				
			||||||
      throw new Error('暂不支持此dnsProvider,请先use该provider:' + type, e)
 | 
					      throw new Error('暂不支持此dnsProvider,请先use该provider:' + type, e)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,33 @@ import { AbstractDnsProvider } from '@certd/api'
 | 
				
			||||||
import Core from '@alicloud/pop-core'
 | 
					import Core from '@alicloud/pop-core'
 | 
				
			||||||
import _ from 'lodash-es'
 | 
					import _ from 'lodash-es'
 | 
				
			||||||
export class AliyunDnsProvider extends AbstractDnsProvider {
 | 
					export class AliyunDnsProvider extends AbstractDnsProvider {
 | 
				
			||||||
 | 
					  static define () {
 | 
				
			||||||
 | 
					    return {
 | 
				
			||||||
 | 
					      name: 'aliyun',
 | 
				
			||||||
 | 
					      label: '阿里云',
 | 
				
			||||||
 | 
					      desc: '',
 | 
				
			||||||
 | 
					      input: {
 | 
				
			||||||
 | 
					        accessKeyId: {
 | 
				
			||||||
 | 
					          type: String,
 | 
				
			||||||
 | 
					          desc: 'accessKeyId',
 | 
				
			||||||
 | 
					          attrs: {
 | 
				
			||||||
 | 
					            placeholder: 'accessKeyId'
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        accessKeySecret: {
 | 
				
			||||||
 | 
					          type: String,
 | 
				
			||||||
 | 
					          desc: 'accessKeySecret',
 | 
				
			||||||
 | 
					          attrs: {
 | 
				
			||||||
 | 
					            placeholder: 'accessKeySecret'
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      output: {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor (dnsProviderConfig) {
 | 
					  constructor (dnsProviderConfig) {
 | 
				
			||||||
    super()
 | 
					    super()
 | 
				
			||||||
    this.client = new Core({
 | 
					    this.client = new Core({
 | 
				
			||||||
| 
						 | 
					@ -12,10 +39,6 @@ export class AliyunDnsProvider extends AbstractDnsProvider {
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static name () {
 | 
					 | 
				
			||||||
    return 'aliyun'
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  async getDomainList () {
 | 
					  async getDomainList () {
 | 
				
			||||||
    const params = {
 | 
					    const params = {
 | 
				
			||||||
      RegionId: 'cn-hangzhou'
 | 
					      RegionId: 'cn-hangzhou'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,23 @@ import { AbstractDnsProvider, util } from '@certd/api'
 | 
				
			||||||
import _ from 'lodash-es'
 | 
					import _ from 'lodash-es'
 | 
				
			||||||
const request = util.request
 | 
					const request = util.request
 | 
				
			||||||
export class DnspodDnsProvider extends AbstractDnsProvider {
 | 
					export class DnspodDnsProvider extends AbstractDnsProvider {
 | 
				
			||||||
  static name () {
 | 
					  static define () {
 | 
				
			||||||
    return 'dnspod'
 | 
					    return {
 | 
				
			||||||
 | 
					      name: 'dnspod',
 | 
				
			||||||
 | 
					      label: 'dnspod',
 | 
				
			||||||
 | 
					      desc: '腾讯云的域名解析接口已迁移到dnspod',
 | 
				
			||||||
 | 
					      input: {
 | 
				
			||||||
 | 
					        id: {
 | 
				
			||||||
 | 
					          type: String,
 | 
				
			||||||
 | 
					          desc: 'dnspod的账户id'
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        token: {
 | 
				
			||||||
 | 
					          type: String,
 | 
				
			||||||
 | 
					          label: 'token',
 | 
				
			||||||
 | 
					          desc: 'dnspod的开放接口token'
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor (dnsProviderConfig) {
 | 
					  constructor (dnsProviderConfig) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue