Merge branch 'v2-dev' into v2

pull/409/head
xiaojunnuo 2025-04-22 22:49:53 +08:00
commit 918ea59b9a
46 changed files with 1154 additions and 159 deletions

View File

@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/certd/certd/compare/v1.33.6...v1.33.7) (2025-04-22)
### Performance Improvements
* 添加部署证书至火山 Live ([abea80e](https://github.com/certd/certd/commit/abea80e3ab9b1672aebe1c5d5e856693b29931a8))
* 优化首页插件列表展示 ([9b8f60b](https://github.com/certd/certd/commit/9b8f60b64b5f9a3db7dfa9b3dcbd9201984358d0))
* 证书申请支持51dns ([8638fc9](https://github.com/certd/certd/commit/8638fc91ff34fccaf12ff9874fd3fa9d2a8c18b7))
* 支持51dns ([96a0900](https://github.com/certd/certd/commit/96a0900edc95dcfd9acccf9d13592f12f5a09b3d))
* ssh PTY模式登录设置 ([8385bcc](https://github.com/certd/certd/commit/8385bcc2d7f2411a07748bb5c53f9eaf4d38d7cc))
* ssh伪终端模式优化windows下不开启 ([42dfe93](https://github.com/certd/certd/commit/42dfe936b773b7bdd82ca3378363252ffffd7b71))
## [1.33.6](https://github.com/certd/certd/compare/v1.33.5...v1.33.6) (2025-04-20)
### Bug Fixes

View File

@ -1 +1 @@
00:08
22:32

View File

@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/certd/certd/compare/v1.33.6...v1.33.7) (2025-04-22)
### Performance Improvements
* 添加部署证书至火山 Live ([abea80e](https://github.com/certd/certd/commit/abea80e3ab9b1672aebe1c5d5e856693b29931a8))
* 优化首页插件列表展示 ([9b8f60b](https://github.com/certd/certd/commit/9b8f60b64b5f9a3db7dfa9b3dcbd9201984358d0))
* 证书申请支持51dns ([8638fc9](https://github.com/certd/certd/commit/8638fc91ff34fccaf12ff9874fd3fa9d2a8c18b7))
* 支持51dns ([96a0900](https://github.com/certd/certd/commit/96a0900edc95dcfd9acccf9d13592f12f5a09b3d))
* ssh PTY模式登录设置 ([8385bcc](https://github.com/certd/certd/commit/8385bcc2d7f2411a07748bb5c53f9eaf4d38d7cc))
* ssh伪终端模式优化windows下不开启 ([42dfe93](https://github.com/certd/certd/commit/42dfe936b773b7bdd82ca3378363252ffffd7b71))
## [1.33.6](https://github.com/certd/certd/compare/v1.33.5...v1.33.6) (2025-04-20)
### Bug Fixes

View File

@ -9,5 +9,5 @@
}
},
"npmClient": "pnpm",
"version": "1.33.6"
"version": "1.33.7"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/publishlab/node-acme-client/compare/v1.33.6...v1.33.7) (2025-04-22)
**Note:** Version bump only for package @certd/acme-client
## [1.33.6](https://github.com/publishlab/node-acme-client/compare/v1.33.5...v1.33.6) (2025-04-20)
**Note:** Version bump only for package @certd/acme-client

View File

@ -3,7 +3,7 @@
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.33.6",
"version": "1.33.7",
"type": "module",
"module": "scr/index.js",
"main": "src/index.js",
@ -18,7 +18,7 @@
"types"
],
"dependencies": {
"@certd/basic": "^1.33.6",
"@certd/basic": "^1.33.7",
"@peculiar/x509": "^1.11.0",
"asn1js": "^3.0.5",
"axios": "^1.7.2",
@ -67,5 +67,5 @@
"bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues"
},
"gitHead": "8abe62886ab50634b4b05abedd2981ec8ee0422e"
"gitHead": "a188385817e8dbd270dbdbf7f86a5b812884cf59"
}

View File

@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/certd/certd/compare/v1.33.6...v1.33.7) (2025-04-22)
### Performance Improvements
* 支持51dns ([96a0900](https://github.com/certd/certd/commit/96a0900edc95dcfd9acccf9d13592f12f5a09b3d))
## [1.33.6](https://github.com/certd/certd/compare/v1.33.5...v1.33.6) (2025-04-20)
**Note:** Version bump only for package @certd/basic

View File

@ -1 +1 @@
00:04
22:12

View File

@ -1,7 +1,7 @@
{
"name": "@certd/basic",
"private": false,
"version": "1.33.6",
"version": "1.33.7",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@ -44,5 +44,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "8abe62886ab50634b4b05abedd2981ec8ee0422e"
"gitHead": "a188385817e8dbd270dbdbf7f86a5b812884cf59"
}

View File

@ -1,13 +1,13 @@
import axios, { AxiosHeaders, AxiosRequestConfig } from 'axios';
import { ILogger, logger } from './util.log.js';
import { Logger } from 'log4js';
import { HttpProxyAgent } from 'http-proxy-agent';
import { HttpsProxyAgent } from 'https-proxy-agent';
import nodeHttp from 'http';
import * as https from 'node:https';
import { merge } from 'lodash-es';
import { safePromise } from './util.promise.js';
import fs from 'fs';
import axios, { AxiosHeaders, AxiosRequestConfig } from "axios";
import { ILogger, logger } from "./util.log.js";
import { Logger } from "log4js";
import { HttpProxyAgent } from "http-proxy-agent";
import { HttpsProxyAgent } from "https-proxy-agent";
import nodeHttp from "http";
import * as https from "node:https";
import { merge } from "lodash-es";
import { safePromise } from "./util.promise.js";
import fs from "fs";
export class HttpError extends Error {
status?: number;
statusText?: string;
@ -22,10 +22,10 @@ export class HttpError extends Error {
super(error.message || error.response?.statusText);
const message = error?.message;
if (message && typeof message === 'string') {
if (message.indexOf && message.indexOf('ssl3_get_record:wrong version number') >= 0) {
if (message && typeof message === "string") {
if (message.indexOf && message.indexOf("ssl3_get_record:wrong version number") >= 0) {
this.message = `${message}(http协议错误服务端要求http协议请检查是否使用了https请求)`;
} else if (message.indexOf('getaddrinfo EAI_AGAIN') >= 0) {
} else if (message.indexOf("getaddrinfo EAI_AGAIN") >= 0) {
this.message = `${message}(无法解析域名请检查网络连接或dns配置更换docker-compose.yaml中dns配置)`;
}
}
@ -47,7 +47,7 @@ export class HttpError extends Error {
};
let url = error.config?.url;
if (error.config?.baseURL) {
url = (error.config?.baseURL || '') + url;
url = (error.config?.baseURL || "") + url;
}
if (url) {
this.message = `${this.message}${url}`;
@ -73,7 +73,7 @@ export const HttpCommonError = HttpError;
let defaultAgents = createAgent();
export function setGlobalProxy(opts: { httpProxy?: string; httpsProxy?: string }) {
logger.info('setGlobalProxy:', opts);
logger.info("setGlobalProxy:", opts);
defaultAgents = createAgent(opts);
}
@ -102,12 +102,12 @@ export function createAxiosService({ logger }: { logger: Logger }) {
if (config.skipSslVerify || config.httpProxy) {
let rejectUnauthorized = true;
if (config.skipSslVerify) {
logger.info('跳过SSL验证');
logger.info("跳过SSL验证");
rejectUnauthorized = false;
}
const proxy: any = {};
if (config.httpProxy) {
logger.info('使用自定义http代理:', config.httpProxy);
logger.info("使用自定义http代理:", config.httpProxy);
proxy.httpProxy = config.httpProxy;
proxy.httpsProxy = config.httpProxy;
}
@ -128,7 +128,7 @@ export function createAxiosService({ logger }: { logger: Logger }) {
},
(error: Error) => {
// 发送失败
logger.error('接口请求失败:', error);
logger.error("接口请求失败:", error);
return Promise.reject(error);
}
);
@ -143,7 +143,7 @@ export function createAxiosService({ logger }: { logger: Logger }) {
logger.info(`http response : status=${response?.status},data=${resData}`);
} else {
logger.info('http response status:', response?.status);
logger.info("http response status:", response?.status);
}
if (response?.config?.returnResponse) {
return response;
@ -154,53 +154,51 @@ export function createAxiosService({ logger }: { logger: Logger }) {
const status = error.response?.status;
switch (status) {
case 400:
error.message = '请求错误';
error.message = "请求错误";
break;
case 401:
error.message = '认证/登录失败';
error.message = "认证/登录失败";
break;
case 403:
error.message = '拒绝访问';
error.message = "拒绝访问";
break;
case 404:
error.message = `请求地址出错`;
break;
case 408:
error.message = '请求超时';
error.message = "请求超时";
break;
case 500:
error.message = '服务器内部错误';
error.message = "服务器内部错误";
break;
case 501:
error.message = '服务未实现';
error.message = "服务未实现";
break;
case 502:
error.message = '网关错误';
error.message = "网关错误";
break;
case 503:
error.message = '服务不可用';
error.message = "服务不可用";
break;
case 504:
error.message = '网关超时';
error.message = "网关超时";
break;
case 505:
error.message = 'HTTP版本不受支持';
error.message = "HTTP版本不受支持";
break;
default:
break;
}
logger.error(
`请求出错status:${error.response?.status},statusText:${error.response?.statusText},url:${error.config?.url},method:${error.config?.method}`
);
logger.error('返回数据:', JSON.stringify(error.response?.data));
logger.error(`请求出错status:${error.response?.status},statusText:${error.response?.statusText},url:${error.config?.url},method:${error.config?.method}`);
logger.error("返回数据:", JSON.stringify(error.response?.data));
if (error.response?.data) {
const message = error.response.data.message || error.response.data.msg || error.response.data.error;
if (typeof message === 'string') {
if (typeof message === "string") {
error.message = message;
}
}
if (error instanceof AggregateError) {
logger.error('AggregateError', error);
logger.error("AggregateError", error);
}
const err = new HttpError(error);
return Promise.reject(err);
@ -244,24 +242,24 @@ export function createAgent(opts: CreateAgentOptions = {}) {
if (httpProxy) {
process.env.HTTP_PROXY = httpProxy;
process.env.http_proxy = httpProxy;
logger.info('use httpProxy:', httpProxy);
logger.info("use httpProxy:", httpProxy);
httpAgent = new HttpProxyAgent(httpProxy, opts as any);
merge(httpAgent.options, opts);
} else {
process.env.HTTP_PROXY = '';
process.env.http_proxy = '';
process.env.HTTP_PROXY = "";
process.env.http_proxy = "";
httpAgent = new nodeHttp.Agent(opts);
}
const httpsProxy = opts.httpsProxy;
if (httpsProxy) {
process.env.HTTPS_PROXY = httpsProxy;
process.env.https_proxy = httpsProxy;
logger.info('use httpsProxy:', httpsProxy);
logger.info("use httpsProxy:", httpsProxy);
httpsAgent = new HttpsProxyAgent(httpsProxy, opts as any);
merge(httpsAgent.options, opts);
} else {
process.env.HTTPS_PROXY = '';
process.env.https_proxy = '';
process.env.HTTPS_PROXY = "";
process.env.https_proxy = "";
httpsAgent = new https.Agent(opts);
}
return {
@ -276,27 +274,27 @@ export async function download(req: { http: HttpClient; config: HttpRequestConfi
http
.request({
logRes: false,
responseType: 'stream',
responseType: "stream",
...config,
})
.then(res => {
const writer = fs.createWriteStream(savePath);
res.pipe(writer);
writer.on('close', () => {
logger.info('文件下载成功');
writer.on("close", () => {
logger.info("文件下载成功");
resolve(true);
});
//error
writer.on('error', err => {
logger.error('下载失败', err);
writer.on("error", err => {
logger.error("下载失败", err);
reject(err);
});
//进度条打印
const totalLength = res.headers['content-length'];
const totalLength = res.headers["content-length"];
let currentLength = 0;
// 每5%打印一次
const step = (totalLength / 100) * 5;
res.on('data', (chunk: any) => {
res.on("data", (chunk: any) => {
currentLength += chunk.length;
if (currentLength % step < chunk.length) {
const percent = ((currentLength / totalLength) * 100).toFixed(2);
@ -305,19 +303,19 @@ export async function download(req: { http: HttpClient; config: HttpRequestConfi
});
})
.catch(err => {
logger.info('下载失败', err);
logger.info("下载失败", err);
reject(err);
});
});
}
export function getCookie(response: any, name: string) {
const cookies = response.headers['set-cookie'];
const cookies = response.headers["set-cookie"];
//根据name 返回对应的cookie
const found = cookies.find((cookie: any) => cookie.includes(name));
if (!found) {
return null;
}
const cookie = found.split(';')[0];
return cookie.substring(cookie.indexOf('=') + 1);
const cookie = found.split(";")[0];
return cookie.substring(cookie.indexOf("=") + 1);
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/certd/certd/compare/v1.33.6...v1.33.7) (2025-04-22)
**Note:** Version bump only for package @certd/pipeline
## [1.33.6](https://github.com/certd/certd/compare/v1.33.5...v1.33.6) (2025-04-20)
**Note:** Version bump only for package @certd/pipeline

View File

@ -1,7 +1,7 @@
{
"name": "@certd/pipeline",
"private": false,
"version": "1.33.6",
"version": "1.33.7",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@ -16,8 +16,8 @@
"test": "mocha --loader=ts-node/esm"
},
"dependencies": {
"@certd/basic": "^1.33.6",
"@certd/plus-core": "^1.33.6",
"@certd/basic": "^1.33.7",
"@certd/plus-core": "^1.33.7",
"dayjs": "^1.11.7",
"lodash-es": "^4.17.21",
"reflect-metadata": "^0.1.13"
@ -43,5 +43,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "8abe62886ab50634b4b05abedd2981ec8ee0422e"
"gitHead": "a188385817e8dbd270dbdbf7f86a5b812884cf59"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/certd/certd/compare/v1.33.6...v1.33.7) (2025-04-22)
**Note:** Version bump only for package @certd/lib-huawei
## [1.33.6](https://github.com/certd/certd/compare/v1.33.5...v1.33.6) (2025-04-20)
**Note:** Version bump only for package @certd/lib-huawei

View File

@ -1,7 +1,7 @@
{
"name": "@certd/lib-huawei",
"private": false,
"version": "1.33.6",
"version": "1.33.7",
"main": "./dist/bundle.js",
"module": "./dist/bundle.js",
"types": "./dist/d/index.d.ts",
@ -23,5 +23,5 @@
"prettier": "^2.8.8",
"tslib": "^2.8.1"
},
"gitHead": "8abe62886ab50634b4b05abedd2981ec8ee0422e"
"gitHead": "a188385817e8dbd270dbdbf7f86a5b812884cf59"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/certd/certd/compare/v1.33.6...v1.33.7) (2025-04-22)
**Note:** Version bump only for package @certd/lib-iframe
## [1.33.6](https://github.com/certd/certd/compare/v1.33.5...v1.33.6) (2025-04-20)
### Performance Improvements

View File

@ -1,7 +1,7 @@
{
"name": "@certd/lib-iframe",
"private": false,
"version": "1.33.6",
"version": "1.33.7",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@ -30,5 +30,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "8abe62886ab50634b4b05abedd2981ec8ee0422e"
"gitHead": "a188385817e8dbd270dbdbf7f86a5b812884cf59"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/certd/certd/compare/v1.33.6...v1.33.7) (2025-04-22)
**Note:** Version bump only for package @certd/jdcloud
## [1.33.6](https://github.com/certd/certd/compare/v1.33.5...v1.33.6) (2025-04-20)
**Note:** Version bump only for package @certd/jdcloud

View File

@ -1,6 +1,6 @@
{
"name": "@certd/jdcloud",
"version": "1.33.6",
"version": "1.33.7",
"description": "jdcloud openApi sdk",
"main": "./dist/bundle.js",
"module": "./dist/bundle.js",
@ -60,5 +60,5 @@
"fetch"
]
},
"gitHead": "8abe62886ab50634b4b05abedd2981ec8ee0422e"
"gitHead": "a188385817e8dbd270dbdbf7f86a5b812884cf59"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/certd/certd/compare/v1.33.6...v1.33.7) (2025-04-22)
**Note:** Version bump only for package @certd/lib-k8s
## [1.33.6](https://github.com/certd/certd/compare/v1.33.5...v1.33.6) (2025-04-20)
**Note:** Version bump only for package @certd/lib-k8s

View File

@ -1,7 +1,7 @@
{
"name": "@certd/lib-k8s",
"private": false,
"version": "1.33.6",
"version": "1.33.7",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@ -16,7 +16,7 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/basic": "^1.33.6",
"@certd/basic": "^1.33.7",
"@kubernetes/client-node": "0.21.0"
},
"devDependencies": {
@ -31,5 +31,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "8abe62886ab50634b4b05abedd2981ec8ee0422e"
"gitHead": "a188385817e8dbd270dbdbf7f86a5b812884cf59"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/certd/certd/compare/v1.33.6...v1.33.7) (2025-04-22)
**Note:** Version bump only for package @certd/lib-server
## [1.33.6](https://github.com/certd/certd/compare/v1.33.5...v1.33.6) (2025-04-20)
**Note:** Version bump only for package @certd/lib-server

View File

@ -1,6 +1,6 @@
{
"name": "@certd/lib-server",
"version": "1.33.6",
"version": "1.33.7",
"description": "midway with flyway, sql upgrade way ",
"private": false,
"type": "module",
@ -27,10 +27,10 @@
],
"license": "AGPL",
"dependencies": {
"@certd/acme-client": "^1.33.6",
"@certd/basic": "^1.33.6",
"@certd/pipeline": "^1.33.6",
"@certd/plus-core": "^1.33.6",
"@certd/acme-client": "^1.33.7",
"@certd/basic": "^1.33.7",
"@certd/pipeline": "^1.33.7",
"@certd/plus-core": "^1.33.7",
"@midwayjs/cache": "~3.14.0",
"@midwayjs/core": "~3.20.3",
"@midwayjs/i18n": "~3.20.3",
@ -61,5 +61,5 @@
"typeorm": "^0.3.11",
"typescript": "^5.4.2"
},
"gitHead": "8abe62886ab50634b4b05abedd2981ec8ee0422e"
"gitHead": "a188385817e8dbd270dbdbf7f86a5b812884cf59"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/certd/certd/compare/v1.33.6...v1.33.7) (2025-04-22)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.33.6](https://github.com/certd/certd/compare/v1.33.5...v1.33.6) (2025-04-20)
**Note:** Version bump only for package @certd/midway-flyway-js

View File

@ -1,6 +1,6 @@
{
"name": "@certd/midway-flyway-js",
"version": "1.33.6",
"version": "1.33.7",
"description": "midway with flyway, sql upgrade way ",
"private": false,
"type": "module",
@ -46,5 +46,5 @@
"typeorm": "^0.3.11",
"typescript": "^5.4.2"
},
"gitHead": "8abe62886ab50634b4b05abedd2981ec8ee0422e"
"gitHead": "a188385817e8dbd270dbdbf7f86a5b812884cf59"
}

View File

@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/certd/certd/compare/v1.33.6...v1.33.7) (2025-04-22)
**Note:** Version bump only for package @certd/plugin-cert
## [1.33.6](https://github.com/certd/certd/compare/v1.33.5...v1.33.6) (2025-04-20)
**Note:** Version bump only for package @certd/plugin-cert

View File

@ -1,7 +1,7 @@
{
"name": "@certd/plugin-cert",
"private": false,
"version": "1.33.6",
"version": "1.33.7",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@ -15,10 +15,10 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/acme-client": "^1.33.6",
"@certd/basic": "^1.33.6",
"@certd/pipeline": "^1.33.6",
"@certd/plugin-lib": "^1.33.6",
"@certd/acme-client": "^1.33.7",
"@certd/basic": "^1.33.7",
"@certd/pipeline": "^1.33.7",
"@certd/plugin-lib": "^1.33.7",
"@google-cloud/publicca": "^1.3.0",
"dayjs": "^1.11.7",
"jszip": "^3.10.1",
@ -41,5 +41,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "8abe62886ab50634b4b05abedd2981ec8ee0422e"
"gitHead": "a188385817e8dbd270dbdbf7f86a5b812884cf59"
}

View File

@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/certd/certd/compare/v1.33.6...v1.33.7) (2025-04-22)
### Performance Improvements
* ssh PTY模式登录设置 ([8385bcc](https://github.com/certd/certd/commit/8385bcc2d7f2411a07748bb5c53f9eaf4d38d7cc))
* ssh伪终端模式优化windows下不开启 ([42dfe93](https://github.com/certd/certd/commit/42dfe936b773b7bdd82ca3378363252ffffd7b71))
## [1.33.6](https://github.com/certd/certd/compare/v1.33.5...v1.33.6) (2025-04-20)
**Note:** Version bump only for package @certd/plugin-lib

View File

@ -1,7 +1,7 @@
{
"name": "@certd/plugin-lib",
"private": false,
"version": "1.33.6",
"version": "1.33.7",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@ -16,8 +16,8 @@
},
"dependencies": {
"@alicloud/pop-core": "^1.7.10",
"@certd/basic": "^1.33.6",
"@certd/pipeline": "^1.33.6",
"@certd/basic": "^1.33.7",
"@certd/pipeline": "^1.33.7",
"@kubernetes/client-node": "0.21.0",
"ali-oss": "^6.21.0",
"basic-ftp": "^5.0.5",
@ -48,5 +48,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "8abe62886ab50634b4b05abedd2981ec8ee0422e"
"gitHead": "a188385817e8dbd270dbdbf7f86a5b812884cf59"
}

View File

@ -63,6 +63,16 @@ export class SshAccess extends BaseAccess {
})
passphrase!: string;
@AccessInput({
title: "伪终端",
helper: "如果登录报错all authentication methods failed可以尝试开启伪终端模式进行keyboard-interactive方式登录\n开启后对日志输出有一定的影响",
component: {
name: "a-switch",
vModel: "checked",
},
})
pty!: boolean;
@AccessInput({
title: "socks代理",
helper: "socks代理配置格式socks5://user:password@host:port",

View File

@ -170,7 +170,10 @@ export class AsyncSsh2Client {
// }
return new Promise((resolve, reject) => {
this.logger.info(`执行命令:[${this.connConf.host}][exec]: \n` + script);
this.conn.exec(script, { pty: true, env: opts.env }, (err: Error, stream: any) => {
// pty 伪终端window下的输出会带上conhost.exe之类的多余的字符串影响返回结果判断
// linux下 当使用keyboard-interactive 登录时需要pty
const pty = this.connConf.pty; //linux下开启伪终端windows下不开启
this.conn.exec(script, { pty, env: opts.env }, (err: Error, stream: any) => {
if (err) {
reject(err);
return;
@ -475,7 +478,7 @@ export class SshClient {
script = envScripts.join(newLine) + newLine + script;
}
}
return await conn.exec(script as string, { env: options.env });
return await conn.exec(script as string, {});
},
});
}

View File

@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/certd/certd/compare/v1.33.6...v1.33.7) (2025-04-22)
### Performance Improvements
* 优化首页插件列表展示 ([9b8f60b](https://github.com/certd/certd/commit/9b8f60b64b5f9a3db7dfa9b3dcbd9201984358d0))
## [1.33.6](https://github.com/certd/certd/compare/v1.33.5...v1.33.6) (2025-04-20)
### Bug Fixes

View File

@ -1,6 +1,6 @@
{
"name": "@certd/ui-client",
"version": "1.33.6",
"version": "1.33.7",
"private": true,
"scripts": {
"dev": "vite --open",
@ -101,8 +101,8 @@
"zod-defaults": "^0.1.3"
},
"devDependencies": {
"@certd/lib-iframe": "^1.33.6",
"@certd/pipeline": "^1.33.6",
"@certd/lib-iframe": "^1.33.7",
"@certd/pipeline": "^1.33.7",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.12",

View File

@ -103,16 +103,20 @@
<a-row :gutter="10">
<a-col v-for="item of pluginGroups.groups.all.plugins" :key="item.name" class="plugin-item-col" :xl="4" :md="6" :xs="24">
<a-card>
<a-tooltip :title="item.desc" class="flex-between overflow-hidden">
<a-tooltip class="flex-between overflow-hidden">
<template #title>
<div>{{ item.title }}</div>
<div>{{ item.desc }}</div>
</template>
<div class="plugin-item pointer">
<div class="icon">
<fs-icon :icon="item.icon" class="font-size-16 color-blue" />
</div>
<div class="text">
<div class="text flex-1 ellipsis">
<div class="title">{{ item.title }}</div>
</div>
</div>
<div class="flex-o"><vip-button v-if="item.needPlus" mode="icon" class="" /></div>
<div class="flex-o ml-1"><vip-button v-if="item.needPlus" mode="icon" class="" /></div>
</a-tooltip>
</a-card>
</a-col>
@ -288,12 +292,17 @@ function openUpgradeUrl() {
.plugin-list {
margin: 0 20px;
.ant-card .ant-card-body {
padding: 16px;
}
.plugin-item-col {
margin-bottom: 10px;
.plugin-item {
display: flex;
justify-items: center;
line-height: 20px;
overflow: hidden;
flex: 1;
.icon {
display: flex;
justify-items: center;

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/certd/certd/compare/v1.33.6...v1.33.7) (2025-04-22)
### Performance Improvements
* 添加部署证书至火山 Live ([abea80e](https://github.com/certd/certd/commit/abea80e3ab9b1672aebe1c5d5e856693b29931a8))
* 证书申请支持51dns ([8638fc9](https://github.com/certd/certd/commit/8638fc91ff34fccaf12ff9874fd3fa9d2a8c18b7))
* 支持51dns ([96a0900](https://github.com/certd/certd/commit/96a0900edc95dcfd9acccf9d13592f12f5a09b3d))
## [1.33.6](https://github.com/certd/certd/compare/v1.33.5...v1.33.6) (2025-04-20)
### Bug Fixes

View File

@ -1,6 +1,6 @@
{
"name": "@certd/ui-server",
"version": "1.33.6",
"version": "1.33.7",
"description": "fast-server base midway",
"private": true,
"type": "module",
@ -38,19 +38,19 @@
"@aws-sdk/client-acm": "^3.699.0",
"@aws-sdk/client-cloudfront": "^3.699.0",
"@aws-sdk/client-s3": "^3.705.0",
"@certd/acme-client": "^1.33.6",
"@certd/basic": "^1.33.6",
"@certd/commercial-core": "^1.33.6",
"@certd/jdcloud": "^1.33.6",
"@certd/lib-huawei": "^1.33.6",
"@certd/lib-k8s": "^1.33.6",
"@certd/lib-server": "^1.33.6",
"@certd/midway-flyway-js": "^1.33.6",
"@certd/pipeline": "^1.33.6",
"@certd/plugin-cert": "^1.33.6",
"@certd/plugin-lib": "^1.33.6",
"@certd/plugin-plus": "^1.33.6",
"@certd/plus-core": "^1.33.6",
"@certd/acme-client": "^1.33.7",
"@certd/basic": "^1.33.7",
"@certd/commercial-core": "^1.33.7",
"@certd/jdcloud": "^1.33.7",
"@certd/lib-huawei": "^1.33.7",
"@certd/lib-k8s": "^1.33.7",
"@certd/lib-server": "^1.33.7",
"@certd/midway-flyway-js": "^1.33.7",
"@certd/pipeline": "^1.33.7",
"@certd/plugin-cert": "^1.33.7",
"@certd/plugin-lib": "^1.33.7",
"@certd/plugin-plus": "^1.33.7",
"@certd/plus-core": "^1.33.7",
"@corsinvest/cv4pve-api-javascript": "^8.3.0",
"@huaweicloud/huaweicloud-sdk-cdn": "^3.1.120",
"@huaweicloud/huaweicloud-sdk-core": "^3.1.120",
@ -76,6 +76,7 @@
"cos-nodejs-sdk-v5": "^2.14.6",
"cron-parser": "^4.9.0",
"cross-env": "^7.0.3",
"crypto-js": "^4.2.0",
"dayjs": "^1.11.7",
"form-data": "^4.0.0",
"glob": "^11.0.0",

View File

@ -18,3 +18,4 @@ export * from './plugin-dnsla/index.js';
export * from './plugin-upyun/index.js';
export * from './plugin-volcengine/index.js'
export * from './plugin-jdcloud/index.js'
export * from './plugin-51dns/index.js'

View File

@ -0,0 +1,40 @@
import { IsAccess, AccessInput, BaseAccess } from '@certd/pipeline';
/**
*
* certd
*/
@IsAccess({
name: '51dns',
title: '51dns授权',
icon: 'arcticons:dns-changer-3',
desc: '',
})
export class Dns51Access extends BaseAccess {
/**
*
*/
@AccessInput({
title: '用户名',
component: {
placeholder: '用户名或手机号',
},
required: true,
encrypt: false,
})
username = '';
@AccessInput({
title: '登录密码',
component: {
name:"a-input-password",
vModel:"value",
placeholder: '密码',
},
required: true,
encrypt: true,
})
password = '';
}
new Dns51Access();

View File

@ -0,0 +1,136 @@
import CryptoJS from 'crypto-js'
function aes(val) {
var k = CryptoJS.enc.Utf8.parse('1234567890abcDEF');
var iv = CryptoJS.enc.Utf8.parse('1234567890abcDEF');
const enc = CryptoJS.AES.encrypt(val, k, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.ZeroPadding
}).toString();
return enc;
}
import axios from 'axios'
const instance = axios.create({
baseURL: 'https://www.51dns.com',
timeout: 5000,
withCredentials: true,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
async function login() {
const res = await instance.request({
url: 'https://www.51dns.com/login.html',
method: 'get',
headers: {
// 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36',
'Origin': 'https://www.51dns.com',
'Referer': 'https://www.51dns.com',
}
})
//提取 var csrfToken = "ieOfM21eDd9nWJv3OZtMJF6ogDsnPKQHJ17dlMck";
const _token = res.data.match(/var csrfToken = "(.*?)"/)[1]
console.log(_token)
console.log(res.headers)
const setCookie = res.headers['set-cookie']
const cookie = setCookie.map(item => {
return item.split(';')[0]
}).join(';')
var obj = {
'email_or_phone': aes(""),
'password': aes(""),
'type': aes('account'),
'redirectTo': 'https://www.51dns.com/domain',
'_token': _token
}
console.log(JSON.stringify(obj, null, 2))
const res2 = await instance.request({
url: 'https://www.51dns.com/login',
method: 'post',
data: {
...obj
},
headers: {
/**
* Origin:
* https://www.51dns.com
* Referer:
* https://www.51dns.com/login.html
* User-Agent:
* Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36
// __root_domain_v=.51dns.com;
*/
// 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36',
'Origin': 'https://www.51dns.com',
'Referer': 'https://www.51dns.com/login.html',
'Content-Type': 'application/x-www-form-urlencoded',
'Cookie': cookie,
//X-Requested-With:
// XMLHttpRequest
'X-Requested-With': 'XMLHttpRequest'
}
})
console.log(res2.headers)
if (res2.data.code == 0) {
console.log("登录成功")
}
const setCookie2 = res2.headers['set-cookie']
const cookie2 = setCookie2.map(item => {
return item.split(';')[0]
}).join(';')
//
// // console.log(res2.data)
// // 提取 <span class="user_email">182****43522</span><br>
// console.log(res2.data.match(/<span class="user_email">(.*?)<\/span>/)[1])
// const success1 = res2.data.includes('<span class="nav-title">DNS解析</span>')
// console.log("success", success1)
const res3 = await instance.request({
url: 'https://www.51dns.com/domain',
method: 'get',
withCredentials: true,
headers: {
// 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36',
'Origin': 'https://www.51dns.com',
'Referer': 'https://www.51dns.com/login.html',
'Cookie': cookie2,
}
})
console.log(res3.statusText)
console.log(res3.headers)
const success2 = res3.data.includes('<span class="nav-title">DNS解析</span>')
console.log("success", success2)
/**
* <a target="_blank" href="https://www.51dns.com/domain/record/193341603"
* class="color47">certd.top</a>
*/
//上面文本中间有换行,需要提取 193341603 部分,必须有certd.top,使用 new Regexp, .号要能匹配换行符,非贪婪模式
const regExp = new RegExp('<a target="_blank" href="https://www.51dns.com/domain/record/(\\d+)"[^>]*>certd\\.top<\\/a>',"i");
const domainId = res3.data.match(regExp)[1]
console.log("domainId", domainId)
}
login()

View File

@ -0,0 +1,237 @@
import {createAxiosService, HttpClient, ILogger} from "@certd/basic";
import {Dns51Access} from "./access.js";
export class Dns51Client {
logger: ILogger;
access: Dns51Access;
http: HttpClient;
cryptoJs: any;
isLogined = false;
_token = "";
_cookie = "";
constructor(options: {
logger: ILogger;
access: Dns51Access;
}) {
this.logger = options.logger;
this.access = options.access;
this.http = createAxiosService({
logger: this.logger
});
}
aes(val: string) {
if (!this.cryptoJs) {
throw new Error("crypto-js not init");
}
const CryptoJS = this.cryptoJs;
var k = CryptoJS.enc.Utf8.parse("1234567890abcDEF");
var iv = CryptoJS.enc.Utf8.parse("1234567890abcDEF");
return CryptoJS.AES.encrypt(val, k, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.ZeroPadding
}).toString();
}
async init() {
if (this.cryptoJs) {
return;
}
const CryptoJSModule = await import("crypto-js");
this.cryptoJs = CryptoJSModule.default;
}
async login() {
if (this.isLogined) {
return;
}
await this.init();
const res = await this.http.request({
url: "https://www.51dns.com/login.html",
method: "get",
withCredentials: true,
logRes: false,
returnResponse: true,
headers: {
// 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36',
'Origin': 'https://www.51dns.com',
'Referer': 'https://www.51dns.com',
},
});
let setCookie = res.headers['set-cookie']
let cookie = setCookie.map((item: any) => {
return item.split(';')[0]
}).join(';')
//提取 var csrfToken = "ieOfM21eDd9nWJv3OZtMJF6ogDsnPKQHJ17dlMck";
const _token = res.data.match(/var csrfToken = "(.*?)"/)[1];
this.logger.info("_token:", _token);
this._token = _token;
var obj = {
"email_or_phone": this.aes(this.access.username),
"password": this.aes(this.access.password),
"type": this.aes("account"),
"redirectTo": "https://www.51dns.com/domain",
"_token": _token
};
const res2 = await this.http.request({
url: "https://www.51dns.com/login",
method: "post",
data: {
...obj
},
withCredentials: true,
logRes: false,
returnResponse: true,
headers: {
'Origin': 'https://www.51dns.com',
'Referer': 'https://www.51dns.com',
'Content-Type': 'application/x-www-form-urlencoded',
'Cookie': cookie,
'X-Requested-With': 'XMLHttpRequest'
}
});
this.logger.info("return headers:", JSON.stringify(res2.headers))
if (res2.data.code == 0) {
setCookie = res2.headers['set-cookie']
this._cookie = setCookie.map((item: any) => {
return item.split(';')[0]
}).join(';')
this.logger.info("cookie:", this._cookie)
this.logger.info("登录成功")
} else {
throw new Error("登录失败:", res2.data)
}
const res3 = await this.http.request({
url: 'https://www.51dns.com/domain',
method: 'get',
withCredentials: true,
logRes: false,
returnResponse: true,
headers: {
// 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36',
'Origin': 'https://www.51dns.com',
'Referer': 'https://www.51dns.com/login.html',
'Cookie': this._cookie,
}
})
const success2 = res3.data.includes('<span class="nav-title">DNS解析</span>')
if (!success2) {
throw new Error("检查登录失败")
}
this.logger.info("检查登录成功")
this.isLogined = true;
}
async getDomainId(domain: string) {
await this.login();
const res = await this.http.request({
url: `https://www.51dns.com/domain?domain=${domain}&status=`,
method: "get",
withCredentials: true,
logRes: false,
returnResponse: true,
headers: this.getRequestHeaders()
});
// 提取 <a target="_blank" href="https://www.51dns.com/domain/record/193341603"
// class="color47">certd.top</a>
const regExp = new RegExp(`<a target="_blank" href="https://www.51dns.com/domain/record/(\\d+)"[^>]*>${domain}<\\/a>`, "i");
const matched = res.data.match(regExp);
if (!matched || matched.length < 1) {
throw new Error(`域名${domain}不存在`);
}
const domainId = matched[1];
this.logger.info(`域名${domain}的id为${domainId}`)
return parseInt(domainId);
}
private getRequestHeaders() {
return {
'Origin': 'https://www.51dns.com',
'Referer': 'https://www.51dns.com',
'Cookie': this._cookie
};
}
async createRecord(param: { domain: string, data: any; domainId: number; host: string; ttl: number; type: string }) {
const {domain, data, host, type} = param;
const domainId = await this.getDomainId(domain);
const url = "https://www.51dns.com/domain/storenNewRecord";
const req = {
_token: this._token,
domain_id: domainId,
record: host,
type: type,
value: data,
ttl: 300,
mx:"",
view_id: 0
};
this.logger.info("req:", JSON.stringify(req))
const res = await this.http.request({
url,
method: "post",
data: req,
withCredentials: true,
headers: {
...this.getRequestHeaders(),
'Content-Type': 'application/x-www-form-urlencoded'
}
});
if (res.status !== 200) {
throw new Error(`创建域名解析失败:${res.msg}`);
}
const id = res.data.id;
return {
id,
domainId
};
}
async deleteRecord(param: { domainId: number; id: number }) {
const url = "https://www.51dns.com/domain/operateRecord"
/*
type: delete
ids[0]: 601019779
domain_id: 193341603
_token: ieOfM21eDd9nWJv3OZtMJF6ogDsnPKQHJ17dlMck
*/
const body = {
type: "delete",
ids: [param.id],
domain_id: param.domainId,
_token: this._token
}
const res = await this.http.request({
url,
method: "post",
data: body,
withCredentials: true,
headers: {
...this.getRequestHeaders(),
'Content-Type': 'application/x-www-form-urlencoded'
}
});
if (res.status !== 200) {
throw new Error(`删除域名解析失败:${res.msg}`);
}
}
}

View File

@ -0,0 +1,98 @@
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from "@certd/plugin-cert";
import { Dns51Access } from "./access.js";
import { Dns51Client } from "./client.js";
export type Dns51Record = {
id: number;
domainId: number,
};
// 这里通过IsDnsProvider注册一个dnsProvider
@IsDnsProvider({
name: '51dns',
title: '51dns',
desc: '51DNS',
icon: 'arcticons:dns-changer-3',
// 这里是对应的 cloudflare的access类型名称
accessType: '51dns',
})
export class Dns51DnsProvider extends AbstractDnsProvider<Dns51Record> {
// 通过Autowire传递context
access!: Dns51Access;
client!:Dns51Client;
async onInstance() {
//一些初始化的操作
// 也可以通过ctx成员变量传递context 与Autowire效果一样
this.access = this.ctx.access as Dns51Access;
this.client = new Dns51Client({
logger: this.logger,
access: this.access,
});
}
/**
* dns
*/
async createRecord(options: CreateRecordOptions): Promise<Dns51Record> {
/**
* fullRecord: '_acme-challenge.test.example.com',
* value: uuid
* type: 'TXT',
* domain: 'example.com'
*/
const { fullRecord,hostRecord, value, type, domain } = options;
this.logger.info('添加域名解析:', fullRecord, value, type, domain);
const domainId = await this.client.getDomainId(domain);
this.logger.info('获取domainId成功:', domainId);
const res = await this.client.createRecord({
domain: domain,
domainId: domainId,
type: 'TXT',
host: hostRecord,
data: value,
ttl: 300,
})
return {
id: res.id,
domainId: domainId,
};
}
/**
* dns,
* @param options
*/
async removeRecord(options: RemoveRecordOptions<Dns51Record>): Promise<void> {
const { fullRecord, value } = options.recordReq;
const record = options.recordRes;
this.logger.info('删除域名解析:', fullRecord, value);
if (!record) {
this.logger.info('record为空不执行删除');
return;
}
//这里调用删除txt dns解析记录接口
/**
*
* DELETE /api/record?id=85371689655342080 HTTP/1.1
* Authorization: Basic {token}
*
*/
const {id,domainId} = record
await this.client.deleteRecord({
id,
domainId
})
this.logger.info(`删除域名解析成功:fullRecord=${fullRecord},id=${id}`);
}
}
//实例化这个provider将其自动注册到系统中
new Dns51DnsProvider();

View File

@ -0,0 +1,3 @@
export * from './dns-provider.js';
export * from './access.js';
export * from './client.js';

View File

@ -2,3 +2,4 @@ export * from './plugin-deploy-to-cdn.js'
export * from './plugin-deploy-to-clb.js'
export * from './plugin-upload-to-cert-center.js'
export * from './plugin-deploy-to-alb.js'
export * from './plugin-deploy-to-live.js'

View File

@ -0,0 +1,144 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib";
import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert";
import { VolcengineAccess } from "../access.js";
import { VolcengineClient } from "../ve-client.js";
@IsTaskPlugin({
name: "VolcengineDeployToLive",
title: "火山引擎-部署证书至Live",
icon: "svg:icon-volcengine",
group: pluginGroups.volcengine.key,
desc: "部署至火山引擎视频直播",
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed
}
}
})
export class VolcengineDeployToLive extends AbstractTaskPlugin {
@TaskInput({
title: "域名证书",
helper: "请选择前置任务输出的域名证书",
component: {
name: "output-selector",
from: [...CertApplyPluginNames]
},
required: true
})
cert!: CertInfo;
@TaskInput(createCertDomainGetterInputDefine({ props: { required: false } }))
certDomains!: string[];
@TaskInput({
title: "Access授权",
helper: "火山引擎AccessKeyId、AccessKeySecret",
component: {
name: "access-selector",
type: "volcengine"
},
required: true
})
accessId!: string;
@TaskInput(
createRemoteSelectInputDefine({
title: "直播域名",
helper: "选择要部署证书的直播域名",
action: VolcengineDeployToLive.prototype.onGetDomainList.name,
watches: ["certDomains", "accessId"],
required: true
})
)
domainList!: string | string[];
async onInstance() {
}
async execute(): Promise<void> {
this.logger.info("开始部署证书到火山引擎视频直播");
const service = await this.getLiveService();
let certId = await this.uploadCert(service);
for (const item of this.domainList) {
this.logger.info(`开始部署直播域名${item}证书`);
await service.request({
action: "BindCert",
body: {
Domain: item,
HTTPS: true,
ChainID: certId
}
});
this.logger.info(`部署直播域名${item}证书成功`);
}
this.logger.info("部署完成");
}
private async uploadCert(liveService: any) {
const res = await liveService.request({
action: "CreateCert",
body: {
Rsa: {
Pubkey: this.cert.crt,
Prikey: this.cert.key
},
UseWay: "https"
}
});
const certId = res.Result.ChainID;
this.logger.info("证书上传成功", certId);
return certId;
}
private async getLiveService() {
const access = await this.getAccess<VolcengineAccess>(this.accessId);
const client = new VolcengineClient({
logger: this.logger,
access,
http: this.http
});
return await client.getLiveService();
}
async onGetDomainList(data: any) {
if (!this.accessId) {
throw new Error("请选择Access授权");
}
const service = await this.getLiveService();
const res = await service.request({
action: "ListDomainDetail",
body: {
"PageNum": 1,
"PageSize": 100
}
});
const list = res.Result?.DomainList;
if (!list || list.length === 0) {
throw new Error("找不到直播域名,您也可以手动输入域名");
}
const options = list.map((item: any) => {
return {
value: item.Domain,
label: `${item.Domain}<${item.Type}>`,
domain: item.Domain
};
});
return this.ctx.utils.options.buildGroupOptions(options, this.certDomains);
}
}
new VolcengineDeployToLive();

View File

@ -0,0 +1,199 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib";
import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert";
import { VolcengineAccess } from "../access.js";
import { VolcengineClient } from "../ve-client.js";
@IsTaskPlugin({
name: "VolcengineDeployToVOD",
title: "火山引擎-部署证书至VOD",
icon: "svg:icon-volcengine",
group: pluginGroups.volcengine.key,
desc: "部署至火山引擎视频点播(暂不可用)",
deprecated:"暂时缺少部署ssl接口",
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed
}
}
})
export class VolcengineDeployToVOD extends AbstractTaskPlugin {
@TaskInput({
title: "域名证书",
helper: "请选择前置任务输出的域名证书",
component: {
name: "output-selector",
from: [...CertApplyPluginNames, "VolcengineUploadToCertCenter"]
},
required: true
})
cert!: CertInfo | string;
@TaskInput(createCertDomainGetterInputDefine({ props: { required: false } }))
certDomains!: string[];
@TaskInput({
title: "Access授权",
helper: "火山引擎AccessKeyId、AccessKeySecret",
component: {
name: "access-selector",
type: "volcengine"
},
required: true
})
accessId!: string;
@TaskInput(
// createRemoteSelectInputDefine({
// title: "空间名称",
// helper: "选择要部署证书的监听器\n需要在监听器中选择证书中心进行跨服务访问授权",
// action: VolcengineDeployToVOD.prototype.onGetSpaceList.name,
// watches: ["certDomains", "accessId", "regionId"],
// required: true
// })
{
title: "空间名称",
required: true
}
)
spaceName!: string;
@TaskInput(
createRemoteSelectInputDefine({
title: "点播域名",
helper: "选择要部署证书的点播域名\n需要先在域名管理页面进行证书中心访问授权即点击去配置SSL证书",
action: VolcengineDeployToVOD.prototype.onGetDomainList.name,
watches: ["certDomains", "accessId", "spaceName"],
required: true
})
)
domainList!: string | string[];
async onInstance() {
}
async execute(): Promise<void> {
this.logger.info("开始部署证书到火山引擎VOD");
const access = await this.getAccess<VolcengineAccess>(this.accessId);
let certId = await this.uploadOrGetCertId(access);
const service = await this.getVodService();
for (const item of this.domainList) {
this.logger.info(`开始部署点播域名${item}证书`);
await service.request({
action: "ModifyListenerAttributes",
query: {
ListenerId: item,
CertificateSource: "cert_center",
CertCenterCertificateId: certId
}
});
this.logger.info(`部署点播域名${item}证书成功`);
}
this.logger.info("部署完成");
}
private async uploadOrGetCertId(access: VolcengineAccess) {
const certService = await this.getCertService(access);
let certId = this.cert;
if (typeof certId !== "string") {
const certInfo = this.cert as CertInfo;
this.logger.info(`开始上传证书`);
certId = await certService.ImportCertificate({
certName: this.appendTimeSuffix("certd"),
cert: certInfo
});
this.logger.info(`上传证书成功:${certId}`);
} else {
this.logger.info(`使用已有证书ID:${certId}`);
}
return certId;
}
private async getCertService(access: VolcengineAccess) {
const client = new VolcengineClient({
logger: this.logger,
access,
http: this.http
});
return await client.getCertCenterService();
}
private async getVodService(req?: { version?: string }) {
const access = await this.getAccess<VolcengineAccess>(this.accessId);
const client = new VolcengineClient({
logger: this.logger,
access,
http: this.http
});
return await client.getVodService(req);
}
// async onGetSpaceList(data: any) {
// if (!this.accessId) {
// throw new Error("请选择Access授权");
// }
// const service = await this.getVodService();
//
// const res = await service.request({
// action: "ListSpace",
// method: "GET",
// query: {
// PageSize: 100,
// },
// });
//
// const list = res.Result;
// if (!list || list.length === 0) {
// throw new Error("找不到空间,您可以手动填写");
// }
// return list.map((item: any) => {
// return {
// value: item.SpaceName,
// label: `${item.SpaceName}`
// };
// });
// }
async onGetDomainList(data: any) {
if (!this.accessId) {
throw new Error("请选择Access授权");
}
const service = await this.getVodService();
const res = await service.request({
action: "ListDomain",
body: {
SpaceName: this.spaceName,
Offset: 100
}
});
const instances = res.Result?.PlayInstanceInfo?.ByteInstances;
if (!instances || instances.length === 0) {
throw new Error("找不到点播域名,您也可以手动输入点播域名");
}
const list = []
for (const item of instances) {
for (const domain of item.Domains) {
list.push({
value: item.Domain,
label: item.Domain,
domain: domain.Domain
});
}
}
return this.ctx.utils.options.buildGroupOptions(list, this.certDomains);
}
}
new VolcengineDeployToVOD();

View File

@ -28,7 +28,7 @@ export class VolcengineClient {
service.ImportCertificate = async (body: { certName: string, cert: any }) => {
const { certName, cert } = body;
const res = await service.request({
const res = await service.request({
action: "ImportCertificate",
method: "POST",
body: {
@ -40,7 +40,7 @@ export class VolcengineClient {
}
}
});
return res.Result.InstanceId || res.Result.RepeatId
return res.Result.InstanceId || res.Result.RepeatId;
};
return service;
}
@ -59,6 +59,33 @@ export class VolcengineClient {
return service;
}
async getLiveService() {
const CommonService = await this.getServiceCls();
const service = new CommonService({
serviceName: "live",
defaultVersion: "2023-01-01"
});
service.setAccessKeyId(this.opts.access.accessKeyId);
service.setSecretKey(this.opts.access.secretAccessKey);
service.setRegion("cn-north-1");
return service;
}
async getVodService(opts?: { version?: string }) {
const CommonService = await this.getServiceCls();
const service = new CommonService({
serviceName: "vod",
defaultVersion: opts?.version || "2021-01-01"
});
service.setAccessKeyId(this.opts.access.accessKeyId);
service.setSecretKey(this.opts.access.secretAccessKey);
return service;
}
async getAlbService(opts: { region?: string }) {
const CommonService = await this.getServiceCls();

View File

@ -46,7 +46,7 @@ importers:
packages/core/acme-client:
dependencies:
'@certd/basic':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../basic
'@peculiar/x509':
specifier: ^1.11.0
@ -204,10 +204,10 @@ importers:
packages/core/pipeline:
dependencies:
'@certd/basic':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../basic
'@certd/plus-core':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../pro/plus-core
dayjs:
specifier: ^1.11.7
@ -412,7 +412,7 @@ importers:
packages/libs/lib-k8s:
dependencies:
'@certd/basic':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/basic
'@kubernetes/client-node':
specifier: 0.21.0
@ -452,16 +452,16 @@ importers:
packages/libs/lib-server:
dependencies:
'@certd/acme-client':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/acme-client
'@certd/basic':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/basic
'@certd/pipeline':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/pipeline
'@certd/plus-core':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../pro/plus-core
'@midwayjs/cache':
specifier: ~3.14.0
@ -604,16 +604,16 @@ importers:
packages/plugins/plugin-cert:
dependencies:
'@certd/acme-client':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/acme-client
'@certd/basic':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/basic
'@certd/pipeline':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/pipeline
'@certd/plugin-lib':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../plugin-lib
'@google-cloud/publicca':
specifier: ^1.3.0
@ -680,10 +680,10 @@ importers:
specifier: ^1.7.10
version: 1.8.0
'@certd/basic':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/basic
'@certd/pipeline':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/pipeline
'@kubernetes/client-node':
specifier: 0.21.0
@ -771,19 +771,19 @@ importers:
packages/pro/commercial-core:
dependencies:
'@certd/basic':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/basic
'@certd/lib-server':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../libs/lib-server
'@certd/pipeline':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/pipeline
'@certd/plugin-plus':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../plugin-plus
'@certd/plus-core':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../plus-core
'@midwayjs/core':
specifier: ~3.20.3
@ -868,22 +868,22 @@ importers:
specifier: ^1.0.2
version: 1.0.2
'@certd/basic':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/basic
'@certd/lib-k8s':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../libs/lib-k8s
'@certd/pipeline':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/pipeline
'@certd/plugin-cert':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../plugins/plugin-cert
'@certd/plugin-lib':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../plugins/plugin-lib
'@certd/plus-core':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../plus-core
ali-oss:
specifier: ^6.21.0
@ -980,7 +980,7 @@ importers:
packages/pro/plus-core:
dependencies:
'@certd/basic':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/basic
dayjs:
specifier: ^1.11.7
@ -1270,10 +1270,10 @@ importers:
version: 0.1.3(zod@3.24.2)
devDependencies:
'@certd/lib-iframe':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../libs/lib-iframe
'@certd/pipeline':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/pipeline
'@rollup/plugin-commonjs':
specifier: ^25.0.7
@ -1453,43 +1453,43 @@ importers:
specifier: ^3.705.0
version: 3.758.0(aws-crt@1.25.3)
'@certd/acme-client':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/acme-client
'@certd/basic':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/basic
'@certd/commercial-core':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../pro/commercial-core
'@certd/jdcloud':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../libs/lib-jdcloud
'@certd/lib-huawei':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../libs/lib-huawei
'@certd/lib-k8s':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../libs/lib-k8s
'@certd/lib-server':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../libs/lib-server
'@certd/midway-flyway-js':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../libs/midway-flyway-js
'@certd/pipeline':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../core/pipeline
'@certd/plugin-cert':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../plugins/plugin-cert
'@certd/plugin-lib':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../plugins/plugin-lib
'@certd/plugin-plus':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../pro/plugin-plus
'@certd/plus-core':
specifier: ^1.33.5
specifier: ^1.33.6
version: link:../../pro/plus-core
'@corsinvest/cv4pve-api-javascript':
specifier: ^8.3.0
@ -1566,6 +1566,9 @@ importers:
cross-env:
specifier: ^7.0.3
version: 7.0.3
crypto-js:
specifier: ^4.2.0
version: 4.2.0
dayjs:
specifier: ^1.11.7
version: 1.11.13
@ -20673,13 +20676,13 @@ snapshots:
resolve: 1.22.10
semver: 6.3.1
eslint-plugin-prettier@3.4.1(eslint-config-prettier@8.10.0(eslint@8.57.0))(eslint@7.32.0)(prettier@2.8.8):
eslint-plugin-prettier@3.4.1(eslint-config-prettier@8.10.0(eslint@7.32.0))(eslint@7.32.0)(prettier@2.8.8):
dependencies:
eslint: 7.32.0
prettier: 2.8.8
prettier-linter-helpers: 1.0.0
optionalDependencies:
eslint-config-prettier: 8.10.0(eslint@8.57.0)
eslint-config-prettier: 8.10.0(eslint@7.32.0)
eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.0))(eslint@8.57.0)(prettier@2.8.8):
dependencies:
@ -23393,7 +23396,7 @@ snapshots:
eslint: 7.32.0
eslint-config-prettier: 8.10.0(eslint@7.32.0)
eslint-plugin-node: 11.1.0(eslint@7.32.0)
eslint-plugin-prettier: 3.4.1(eslint-config-prettier@8.10.0(eslint@8.57.0))(eslint@7.32.0)(prettier@2.8.8)
eslint-plugin-prettier: 3.4.1(eslint-config-prettier@8.10.0(eslint@7.32.0))(eslint@7.32.0)(prettier@2.8.8)
execa: 5.1.1
inquirer: 7.3.3
json5: 2.2.3