mirror of
https://github.com/certd/certd.git
synced 2026-05-17 22:07:34 +08:00
perf: 重构自动加载模块并优化EAB授权处理
refactor(ui): 将分散的auto-*模块整合为统一命名的auto-register模块 perf(plugin-cert): 增强EAB授权功能,支持账号私钥刷新和类型选择 test: 添加EAB授权服务和ACME账号配置的单元测试 docs: 更新AGENTS.md补充ACME/EAB使用注意事项 chore: 统一各package.json中的测试脚本配置
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
"build": "npm run before-build && rollup -c ",
|
||||
"dev-build": "npm run build",
|
||||
"preview": "vite preview",
|
||||
"test:unit": "echo no unit tests",
|
||||
"test:unit": "cross-env NODE_ENV=unittest echo no unit tests",
|
||||
"pub": "npm publish"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -22,6 +22,8 @@
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
||||
"@typescript-eslint/parser": "^8.26.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"esmock": "^2.7.5",
|
||||
"prettier": "^2.8.8",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"build3": "rollup -c",
|
||||
"build2": "vue-tsc --noEmit && vite build",
|
||||
"preview": "vite preview",
|
||||
"test:unit": "echo no unit tests",
|
||||
"test:unit": "cross-env NODE_ENV=unittest echo no unit tests",
|
||||
"pub": "npm publish"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -24,9 +24,11 @@
|
||||
"@types/chai": "^4.3.3",
|
||||
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
||||
"@typescript-eslint/parser": "^8.26.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.24.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"esmock": "^2.7.5",
|
||||
"prettier": "^2.8.8",
|
||||
"rimraf": "^5.0.5",
|
||||
"tslib": "^2.8.1",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"scripts": {
|
||||
"build": "rollup -c ",
|
||||
"dev-build": "npm run build",
|
||||
"test:unit": "echo no unit tests",
|
||||
"test:unit": "cross-env NODE_ENV=unittest echo no unit tests",
|
||||
"pub": "npm publish"
|
||||
},
|
||||
"author": "",
|
||||
@@ -30,7 +30,8 @@
|
||||
"@typescript-eslint/parser": "^8.26.1",
|
||||
"chai": "^4.1.2",
|
||||
"config": "^1.30.0",
|
||||
"cross-env": "^5.1.4",
|
||||
"cross-env": "^7.0.3",
|
||||
"esmock": "^2.7.5",
|
||||
"js-yaml": "^3.11.0",
|
||||
"mocha": "^5.0.0",
|
||||
"prettier": "^2.8.8",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"build3": "rollup -c",
|
||||
"build2": "vue-tsc --noEmit && vite build",
|
||||
"preview": "vite preview",
|
||||
"test:unit": "echo no unit tests",
|
||||
"test:unit": "cross-env NODE_ENV=unittest echo no unit tests",
|
||||
"pub": "npm publish",
|
||||
"compile": "tsc --skipLibCheck --watch"
|
||||
},
|
||||
@@ -26,9 +26,11 @@
|
||||
"@types/chai": "^4.3.3",
|
||||
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
||||
"@typescript-eslint/parser": "^8.26.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.24.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"esmock": "^2.7.5",
|
||||
"prettier": "^2.8.8",
|
||||
"rimraf": "^5.0.5",
|
||||
"tslib": "^2.8.1",
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"build": "npm run before-build && tsc --skipLibCheck",
|
||||
"dev-build": "npm run build",
|
||||
"test": "midway-bin test --ts -V",
|
||||
"test:unit": "mocha --no-config --node-option no-warnings --node-option loader=ts-node/esm \"src/**/*.test.ts\"",
|
||||
"test:unit": "cross-env NODE_ENV=unittest mocha --no-config --node-option no-warnings --node-option loader=ts-node/esm \"src/**/*.test.ts\"",
|
||||
"test1": "midway-bin test --ts -V -f test/blank.test.ts -t 'hash-check'",
|
||||
"cov": "midway-bin cov --ts",
|
||||
"lint": "mwts check",
|
||||
@@ -44,7 +44,6 @@
|
||||
"@midwayjs/upload": "3.20.13",
|
||||
"@midwayjs/validate": "3.20.13",
|
||||
"better-sqlite3": "^11.1.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"dayjs": "^1.11.7",
|
||||
"lodash-es": "^4.17.21",
|
||||
"mwts": "^1.3.0",
|
||||
@@ -57,9 +56,11 @@
|
||||
"@types/node": "^18",
|
||||
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
||||
"@typescript-eslint/parser": "^8.26.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.24.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"esmock": "^2.7.5",
|
||||
"mocha": "^10.2.0",
|
||||
"prettier": "^2.8.8",
|
||||
"rimraf": "^5.0.5",
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import assert from "assert";
|
||||
import { AccessService } from "./access-service.js";
|
||||
|
||||
describe("AccessService", () => {
|
||||
it("does not write id into access setting when updating selected fields", async () => {
|
||||
let updateParam: any;
|
||||
const service = new AccessService();
|
||||
service.info = async () => ({
|
||||
id: 12,
|
||||
type: "eab",
|
||||
} as any);
|
||||
service.decryptAccessEntity = () => ({
|
||||
kid: "kid-1",
|
||||
});
|
||||
service.update = async (param: any) => {
|
||||
updateParam = param;
|
||||
return param;
|
||||
};
|
||||
|
||||
await service.updateAccess({
|
||||
id: 12,
|
||||
accountKey: "account-key",
|
||||
});
|
||||
|
||||
assert.deepEqual(JSON.parse(updateParam.setting), {
|
||||
kid: "kid-1",
|
||||
accountKey: "account-key",
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -123,6 +123,25 @@ export class AccessService extends BaseService<AccessEntity> {
|
||||
return await super.update(param);
|
||||
}
|
||||
|
||||
async updateAccess(access: any) {
|
||||
const oldEntity = await this.info(access.id);
|
||||
if (oldEntity == null) {
|
||||
throw new ValidateException('该授权配置不存在,请确认是否已被删除');
|
||||
}
|
||||
const setting = this.decryptAccessEntity(oldEntity);
|
||||
for (const key of Object.keys(access)) {
|
||||
if (key === 'id') {
|
||||
continue;
|
||||
}
|
||||
setting[key] = access[key];
|
||||
}
|
||||
return await this.update({
|
||||
id: access.id,
|
||||
type: oldEntity.type,
|
||||
setting: JSON.stringify(setting),
|
||||
});
|
||||
}
|
||||
|
||||
async getSimpleInfo(id: number) {
|
||||
const entity = await this.info(id);
|
||||
if (entity == null) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"dev-build": "npm run build",
|
||||
"test": "midway-bin test --ts -V",
|
||||
"test1": "midway-bin test --ts -V -f test/blank.test.ts -t 'hash-check'",
|
||||
"test:unit": "echo no unit tests",
|
||||
"test:unit": "cross-env NODE_ENV=unittest echo no unit tests",
|
||||
"cov": "midway-bin cov --ts",
|
||||
"prepublish": "npm run build",
|
||||
"pub": "npm publish"
|
||||
@@ -36,11 +36,13 @@
|
||||
"@types/node": "^18",
|
||||
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
||||
"@typescript-eslint/parser": "^8.26.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.24.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"esmock": "^2.7.5",
|
||||
"prettier": "^2.8.8",
|
||||
"rimraf": "^5.0.5",
|
||||
"tslib": "^2.8.1",
|
||||
|
||||
Reference in New Issue
Block a user