chore: 移除 autowire

pull/409/head
xiaojunnuo 2025-04-28 23:34:08 +08:00
parent 0b6941d5ce
commit f2d6c3ad83
17 changed files with 116 additions and 106 deletions

View File

@ -65,7 +65,7 @@ export class Registry<T = any> {
}
getDefineList() {
const list = [];
let list = [];
for (const key in this.storage) {
const define = this.getDefine(key);
if (define) {
@ -78,6 +78,10 @@ export class Registry<T = any> {
list.push({ ...define, key });
}
}
list = list.sort((a, b) => {
return (a.order ?? 10) - (b?.order ?? 10);
});
return list;
}

View File

@ -1,6 +1,5 @@
import { CreateRecordOptions, DnsProviderContext, DnsProviderDefine, IDnsProvider, RemoveRecordOptions } from "./api.js";
import { dnsProviderRegistry } from "./registry.js";
import { Decorator } from "@certd/pipeline";
import { HttpClient, ILogger } from "@certd/basic";
export abstract class AbstractDnsProvider<T = any> implements IDnsProvider<T> {

View File

@ -1,11 +1,11 @@
// 扫描目录,列出文件,然后加载为模块
import { join } from 'path';
import fs from 'fs'
import path, { join } from "path";
import fs from "fs";
import { pathToFileURL } from "node:url";
import path from 'path'
import * as yaml from "js-yaml";
import {AbstractTaskPlugin, BaseAccess, BaseNotification} from "@certd/pipeline";
import { AbstractTaskPlugin, BaseAccess, BaseNotification } from "@certd/pipeline";
function scanDir(dir) {
const files = fs.readdirSync(dir);
const result = [];
@ -92,4 +92,7 @@ for (const key in modules) {
}
}
}
process.exit();
// import why from 'why-is-node-running'
// setTimeout(() => why(), 100); // 延迟打印原因
process.exit(-1)

View File

@ -3,6 +3,7 @@ title: 51dns
desc: 51DNS
icon: arcticons:dns-changer-3
accessType: 51dns
order: 999
type: builtIn
pluginType: dnsProvider
scriptFilePath: ../../../plugins/plugin-51dns/index.js

View File

@ -3,6 +3,7 @@ title: 阿里云
desc: 阿里云DNS解析提供商
accessType: aliyun
icon: svg:icon-aliyun
order: 0
type: builtIn
pluginType: dnsProvider
scriptFilePath: ../../../plugins/plugin-aliyun/dns-provider/aliyun-dns-provider.js

View File

@ -132,7 +132,8 @@
"prettier": "^2.8.8",
"rimraf": "^5.0.5",
"tslib": "^2.8.1",
"typescript": "^5.4.2"
"typescript": "^5.4.2",
"why-is-node-running": "^3.2.2"
},
"engines": {
"node": ">=18.0.0"

View File

@ -26,11 +26,11 @@ process.on('uncaughtException', error => {
});
@Configuration({
detectorOptions: {
ignore: [
'**/plugins/**'
]
},
// detectorOptions: {
// ignore: [
// '**/plugins/**'
// ]
// },
imports: [
koa,
orm,

View File

@ -80,7 +80,10 @@ export class AccessController extends CrudController<AccessService> {
@Post('/accessTypeDict', { summary: Constants.per.authOnly })
async getAccessTypeDict() {
const list: AccessDefine[] = this.service.getDefineList();
let list: AccessDefine[] = this.service.getDefineList();
list = list.sort((a,b) => {
return (a.order??10) - (b.order??10);
});
const dict = [];
for (const item of list) {
dict.push({

View File

@ -12,7 +12,7 @@ export class AutoBLoadPlugins {
@Init()
async init() {
logger.info('加载插件开始');
await this.pluginService.registerFromLocal("./metadata")
// await this.pluginService.registerFromLocal("./metadata")
await import("../../plugins/index.js")
await this.pluginService.registerFromDb()
logger.info('加载插件完成');

View File

@ -297,7 +297,7 @@ export class PluginService extends BaseService<PluginEntity> {
}
//排序
list = list.sort((a, b) => {
return a.order??10 - b.order ??10;
return (a.order??10) - (b.order ??10);
});
for (const item of list) {

View File

@ -1,22 +1,22 @@
export * from '@certd/plugin-cert';
export * from '@certd/plugin-plus';
// export * from './plugin-aliyun/index.js';
// export * from './plugin-tencent/index.js';
// export * from './plugin-host/index.js';
// export * from './plugin-huawei/index.js';
// export * from './plugin-demo/index.js';
// export * from './plugin-other/index.js';
// export * from './plugin-west/index.js';
// export * from './plugin-doge/index.js';
// export * from './plugin-qiniu/index.js';
// export * from './plugin-woai/index.js';
// export * from './plugin-cachefly/index.js';
// export * from './plugin-gcore/index.js';
// export * from './plugin-qnap/index.js';
// export * from './plugin-aws/index.js';
// 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'
// export * from './plugin-notification/index.js'
export * from './plugin-aliyun/index.js';
export * from './plugin-tencent/index.js';
export * from './plugin-host/index.js';
export * from './plugin-huawei/index.js';
export * from './plugin-demo/index.js';
export * from './plugin-other/index.js';
export * from './plugin-west/index.js';
export * from './plugin-doge/index.js';
export * from './plugin-qiniu/index.js';
export * from './plugin-woai/index.js';
export * from './plugin-cachefly/index.js';
export * from './plugin-gcore/index.js';
export * from './plugin-qnap/index.js';
export * from './plugin-aws/index.js';
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'
export * from './plugin-notification/index.js'

View File

@ -16,6 +16,7 @@ export type Dns51Record = {
icon: 'arcticons:dns-changer-3',
// 这里是对应的 cloudflare的access类型名称
accessType: '51dns',
order:999,
})
export class Dns51DnsProvider extends AbstractDnsProvider<Dns51Record> {
access!: Dns51Access;

View File

@ -8,6 +8,7 @@ import { AliyunAccess, AliyunClient } from '@certd/plugin-lib';
desc: '阿里云DNS解析提供商',
accessType: 'aliyun',
icon: 'svg:icon-aliyun',
order:0,
})
export class AliyunDnsProvider extends AbstractDnsProvider {
client: any;

View File

@ -1,9 +1,9 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline';
import { CertInfo, CertReader } from '@certd/plugin-cert';
import * as fs from 'fs';
import { Constants } from '@certd/lib-server';
import path from 'path';
import { CertApplyPluginNames} from '@certd/plugin-cert';
const dataDir = "./data"
@IsTaskPlugin({
name: 'CopyToLocal',
title: '主机-复制到本机',
@ -209,37 +209,37 @@ export class CopyCertToLocalPlugin extends AbstractTaskPlugin {
this.logger.info('复制到目标路径');
if (crtPath) {
crtPath = crtPath.trim();
crtPath = crtPath.startsWith('/') ? crtPath : path.join(Constants.dataDir, crtPath);
crtPath = crtPath.startsWith('/') ? crtPath : path.join(dataDir, crtPath);
this.copyFile(tmpCrtPath, crtPath);
this.hostCrtPath = crtPath;
}
if (keyPath) {
keyPath = keyPath.trim();
keyPath = keyPath.startsWith('/') ? keyPath : path.join(Constants.dataDir, keyPath);
keyPath = keyPath.startsWith('/') ? keyPath : path.join(dataDir, keyPath);
this.copyFile(tmpKeyPath, keyPath);
this.hostKeyPath = keyPath;
}
if (icPath) {
icPath = icPath.trim();
icPath = icPath.startsWith('/') ? icPath : path.join(Constants.dataDir, icPath);
icPath = icPath.startsWith('/') ? icPath : path.join(dataDir, icPath);
this.copyFile(tmpIcPath, icPath);
this.hostIcPath = icPath;
}
if (pfxPath) {
pfxPath = pfxPath.trim();
pfxPath = pfxPath.startsWith('/') ? pfxPath : path.join(Constants.dataDir, pfxPath);
pfxPath = pfxPath.startsWith('/') ? pfxPath : path.join(dataDir, pfxPath);
this.copyFile(tmpPfxPath, pfxPath);
this.hostPfxPath = pfxPath;
}
if (derPath) {
derPath = derPath.trim();
derPath = derPath.startsWith('/') ? derPath : path.join(Constants.dataDir, derPath);
derPath = derPath.startsWith('/') ? derPath : path.join(dataDir, derPath);
this.copyFile(tmpDerPath, derPath);
this.hostDerPath = derPath;
}
if (jksPath) {
jksPath = jksPath.trim();
jksPath = jksPath.startsWith('/') ? jksPath : path.join(Constants.dataDir, jksPath);
jksPath = jksPath.startsWith('/') ? jksPath : path.join(dataDir, jksPath);
this.copyFile(tmpJksPath, jksPath);
this.hostJksPath = jksPath;
}

View File

@ -1,4 +1,3 @@
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
import * as _ from 'lodash-es';
import { DnspodAccess } from '../access/index.js';

View File

@ -16,7 +16,7 @@ export class VolcengineDnsProvider extends AbstractDnsProvider {
async onInstance() {
this.access = this.ctx.access
this.access = this.ctx.access as VolcengineAccess
this.client = new VolcengineDnsClient({
access: this.access,
logger: this.logger,

View File

@ -46,7 +46,7 @@ importers:
packages/core/acme-client:
dependencies:
'@certd/basic':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../basic
'@peculiar/x509':
specifier: ^1.11.0
@ -207,10 +207,10 @@ importers:
packages/core/pipeline:
dependencies:
'@certd/basic':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../basic
'@certd/plus-core':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../pro/plus-core
dayjs:
specifier: ^1.11.7
@ -415,7 +415,7 @@ importers:
packages/libs/lib-k8s:
dependencies:
'@certd/basic':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/basic
'@kubernetes/client-node':
specifier: 0.21.0
@ -455,16 +455,16 @@ importers:
packages/libs/lib-server:
dependencies:
'@certd/acme-client':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/acme-client
'@certd/basic':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/basic
'@certd/pipeline':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/pipeline
'@certd/plus-core':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../pro/plus-core
'@midwayjs/cache':
specifier: ~3.14.0
@ -607,16 +607,16 @@ importers:
packages/plugins/plugin-cert:
dependencies:
'@certd/acme-client':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/acme-client
'@certd/basic':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/basic
'@certd/pipeline':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/pipeline
'@certd/plugin-lib':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../plugin-lib
'@google-cloud/publicca':
specifier: ^1.3.0
@ -689,10 +689,10 @@ importers:
specifier: ^3.787.0
version: 3.787.0(aws-crt@1.25.3)
'@certd/basic':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/basic
'@certd/pipeline':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/pipeline
'@kubernetes/client-node':
specifier: 0.21.0
@ -780,19 +780,19 @@ importers:
packages/pro/commercial-core:
dependencies:
'@certd/basic':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/basic
'@certd/lib-server':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../libs/lib-server
'@certd/pipeline':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/pipeline
'@certd/plugin-plus':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../plugin-plus
'@certd/plus-core':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../plus-core
'@midwayjs/core':
specifier: ~3.20.3
@ -877,22 +877,22 @@ importers:
specifier: ^1.0.2
version: 1.0.2
'@certd/basic':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/basic
'@certd/lib-k8s':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../libs/lib-k8s
'@certd/pipeline':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/pipeline
'@certd/plugin-cert':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../plugins/plugin-cert
'@certd/plugin-lib':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../plugins/plugin-lib
'@certd/plus-core':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../plus-core
ali-oss:
specifier: ^6.21.0
@ -989,7 +989,7 @@ importers:
packages/pro/plus-core:
dependencies:
'@certd/basic':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/basic
dayjs:
specifier: ^1.11.7
@ -1279,10 +1279,10 @@ importers:
version: 0.1.3(zod@3.24.2)
devDependencies:
'@certd/lib-iframe':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../libs/lib-iframe
'@certd/pipeline':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/pipeline
'@rollup/plugin-commonjs':
specifier: ^25.0.7
@ -1419,9 +1419,6 @@ importers:
vite-plugin-compression:
specifier: ^0.5.1
version: 0.5.1(vite@5.4.14(@types/node@18.19.80)(less@4.2.2)(terser@5.39.0))
vite-plugin-dynamic-base:
specifier: ^1.1.0
version: 1.1.0(vite@5.4.14(@types/node@18.19.80)(less@4.2.2)(terser@5.39.0))
vite-plugin-html:
specifier: ^3.2.2
version: 3.2.2(vite@5.4.14(@types/node@18.19.80)(less@4.2.2)(terser@5.39.0))
@ -1465,43 +1462,43 @@ importers:
specifier: ^3.705.0
version: 3.758.0(aws-crt@1.25.3)
'@certd/acme-client':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/acme-client
'@certd/basic':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/basic
'@certd/commercial-core':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../pro/commercial-core
'@certd/jdcloud':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../libs/lib-jdcloud
'@certd/lib-huawei':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../libs/lib-huawei
'@certd/lib-k8s':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../libs/lib-k8s
'@certd/lib-server':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../libs/lib-server
'@certd/midway-flyway-js':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../libs/midway-flyway-js
'@certd/pipeline':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../core/pipeline
'@certd/plugin-cert':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../plugins/plugin-cert
'@certd/plugin-lib':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../plugins/plugin-lib
'@certd/plugin-plus':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../pro/plugin-plus
'@certd/plus-core':
specifier: ^1.33.7
specifier: ^1.34.0
version: link:../../pro/plus-core
'@corsinvest/cv4pve-api-javascript':
specifier: ^8.3.0
@ -1738,6 +1735,9 @@ importers:
typescript:
specifier: ^5.4.2
version: 5.8.2
why-is-node-running:
specifier: ^3.2.2
version: 3.2.2
packages:
@ -13015,11 +13015,6 @@ packages:
peerDependencies:
vite: '>=2.0.0'
vite-plugin-dynamic-base@1.1.0:
resolution: {integrity: sha512-/hIOTuzedlPRiUTCIY1cJx7UDDUF0brxWIifE7xG1czCJy0Aw6k3QPbHVjPCs30YuU+WAgrX4ACOySLIp2NHkw==}
peerDependencies:
vite: '>= 2.9.5'
vite-plugin-html@3.2.2:
resolution: {integrity: sha512-vb9C9kcdzcIo/Oc3CLZVS03dL5pDlOFuhGlZYDCJ840BhWl/0nGeZWf3Qy7NlOayscY4Cm/QRgULCQkEZige5Q==}
peerDependencies:
@ -13337,6 +13332,11 @@ packages:
engines: {node: '>=8'}
hasBin: true
why-is-node-running@3.2.2:
resolution: {integrity: sha512-NKUzAelcoCXhXL4dJzKIwXeR8iEVqsA0Lq6Vnd0UXvgaKbzVo4ZTHROF2Jidrv+SgxOQ03fMinnNhzZATxOD3A==}
engines: {node: '>=20.11'}
hasBin: true
wide-align@1.1.5:
resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==}
@ -18063,8 +18063,10 @@ snapshots:
'@swc/core-win32-arm64-msvc': 1.11.22
'@swc/core-win32-ia32-msvc': 1.11.22
'@swc/core-win32-x64-msvc': 1.11.22
optional: true
'@swc/counter@0.1.3': {}
'@swc/counter@0.1.3':
optional: true
'@swc/helpers@0.5.15':
dependencies:
@ -18073,6 +18075,7 @@ snapshots:
'@swc/types@0.1.21':
dependencies:
'@swc/counter': 0.1.3
optional: true
'@szmarczak/http-timer@1.1.2':
dependencies:
@ -21769,13 +21772,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:
@ -24489,7 +24492,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
@ -27988,14 +27991,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
vite-plugin-dynamic-base@1.1.0(vite@5.4.14(@types/node@18.19.80)(less@4.2.2)(terser@5.39.0)):
dependencies:
'@swc/core': 1.11.22
node-html-parser: 5.4.2
vite: 5.4.14(@types/node@18.19.80)(less@4.2.2)(terser@5.39.0)
transitivePeerDependencies:
- '@swc/helpers'
vite-plugin-html@3.2.2(vite@5.4.14(@types/node@18.19.80)(less@4.2.2)(terser@5.39.0)):
dependencies:
'@rollup/pluginutils': 4.2.1
@ -28348,6 +28343,8 @@ snapshots:
siginfo: 2.0.0
stackback: 0.0.2
why-is-node-running@3.2.2: {}
wide-align@1.1.5:
dependencies:
string-width: 4.2.3