mirror of
https://github.com/certd/certd.git
synced 2026-05-15 04:27:31 +08:00
Merge branch 'v2-dev' into v2_admin_mode
This commit is contained in:
@@ -53,6 +53,7 @@ export class HandleController extends BaseController {
|
||||
const accessGetter = new AccessGetter(userId, this.accessService.getById.bind(this.accessService));
|
||||
const access = await newAccess(body.typeName, inputAccess,accessGetter);
|
||||
|
||||
mergeUtils.merge(access, body.input);
|
||||
const res = await access.onRequest(body);
|
||||
|
||||
return this.ok(res);
|
||||
|
||||
+3
-3
@@ -7,9 +7,9 @@ import { OnePanelClient } from "../client.js";
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: "1PanelDeployToWebsitePlugin",
|
||||
title: "1Panel-更新证书",
|
||||
title: "1Panel-更新站点证书",
|
||||
icon: "svg:icon-onepanel",
|
||||
desc: "更新1Panel的证书,包括面板证书和站点证书",
|
||||
desc: "更新1Panel的站点证书",
|
||||
group: pluginGroups.panel.key,
|
||||
default: {
|
||||
strategy: {
|
||||
@@ -195,7 +195,7 @@ export class OnePanelDeployToWebsitePlugin extends AbstractTaskPlugin {
|
||||
currentNode: this.currentNode,
|
||||
});
|
||||
if (!res?.items) {
|
||||
throw new Error("没有找到证书,请先在1Panel中手动上传证书,并关联站点或设置面板证书,后续才可以自动更新");
|
||||
throw new Error("没有找到证书,请先在1Panel中手动上传证书,并关联站点,后续才可以自动更新");
|
||||
}
|
||||
const list = res.items.map(item => {
|
||||
const domains = item.domains ? [] : item.domains.split(",");
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { IsAccess, AccessInput, BaseAccess } from '@certd/pipeline';
|
||||
import { AccessInput, BaseAccess, IsAccess, PageSearch } from '@certd/pipeline';
|
||||
|
||||
/**
|
||||
* 这个注解将注册一个授权配置
|
||||
* 在certd的后台管理系统中,用户可以选择添加此类型的授权
|
||||
管理页面地址:https://www.dns.com.cn/login/toLogin.do
|
||||
是否有API接口,接口地址:https://api.bizcn.com/rrpservices
|
||||
*/
|
||||
@IsAccess({
|
||||
name: 'xinnetconnect',
|
||||
@@ -38,6 +38,23 @@ export class XinnetConnectAccess extends BaseAccess {
|
||||
password = '';
|
||||
|
||||
|
||||
async getDomainList(req: PageSearch): Promise<any> {
|
||||
let bodyXml =`
|
||||
<limit>${req.pageSize}</limit>
|
||||
<offset>${req.pageNo}</offset>
|
||||
`
|
||||
if(req.searchKey){
|
||||
bodyXml += `<domainname>${req.searchKey}</domainname>`
|
||||
}
|
||||
|
||||
const res = await this.doRequest({
|
||||
url: "/domainService",
|
||||
bodyXml: bodyXml,
|
||||
service: "getDomainList",
|
||||
})
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
async addDnsRecord(req: {domain:string,hostRecord:string, value:string, type:string}): Promise<any> {
|
||||
const { domain,hostRecord, value, type } = req;
|
||||
@@ -125,15 +142,19 @@ export class XinnetConnectAccess extends BaseAccess {
|
||||
|
||||
// 提取返回结果
|
||||
const soapBody = result['soap:Envelope']['soap:Body'];
|
||||
const addDnsRecordResponse = soapBody["ns1:addDnsRecordResponse"];
|
||||
console.log(addDnsRecordResponse)
|
||||
const keys = Object.keys(soapBody);
|
||||
if (keys.length === 0) {
|
||||
throw new Error('SOAP响应体为空');
|
||||
}
|
||||
const addDnsRecordResponse = soapBody[keys[0]];
|
||||
this.ctx.logger.info(addDnsRecordResponse)
|
||||
const resultData = addDnsRecordResponse.response.result;
|
||||
|
||||
const res = {
|
||||
code: resultData.$.code,
|
||||
msg: resultData.msg
|
||||
}
|
||||
console.log('操作结果:', res);
|
||||
this.ctx.logger.info('操作结果:', res);
|
||||
|
||||
if (res.code != "200") {
|
||||
throw new Error(res.msg + " code:" + res.code);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from "@certd/plugin-cert";
|
||||
import { PageRes, PageSearch } from "@certd/pipeline";
|
||||
import { AbstractDnsProvider, CreateRecordOptions, DomainRecord, IsDnsProvider, RemoveRecordOptions } from "@certd/plugin-cert";
|
||||
import { XinnetConnectAccess } from "./access.js";
|
||||
|
||||
|
||||
@@ -62,6 +63,21 @@ export class XinnetConnectDnsProvider extends AbstractDnsProvider<XinnetConnectR
|
||||
await this.access.delDnsRecord(record)
|
||||
this.logger.info(`删除域名解析成功:fullRecord=${fullRecord}`);
|
||||
}
|
||||
|
||||
async getDomainListPage(req: PageSearch): Promise<PageRes<DomainRecord>> {
|
||||
const res = await this.access.getDomainList(req)
|
||||
let list = res.domainlist || []
|
||||
list = list.map(item => ({
|
||||
domain: item.domain,
|
||||
id: item.domain,
|
||||
}))
|
||||
return {
|
||||
pageNo: req.pageNo,
|
||||
pageSize: req.pageSize,
|
||||
total: res.total || 0,
|
||||
list,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//实例化这个provider,将其自动注册到系统中
|
||||
|
||||
Reference in New Issue
Block a user