chore: 修复metadata 插件加载失败的问题

This commit is contained in:
xiaojunnuo
2025-12-31 18:36:24 +08:00
parent a3fb24993d
commit ed0016fd2b
13 changed files with 132 additions and 120 deletions

View File

@@ -46,27 +46,27 @@
| 42.| **UCloud授权** | 优刻得授权 |
| 43.| **FTP授权** | |
| 44.| **s3/minio授权** | S3/minio oss授权 |
| 45.| **EAB授权** | ZeroSSL证书申请需要EAB授权 |
| 46.| **google cloud** | 谷歌云授权 |
| 47.| **宝塔云WAF授权** | 用于连接和管理宝塔云WAF服务的授权配置 |
| 48.| **易盾DCDN授权** | https://user.yiduncdn.com |
| 49.| **易盾rcdn授权** | 易盾CDN每月免费30G[注册即领](https://rhcdn.yiduncdn.com/register?code=8mn536rrzfbf8) |
| 50.| **易发云短信** | sms.yfyidc.cn/ |
| 51.| **cdnfly授权** | |
| 52.| **群晖登录授权** | |
| 53.| **k8s授权** | |
| 54.| **1panel授权** | 账号和密码 |
| 55.| **LeCDN授权** | |
| 56.| **白山云授权** | |
| 57.| **plesk授权** | |
| 58.| **支付** | |
| 59.| **支付宝** | |
| 60.| **微信支付** | |
| 61.| **长亭雷池授权** | |
| 62.| **lucky** | |
| 63.| **括彩云cdn授权** | 括彩云CDN每月免费30G[注册即领](https://kuocaicdn.com/register?code=8mn536rrzfbf8) |
| 64.| **uniCloud** | unicloud授权 |
| 65.| **猫云授权** | |
| 45.| **宝塔云WAF授权** | 用于连接和管理宝塔云WAF服务的授权配置 |
| 46.| **易盾DCDN授权** | https://user.yiduncdn.com |
| 47.| **易盾rcdn授权** | 易盾CDN每月免费30G[注册即领](https://rhcdn.yiduncdn.com/register?code=8mn536rrzfbf8) |
| 48.| **易发云短信** | sms.yfyidc.cn/ |
| 49.| **cdnfly授权** | |
| 50.| **群晖登录授权** | |
| 51.| **k8s授权** | |
| 52.| **1panel授权** | 账号和密码 |
| 53.| **LeCDN授权** | |
| 54.| **白山云授权** | |
| 55.| **plesk授权** | |
| 56.| **易支付** | |
| 57.| **支付宝** | |
| 58.| **微信支付** | |
| 59.| **长亭雷池授权** | |
| 60.| **lucky** | |
| 61.| **括彩云cdn授权** | 括彩云CDN每月免费30G[注册即领](https://kuocaicdn.com/register?code=8mn536rrzfbf8) |
| 62.| **uniCloud** | unicloud授权 |
| 63.| **猫云授权** | |
| 64.| **EAB授权** | ZeroSSL证书申请需要EAB授权 |
| 65.| **google cloud** | 谷歌云授权 |
| 66.| **雨云授权** | https://app.rainyun.com/ |
| 67.| **GoEdge授权** | |

View File

@@ -12,6 +12,7 @@ const customFileDetector = new DirectoryFileDetector({
module.exports = async () => {
// 加载框架并执行
await Bootstrap.configure({
ignore: ["**/plugins/**","/plugins/","plugins","dist/plugins","/dist/plugins","dist\\plugins","dist/plugins"],
moduleDetector: customFileDetector,
}).run();
// 获取依赖注入容器

View File

@@ -1,2 +1,4 @@
import { Bootstrap } from '@midwayjs/bootstrap';
await Bootstrap.run();
await Bootstrap.configure({
ignore: ["**/plugins/**","/plugins/","plugins","dist/plugins","/dist/plugins","dist\\plugins"]
}).run();

View File

@@ -35,6 +35,9 @@ export default async function loadModules(dir) {
continue
}
const content = fs.readFileSync(file, 'utf8')
if(content.includes(" abstract ")){
continue
}
const lines = content.split('\n')
let allExport = true
for (let line of lines) {

View File

@@ -8,7 +8,7 @@
"start": "cross-env NODE_ENV=production node --optimize-for-size ./bootstrap.js",
"dev-start": "cross-env NODE_ENV=dev & mwtsc --watch --run @midwayjs/mock/app",
"dc": "cd ../../../ && pnpm run dev",
"dev": "cross-env NODE_ENV=local & pnpm run dev-start",
"dev": "pnpm run dev-start",
"dev-commlocal": "cross-env NODE_ENV=dev-commlocal mwtsc --watch --run @midwayjs/mock/app",
"dev-commpro": "cross-env NODE_ENV=dev-commpro mwtsc --watch --run @midwayjs/mock/app",
"dev-pg": "cross-env NODE_ENV=dev-pg mwtsc --watch --run @midwayjs/mock/app",

View File

@@ -309,7 +309,7 @@ export class PluginService extends BaseService<PluginEntity> {
const scriptFilePath = item.scriptFilePath;
const res = await import((`${scriptFilePath}`))
const classNames = Object.keys(res)
return res[classNames[0]]
return res[classNames[classNames.length - 1]]
}
async getPluginClassFromDb(pluginName: string) {

View File

@@ -1,6 +1,7 @@
import { IAccessService } from '@certd/pipeline';
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
import { AliesaAccess, AliyunAccess, AliyunClientV2 } from '../../plugin-lib/aliyun/index.js';
import { AliesaAccess, AliyunAccess } from '../../plugin-lib/aliyun/index.js';
import { AliyunClientV2 } from '../../plugin-lib/aliyun/lib/aliyun-client-v2.js';
@IsDnsProvider({

View File

@@ -4,8 +4,9 @@ import {
createCertDomainGetterInputDefine,
createRemoteSelectInputDefine
} from "@certd/plugin-lib";
import { AliyunAccess, AliyunClientV2 } from "../../../plugin-lib/aliyun/access/index.js";
import { AliyunAccess } from "../../../plugin-lib/aliyun/access/index.js";
import { AliyunClient, AliyunSslClient } from "../../../plugin-lib/aliyun/lib/index.js";
import { AliyunClientV2 } from "../../../plugin-lib/aliyun/lib/aliyun-client-v2.js";
@IsTaskPlugin({
name: "AliyunDeployCertToALB",

View File

@@ -4,8 +4,9 @@ import {
createCertDomainGetterInputDefine,
createRemoteSelectInputDefine
} from "@certd/plugin-lib";
import { AliyunAccess, AliyunClientV2 } from "../../../plugin-lib/aliyun/access/index.js";
import { AliyunAccess } from "../../../plugin-lib/aliyun/access/index.js";
import { AliyunSslClient } from "../../../plugin-lib/aliyun/lib/ssl-client.js";
import { AliyunClientV2 } from "../../../plugin-lib/aliyun/lib/aliyun-client-v2.js";
@IsTaskPlugin({
name: "AliyunDeployCertToESA",

View File

@@ -5,8 +5,9 @@ import {
createRemoteSelectInputDefine
} from "@certd/plugin-lib";
import { CertApplyPluginNames} from '@certd/plugin-cert';
import { AliyunAccess, AliyunClientV2 } from "../../../plugin-lib/aliyun/access/index.js";
import { AliyunAccess } from "../../../plugin-lib/aliyun/access/index.js";
import { AliyunClient, AliyunSslClient } from "../../../plugin-lib/aliyun/lib/index.js";
import { AliyunClientV2 } from '../../../plugin-lib/aliyun/lib/aliyun-client-v2.js';
@IsTaskPlugin({
name: 'AliyunDeployCertToNLB',
title: '阿里云-部署至NLB网络负载均衡',

View File

@@ -2,7 +2,6 @@ import { CancelError, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from
import { utils } from "@certd/basic";
import { AcmeService, DomainsVerifyPlan, DomainVerifyPlan, PrivateKeyType, SSLProvider } from "./acme.js";
import * as _ from "lodash-es";
import { createDnsProvider, DnsProviderContext, DnsVerifier, DomainVerifiers, HttpVerifier, IDnsProvider, IDomainVerifierGetter, ISubDomainsGetter } from "@certd/plugin-lib";
import { CertReader } from "@certd/plugin-lib";
import { CertApplyBasePlugin } from "./base.js";
@@ -10,6 +9,7 @@ import { GoogleClient } from "../../libs/google.js";
import { EabAccess } from "../../access/index.js";
import { DomainParser } from "@certd/plugin-lib";
import { ossClientFactory } from "../../../plugin-lib/oss/factory.js";
import { merge } from "lodash-es";
export * from "./base.js";
export type CnameRecordInput = {
@@ -472,7 +472,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
}
const domains = this["domains"];
const csrInfo = _.merge(
const csrInfo = merge(
{
// country: "CN",
// state: "GuangDong",

View File

@@ -1,94 +1,5 @@
import { AccessInput, BaseAccess, IsAccess } from "@certd/pipeline";
import { ILogger } from "@certd/basic";
export type AliyunClientV2Req = {
action: string;
version: string;
protocol?: "HTTPS";
// 接口 HTTP 方法
method?: "GET" | "POST";
authType?: "AK";
style?: "RPC" | "ROA";
// 接口 PATH
pathname?: string;
data?: any;
};
export class AliyunClientV2 {
access: AliyunAccess;
logger: ILogger;
endpoint: string;
client: any;
constructor(opts: { access: AliyunAccess; logger: ILogger; endpoint: string }) {
this.access = opts.access;
this.logger = opts.logger;
this.endpoint = opts.endpoint;
}
async getClient() {
if (this.client) {
return this.client;
}
const $OpenApi = await import("@alicloud/openapi-client");
// const Credential = await import("@alicloud/credentials");
// //@ts-ignore
// const credential = new Credential.default.default({
//
// type: "access_key",
// });
const config = new $OpenApi.Config({
accessKeyId: this.access.accessKeyId,
accessKeySecret: this.access.accessKeySecret,
});
// Endpoint 请参考 https://api.aliyun.com/product/FC
// config.endpoint = `esa.${this.regionId}.aliyuncs.com`;
config.endpoint = this.endpoint;
//@ts-ignore
this.client = new $OpenApi.default.default(config);
return this.client;
}
async doRequest(req: AliyunClientV2Req) {
const client = await this.getClient();
const $OpenApi = await import("@alicloud/openapi-client");
const $Util = await import("@alicloud/tea-util");
const OpenApiUtil = await import("@alicloud/openapi-util");
const params = new $OpenApi.Params({
// 接口名称
action: req.action,
// 接口版本
version: req.version,
// 接口协议
protocol: "HTTPS",
// 接口 HTTP 方法
method: req.method ?? "POST",
authType: req.authType ?? "AK",
style: req.style ?? "RPC",
// 接口 PATH
pathname: req.pathname ?? `/`,
// 接口请求体内容格式
reqBodyType: "json",
// 接口响应体内容格式
bodyType: "json",
});
if (req.data?.query) {
//@ts-ignore
req.data.query = OpenApiUtil.default.default.query(req.data.query);
}
const runtime = new $Util.RuntimeOptions({});
const request = new $OpenApi.OpenApiRequest(req.data);
// 复制代码运行请自行打印 API 的返回值
// 返回值实际为 Map 类型,可从 Map 中获得三类数据:响应体 body、响应头 headers、HTTP 返回的状态码 statusCode。
const res = await client.callApi(params, request, runtime);
/**
* res?.body?.
*/
return res?.body;
}
}
import { AliyunClientV2 } from "../lib/aliyun-client-v2.js";
@IsAccess({
name: "aliyun",
title: "阿里云授权",

View File

@@ -0,0 +1,91 @@
import { ILogger } from "@certd/basic";
import { AliyunAccess } from "../access/aliyun-access.js";
export type AliyunClientV2Req = {
action: string;
version: string;
protocol?: "HTTPS";
// 接口 HTTP 方法
method?: "GET" | "POST";
authType?: "AK";
style?: "RPC" | "ROA";
// 接口 PATH
pathname?: string;
data?: any;
};
export class AliyunClientV2 {
access: AliyunAccess;
logger: ILogger;
endpoint: string;
client: any;
constructor(opts: { access: AliyunAccess; logger: ILogger; endpoint: string }) {
this.access = opts.access;
this.logger = opts.logger;
this.endpoint = opts.endpoint;
}
async getClient() {
if (this.client) {
return this.client;
}
const $OpenApi = await import("@alicloud/openapi-client");
// const Credential = await import("@alicloud/credentials");
// //@ts-ignore
// const credential = new Credential.default.default({
//
// type: "access_key",
// });
const config = new $OpenApi.Config({
accessKeyId: this.access.accessKeyId,
accessKeySecret: this.access.accessKeySecret,
});
// Endpoint 请参考 https://api.aliyun.com/product/FC
// config.endpoint = `esa.${this.regionId}.aliyuncs.com`;
config.endpoint = this.endpoint;
//@ts-ignore
this.client = new $OpenApi.default.default(config);
return this.client;
}
async doRequest(req: AliyunClientV2Req) {
const client = await this.getClient();
const $OpenApi = await import("@alicloud/openapi-client");
const $Util = await import("@alicloud/tea-util");
const OpenApiUtil = await import("@alicloud/openapi-util");
const params = new $OpenApi.Params({
// 接口名称
action: req.action,
// 接口版本
version: req.version,
// 接口协议
protocol: "HTTPS",
// 接口 HTTP 方法
method: req.method ?? "POST",
authType: req.authType ?? "AK",
style: req.style ?? "RPC",
// 接口 PATH
pathname: req.pathname ?? `/`,
// 接口请求体内容格式
reqBodyType: "json",
// 接口响应体内容格式
bodyType: "json",
});
if (req.data?.query) {
//@ts-ignore
req.data.query = OpenApiUtil.default.default.query(req.data.query);
}
const runtime = new $Util.RuntimeOptions({});
const request = new $OpenApi.OpenApiRequest(req.data);
// 复制代码运行请自行打印 API 的返回值
// 返回值实际为 Map 类型,可从 Map 中获得三类数据:响应体 body、响应头 headers、HTTP 返回的状态码 statusCode。
const res = await client.callApi(params, request, runtime);
/**
* res?.body?.
*/
return res?.body;
}
}