mirror of
https://github.com/certd/certd.git
synced 2026-07-12 08:17:32 +08:00
chore: format
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { AbstractDnsProvider, CreateRecordOptions, DomainRecord, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
|
||||
import { AbstractDnsProvider, CreateRecordOptions, DomainRecord, IsDnsProvider, RemoveRecordOptions } from "@certd/plugin-cert";
|
||||
|
||||
import { PageRes, PageSearch } from '@certd/pipeline';
|
||||
import { isDev } from '../../utils/env.js';
|
||||
import { DemoAccess } from './access.js';
|
||||
import { PageRes, PageSearch } from "@certd/pipeline";
|
||||
import { isDev } from "../../utils/env.js";
|
||||
import { DemoAccess } from "./access.js";
|
||||
|
||||
type DemoRecord = {
|
||||
// 这里定义Record记录的数据结构,跟对应云平台接口返回值一样即可,一般是拿到id就行,用于删除txt解析记录,清理申请痕迹
|
||||
@@ -11,21 +11,21 @@ type DemoRecord = {
|
||||
|
||||
// 这里通过IsDnsProvider注册一个dnsProvider
|
||||
@IsDnsProvider({
|
||||
name: 'demo',
|
||||
title: 'Dns提供商Demo',
|
||||
desc: 'dns provider示例',
|
||||
icon: 'clarity:plugin-line',
|
||||
name: "demo",
|
||||
title: "Dns提供商Demo",
|
||||
desc: "dns provider示例",
|
||||
icon: "clarity:plugin-line",
|
||||
// 这里是对应的云平台的access类型名称
|
||||
accessType: 'demo',
|
||||
accessType: "demo",
|
||||
order: 99,
|
||||
})
|
||||
export class DemoDnsProvider extends AbstractDnsProvider<DemoRecord> {
|
||||
access!: DemoAccess;
|
||||
|
||||
async onInstance() {
|
||||
this.access = this.ctx.access as DemoAccess
|
||||
this.access = this.ctx.access as DemoAccess;
|
||||
// 也可以通过ctx成员变量传递context
|
||||
this.logger.debug('access', this.access);
|
||||
this.logger.debug("access", this.access);
|
||||
//初始化的操作
|
||||
//...
|
||||
}
|
||||
@@ -42,7 +42,7 @@ export class DemoDnsProvider extends AbstractDnsProvider<DemoRecord> {
|
||||
* domain: 'example.com'
|
||||
*/
|
||||
const { fullRecord, value, type, domain } = options;
|
||||
this.logger.info('添加域名解析:', fullRecord, value, type, domain);
|
||||
this.logger.info("添加域名解析:", fullRecord, value, type, domain);
|
||||
|
||||
// 调用创建dns解析记录的对应的云端接口,创建txt类型的dns解析记录
|
||||
// 请根据实际接口情况调用,例如:
|
||||
@@ -62,7 +62,7 @@ export class DemoDnsProvider extends AbstractDnsProvider<DemoRecord> {
|
||||
async removeRecord(options: RemoveRecordOptions<DemoRecord>): Promise<void> {
|
||||
const { fullRecord, value, domain } = options.recordReq;
|
||||
const record = options.recordRes;
|
||||
this.logger.info('删除域名解析:', domain, fullRecord, value, record);
|
||||
this.logger.info("删除域名解析:", domain, fullRecord, value, record);
|
||||
//这里调用删除txt dns解析记录接口
|
||||
//请根据实际接口情况调用,例如:
|
||||
|
||||
@@ -73,29 +73,28 @@ export class DemoDnsProvider extends AbstractDnsProvider<DemoRecord> {
|
||||
// })
|
||||
//
|
||||
|
||||
this.logger.info('删除域名解析成功:', fullRecord, value);
|
||||
this.logger.info("删除域名解析成功:", fullRecord, value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param req 实现获取域名列表
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
async getDomainListPage(req: PageSearch): Promise<PageRes<DomainRecord>> {
|
||||
const res = await this.http.request({
|
||||
// 请求接口获取域名列表
|
||||
})
|
||||
const list = []
|
||||
});
|
||||
const list = [];
|
||||
// const list = res.Domains?.map(item => ({
|
||||
// id: item.Id,
|
||||
// domain: item.DomainName,
|
||||
// })) || []
|
||||
|
||||
|
||||
return {
|
||||
list,
|
||||
total: res.Total,
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user