mirror of
https://github.com/certd/certd.git
synced 2026-04-16 05:50:50 +08:00
refactor(core): 重构访问控制和插件实例化逻辑
- 修改访问控制和插件注册方式,使用异步函数统一实例化逻辑 - 更新相关组件和控制器以适应新的异步实例化方式 - 优化 DNS 提供商选择器,增加访问类型支持
This commit is contained in:
@@ -27,6 +27,8 @@ export class DnsProviderController extends BaseController {
|
||||
dict.push({
|
||||
value: item.name,
|
||||
label: item.title,
|
||||
//@ts-ignore
|
||||
accessType: item.accessType,
|
||||
});
|
||||
}
|
||||
return this.ok(dict);
|
||||
|
||||
@@ -49,7 +49,7 @@ export class HandleController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
const access = newAccess(body.typeName, inputAccess);
|
||||
const access = await newAccess(body.typeName, inputAccess);
|
||||
|
||||
const res = await access.onRequest(body);
|
||||
|
||||
@@ -76,7 +76,7 @@ export class HandleController extends BaseController {
|
||||
async pluginRequest(@Body(ALL) body: PluginRequestHandleReq) {
|
||||
const userId = this.getUserId();
|
||||
const pluginDefine = pluginRegistry.get(body.typeName);
|
||||
const pluginCls = pluginDefine.target;
|
||||
const pluginCls = await pluginDefine.target();
|
||||
if (pluginCls == null) {
|
||||
throw new Error(`plugin ${body.typeName} not found`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user