Compare commits

...

13 Commits

Author SHA1 Message Date
xiaojunnuo
e5c164065c v1.28.2 2024-12-09 22:45:02 +08:00
xiaojunnuo
8bc241ca14 build: prepare to build 2024-12-09 22:42:55 +08:00
xiaojunnuo
15beb79631 chore: 2024-12-09 22:40:17 +08:00
xiaojunnuo
fef1305e41 chore: 2024-12-09 21:44:37 +08:00
xiaojunnuo
498cf34999 fix: 修复创建流水线通知设置无效的bug 2024-12-09 18:04:45 +08:00
xiaojunnuo
7cde1fdc4a perf: 支持mysql 2024-12-09 17:47:01 +08:00
xiaojunnuo
228fdf0a0d perf: 优化数据表索引 2024-12-09 15:59:14 +08:00
xiaojunnuo
fdb5ea0ff4 Merge remote-tracking branch 'origin/v2-dev' into v2-dev 2024-12-09 09:34:12 +08:00
xiaojunnuo
a0e838d1ee fix: 修复流水线分组可以被所有人看见的bug 2024-12-09 02:24:30 +08:00
xiaojunnuo
30ddf5ec41 build: publish 2024-12-09 01:56:13 +08:00
xiaojunnuo
cfd3b7b3ae build: trigger build image 2024-12-09 01:55:54 +08:00
xiaojunnuo
138dc286f6 chore: 删除cloudflare cdn插件 2024-12-05 13:34:21 +08:00
xiaojunnuo
07cee2aadf chore: 2024-12-05 12:10:31 +08:00
81 changed files with 747 additions and 228 deletions

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
### Bug Fixes
* 修复创建流水线通知设置无效的bug ([498cf34](https://github.com/certd/certd/commit/498cf34999fddfa24ce088e2e678469fa669abb8))
* 修复流水线分组可以被所有人看见的bug ([a0e838d](https://github.com/certd/certd/commit/a0e838d1eec918e5dc92fe95dc72ac14facb930e))
### Performance Improvements
* 优化数据表索引 ([228fdf0](https://github.com/certd/certd/commit/228fdf0a0d28013f5dd156a97bbde80537e8e97e))
* 支持mysql ([7cde1fd](https://github.com/certd/certd/commit/7cde1fdc4a9ed851900d231a5460c8dbfbcd148e))
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Bug Fixes

View File

@@ -1 +1 @@
03:24
01:55

View File

@@ -33,7 +33,7 @@ services:
# 配置规则: certd_ + 配置项, 点号用_代替
# #↓↓↓↓ ----------------------------- 如果忘记管理员密码可以设置为true重启之后管理员密码将改成123456然后请及时修改回false
- certd_system_resetAdminPasswd=false
# #↓↓↓↓ ----------------------------- 使用postgresql数据库
# #↓↓↓↓ ----------------------------- 使用postgresql数据库,需要提前创建数据库
# - certd_flyway_scriptDir=./db/migration-pg # 升级脚本目录
# - certd_typeorm_dataSource_default_type=postgres # 数据库类型
# - certd_typeorm_dataSource_default_host=localhost # 数据库地址
@@ -42,6 +42,19 @@ services:
# - certd_typeorm_dataSource_default_password=yourpasswd # 密码
# - certd_typeorm_dataSource_default_database=certd # 数据库名
# #↓↓↓↓ ----------------------------- 使用mysql数据库需要提前创建数据库 charset=utf8mb4, collation=utf8mb4_bin
# - certd_flyway_scriptDir=./db/migration-mysql # 升级脚本目录
# - certd_typeorm_dataSource_default_type=mysql # 数据库类型, 或者 mariadb
# - certd_typeorm_dataSource_default_host=localhost # 数据库地址
# - certd_typeorm_dataSource_default_port=3306 # 数据库端口
# - certd_typeorm_dataSource_default_username=root # 用户名
# - certd_typeorm_dataSource_default_password=yourpasswd # 密码
# - certd_typeorm_dataSource_default_database=certd # 数据库名
# #↓↓↓↓ ------------------------------------------------------------- 启用ipv6网络
# networks:
# - ip6net

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Bug Fixes
* 修复cname排查方法 nslookup命令显示黑色的问题 ([3dfeeec](https://github.com/certd/certd/commit/3dfeeec899d7d0d7292695ce410f78548e076c03))
### Performance Improvements
* 通知选择器优化 ([2c0cbdd](https://github.com/certd/certd/commit/2c0cbdd29ecb74cc939b2ae7ee86b8d40f70ba31))
* 新增七牛云插件分组 ([49e7dc5](https://github.com/certd/certd/commit/49e7dc56e1a95fbdea3e30cdeb945b48415b69e3))
* 新增server酱3通知 ([6aa4872](https://github.com/certd/certd/commit/6aa487269c9f6862e188b37a0d6c73f79c937d94))
* 支持邀请奖励 ([618ec93](https://github.com/certd/certd/commit/618ec937866b24ebcf8164db43acb1ed66a5b329))
* 支持易发云短信 ([94fa77f](https://github.com/certd/certd/commit/94fa77fcd2b9bea294fb05736c0d8cdc81f56103))
* cname value优化 ([e8c9c2a](https://github.com/certd/certd/commit/e8c9c2a47d47048ae743b16f7bc932dbe18a89e9))
* favicon支持自定义 ([8b9c47d](https://github.com/certd/certd/commit/8b9c47daf194515006689a212ae9cf586bdf5993))
# [1.28.0](https://github.com/certd/certd/compare/v1.27.9...v1.28.0) (2024-11-30)
### Bug Fixes

View File

@@ -30,5 +30,5 @@ Certd 是一款开源、免费、全自动申请和部署更新SSL证书的工
## 三、证书颁发机构对比
* Let's Encrypt申请最简单。
* Google: 大厂光环兼容性好需要翻墙获取EAB。
* Google: 大厂光环,兼容性好,首次需要翻墙获取EAB。
* ZeroSSL 需要EAB获取EAB无需翻墙。

View File

@@ -9,5 +9,5 @@
}
},
"npmClient": "pnpm",
"version": "1.28.1"
"version": "1.28.2"
}

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.28.2](https://github.com/publishlab/node-acme-client/compare/v1.28.1...v1.28.2) (2024-12-09)
### Performance Improvements
* 支持mysql ([7cde1fd](https://github.com/publishlab/node-acme-client/commit/7cde1fdc4a9ed851900d231a5460c8dbfbcd148e))
## [1.28.1](https://github.com/publishlab/node-acme-client/compare/v1.28.0...v1.28.1) (2024-12-08)
**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.28.1",
"version": "1.28.2",
"type": "module",
"module": "scr/index.js",
"main": "src/index.js",
@@ -18,7 +18,7 @@
"types"
],
"dependencies": {
"@certd/basic": "^1.28.1",
"@certd/basic": "^1.28.2",
"@peculiar/x509": "^1.11.0",
"asn1js": "^3.0.5",
"axios": "^1.7.2",
@@ -65,5 +65,5 @@
"bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}

View File

@@ -0,0 +1,137 @@
"use strict";
/**
* acme-client type definition tests
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var acme = require("acme-client");
(function () { return __awaiter(void 0, void 0, void 0, function () {
var accountKey, client, order, authorizations, authorization, challenge, _a, certKey, certCsr;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, acme.crypto.createPrivateKey()];
case 1:
accountKey = _b.sent();
client = new acme.Client({
accountKey: accountKey,
directoryUrl: acme.directory.letsencrypt.staging
});
/* Account */
return [4 /*yield*/, client.createAccount({
termsOfServiceAgreed: true,
contact: ['mailto:test@example.com']
})];
case 2:
/* Account */
_b.sent();
return [4 /*yield*/, client.createOrder({
identifiers: [
{ type: 'dns', value: 'example.com' },
{ type: 'dns', value: '*.example.com' },
]
})];
case 3:
order = _b.sent();
return [4 /*yield*/, client.getOrder(order)];
case 4:
_b.sent();
return [4 /*yield*/, client.getAuthorizations(order)];
case 5:
authorizations = _b.sent();
authorization = authorizations[0];
challenge = authorization.challenges[0];
return [4 /*yield*/, client.getChallengeKeyAuthorization(challenge)];
case 6:
_b.sent();
return [4 /*yield*/, client.verifyChallenge(authorization, challenge)];
case 7:
_b.sent();
return [4 /*yield*/, client.completeChallenge(challenge)];
case 8:
_b.sent();
return [4 /*yield*/, client.waitForValidStatus(challenge)];
case 9:
_b.sent();
return [4 /*yield*/, acme.crypto.createCsr({
commonName: 'example.com',
altNames: ['example.com', '*.example.com']
})];
case 10:
_a = _b.sent(), certKey = _a[0], certCsr = _a[1];
return [4 /*yield*/, client.finalizeOrder(order, certCsr)];
case 11:
_b.sent();
return [4 /*yield*/, client.getCertificate(order)];
case 12:
_b.sent();
return [4 /*yield*/, client.getCertificate(order, 'DST Root CA X3')];
case 13:
_b.sent();
/* Auto */
return [4 /*yield*/, client.auto({
csr: certCsr,
challengeCreateFn: function (authz, challenge, keyAuthorization) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/];
}); }); },
challengeRemoveFn: function (authz, challenge, keyAuthorization) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/];
}); }); }
})];
case 14:
/* Auto */
_b.sent();
return [4 /*yield*/, client.auto({
csr: certCsr,
email: 'test@example.com',
termsOfServiceAgreed: false,
skipChallengeVerification: false,
challengePriority: ['http-01', 'dns-01'],
preferredChain: 'DST Root CA X3',
challengeCreateFn: function (authz, challenge, keyAuthorization) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/];
}); }); },
challengeRemoveFn: function (authz, challenge, keyAuthorization) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/];
}); }); }
})];
case 15:
_b.sent();
return [2 /*return*/];
}
});
}); })();

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.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/basic
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Performance Improvements

View File

@@ -1 +1 @@
01:50
22:42

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/basic",
"private": false,
"version": "1.28.1",
"version": "1.28.2",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@@ -43,5 +43,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}

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.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/pipeline
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Performance Improvements

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/pipeline",
"private": false,
"version": "1.28.1",
"version": "1.28.2",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@@ -16,8 +16,8 @@
"test": "mocha --loader=ts-node/esm"
},
"dependencies": {
"@certd/basic": "^1.28.1",
"@certd/plus-core": "^1.28.1",
"@certd/basic": "^1.28.2",
"@certd/plus-core": "^1.28.2",
"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": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}

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.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/lib-huawei
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
**Note:** Version bump only for package @certd/lib-huawei

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/lib-huawei",
"private": false,
"version": "1.28.1",
"version": "1.28.2",
"main": "./dist/bundle.js",
"module": "./dist/bundle.js",
"types": "./dist/d/index.d.ts",
@@ -21,5 +21,5 @@
"prettier": "^2.8.8",
"tslib": "^2.8.1"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}

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.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/lib-iframe
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
**Note:** Version bump only for package @certd/lib-iframe

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/lib-iframe",
"private": false,
"version": "1.28.1",
"version": "1.28.2",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
@@ -30,5 +30,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}

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.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/lib-k8s
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
**Note:** Version bump only for package @certd/lib-k8s

View File

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

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.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/lib-server
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Performance Improvements

View File

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

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.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
**Note:** Version bump only for package @certd/midway-flyway-js

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/midway-flyway-js",
"version": "1.28.1",
"version": "1.28.2",
"description": "midway with flyway, sql upgrade way ",
"private": false,
"type": "module",
@@ -46,5 +46,5 @@
"typeorm": "^0.3.11",
"typescript": "^5.4.2"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}

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.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/plugin-cert
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
**Note:** Version bump only for package @certd/plugin-cert

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-cert",
"private": false,
"version": "1.28.1",
"version": "1.28.2",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -15,9 +15,9 @@
"preview": "vite preview"
},
"dependencies": {
"@certd/acme-client": "^1.28.1",
"@certd/basic": "^1.28.1",
"@certd/pipeline": "^1.28.1",
"@certd/acme-client": "^1.28.2",
"@certd/basic": "^1.28.2",
"@certd/pipeline": "^1.28.2",
"@google-cloud/publicca": "^1.3.0",
"dayjs": "^1.11.7",
"jszip": "^3.10.1",
@@ -40,5 +40,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}

View File

@@ -137,7 +137,7 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
{ value: "zerossl", label: "ZeroSSL", icon: "emojione:digit-zero" },
],
},
helper: "Let's Encrypt申请最简单\nGoogle大厂光环兼容性好需要翻墙获取EAB授权\nZeroSSL需要EAB授权无需翻墙",
helper: "Let's Encrypt申请最简单\nGoogle大厂光环兼容性好仅首次需要翻墙获取EAB授权\nZeroSSL需要EAB授权无需翻墙",
required: true,
})
sslProvider!: SSLProvider;

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.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
**Note:** Version bump only for package @certd/plugin-lib
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
**Note:** Version bump only for package @certd/plugin-lib

View File

@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-lib",
"private": false,
"version": "1.28.1",
"version": "1.28.2",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
@@ -16,9 +16,9 @@
},
"dependencies": {
"@alicloud/pop-core": "^1.7.10",
"@certd/basic": "^1.28.1",
"@certd/pipeline": "^1.28.1",
"@certd/plugin-cert": "^1.28.1",
"@certd/basic": "^1.28.2",
"@certd/pipeline": "^1.28.2",
"@certd/plugin-cert": "^1.28.2",
"@kubernetes/client-node": "0.21.0",
"dayjs": "^1.11.7",
"iconv-lite": "^0.6.3",
@@ -44,5 +44,5 @@
"tslib": "^2.8.1",
"typescript": "^5.4.2"
},
"gitHead": "7e103b774467143a2c9913a30df427760aab781c"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}

View File

@@ -9,6 +9,7 @@ RUN npm install -g pnpm@8.15.7
RUN cp /workspace/certd-client/dist/* /workspace/certd-server/public/ -rf
RUN cd /workspace/certd-server && pnpm install && npm run build-on-docker
FROM node:20-alpine
EXPOSE 7001
EXPOSE 7002

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.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
### Bug Fixes
* 修复创建流水线通知设置无效的bug ([498cf34](https://github.com/certd/certd/commit/498cf34999fddfa24ce088e2e678469fa669abb8))
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/ui-client",
"version": "1.28.1",
"version": "1.28.2",
"private": true,
"scripts": {
"dev": "vite --open",
@@ -65,8 +65,8 @@
"vuedraggable": "^4.1.0"
},
"devDependencies": {
"@certd/lib-iframe": "^1.28.1",
"@certd/pipeline": "^1.28.1",
"@certd/lib-iframe": "^1.28.2",
"@certd/pipeline": "^1.28.2",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.12",

View File

@@ -126,14 +126,12 @@ function clear() {
}
async function emitValue(value: any) {
const target = optionsDictRef.dataMap[value];
if (value !== 0 && pipeline?.value && target && pipeline.value.userId !== target.userId) {
if (value !== 0 && pipeline?.value && target && pipeline.value.userId !== target.value.userId) {
message.error("对不起,您不能修改他人流水线的通知");
return;
}
emit("change", value);
emit("update:modelValue", value);
emit("selectedChange", target);
}
watch(
@@ -143,6 +141,7 @@ watch(
async (value) => {
await optionsDictRef.loadDict();
target.value = optionsDictRef.dataMap[value];
emit("selectedChange", target.value);
},
{
immediate: true

View File

@@ -110,7 +110,12 @@ export default function (certPlugins: any[], formWrapperRef: any): CreateCrudOpt
value: 0,
component: {
name: NotificationSelector,
vModel: "modelValue"
vModel: "modelValue",
on: {
selectedChange({ $event, form }) {
form.notificationTarget = $event;
}
}
},
order: 101,
helper: "任务执行失败实时提醒"

View File

@@ -40,6 +40,7 @@ export default {
await doSubmitRef.value({ form });
if (form.email) {
//创建一个默认的邮件通知
const notificationApi = createNotificationApi();
await notificationApi.GetOrCreateDefault({ email: form.email });
}

View File

@@ -102,12 +102,12 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
triggers.push({ title: "定时触发", type: "timer", props: { cron: form.triggerCron } });
}
const notifications = [];
if (form.notification) {
if (form.notification != null) {
notifications.push({
type: "custom",
when: ["error", "turnToSuccess"],
notificationId: 0,
title: "使用默认通知"
notificationId: form.notification,
title: form.notificationTarget?.name || "自定义通知"
});
}
let pipeline = {

View File

@@ -0,0 +1,14 @@
flyway:
scriptDir: './db/migration-mysql'
typeorm:
dataSource:
default:
type: mysql # mariadb
host: localhost
port: 3306
username: root
password: root
database: certd

View File

@@ -1,12 +0,0 @@
{
"extends": "./node_modules/mwts/",
"ignorePatterns": ["node_modules", "dist", "test", "typings"],
"env": {
"mocha": true
},
"rules": {
"max-len": ["error", 160],
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/ban-ts-comment": "off"
}
}

View File

@@ -1,7 +0,0 @@
{
"printWidth": 160,
"bracketSpacing": true,
"singleQuote": true,
"trailingComma": "es5",
"arrowParens": "avoid"
}

View File

@@ -1,4 +0,0 @@
module.exports = {
...require('mwts/.prettierrc.json'),
"printWidth": 160,
}

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.2](https://github.com/certd/certd/compare/v1.28.1...v1.28.2) (2024-12-09)
### Bug Fixes
* 修复创建流水线通知设置无效的bug ([498cf34](https://github.com/certd/certd/commit/498cf34999fddfa24ce088e2e678469fa669abb8))
* 修复流水线分组可以被所有人看见的bug ([a0e838d](https://github.com/certd/certd/commit/a0e838d1eec918e5dc92fe95dc72ac14facb930e))
### Performance Improvements
* 优化数据表索引 ([228fdf0](https://github.com/certd/certd/commit/228fdf0a0d28013f5dd156a97bbde80537e8e97e))
* 支持mysql ([7cde1fd](https://github.com/certd/certd/commit/7cde1fdc4a9ed851900d231a5460c8dbfbcd148e))
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Performance Improvements

View File

@@ -1,29 +1,16 @@
# my_midway_project
# certd-server
## QuickStart
## heap分析
<!-- add docs here for user -->
```shell
# node_modules\@midwayjs\bootstrap\dist\bootstrap.js
# 注释 137行
// process.once('SIGINT', this.onSignal.bind(t
see [midway docs][midway] for more detail.
### Development
```bash
$ npm i
$ npm run dev
$ open http://localhost:7001/
```
### Deploy
```shell
npm run heap
```bash
$ npm start
```
### npm scripts
- Use `npm run lint` to check code style.
- Use `npm test` to run unit test.
[midway]: https://midwayjs.org

View File

@@ -1,5 +1,24 @@
import fs from 'fs';
//读取 packages/core/pipline/package.json的版本号
//删除references
import { default as packageJson } from './tsconfig.json' assert { type: 'json' };
delete packageJson.references;
fs.writeFileSync('./tsconfig.json', JSON.stringify(packageJson, null, 2));
//瘦身
const filePath = './node_modules/typeorm/platform/PlatformTools.js';
const find = `const cli_highlight_1 = require("cli-highlight");`;
const rep = 'const cli_highlight_1 ={highlight: (str) => { return str }};';
// 在 filePath 找到 find那一行 用 rep 替换
function slimming(filePath, find, rep) {
fs.readFile(filePath, 'utf8', function (err, data) {
if (err) {
return console.log(err);
}
var result = data.replace(find, rep);
fs.writeFile(filePath, result, 'utf8', function (err) {
if (err) return console.log(err);
});
});
}
slimming(filePath, find, rep);

View File

@@ -0,0 +1,77 @@
-- 表sys_permission
CREATE TABLE `sys_permission` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `title` varchar(100) NOT NULL, `permission` varchar(100), `parent_id` bigint NOT NULL DEFAULT -1, `sort` bigint NOT NULL, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (1, '系统管理', 'sys', -1, 1 );
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (2, '权限管理', 'sys:auth', 1, 1 );
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (3, '用户管理', 'sys:auth:user', 2, 1);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (4, '查看', 'sys:auth:user:view', 3, 100);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (5, '权限管理', 'sys:auth:per', 2, 1 );
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (6, '查看', 'sys:auth:per:view', 5, 100);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (7, '角色管理', 'sys:auth:role', 2, 1 );
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (8, '查看', 'sys:auth:role:view', 7, 1);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (9, '修改', 'sys:auth:user:edit', 3, 300);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (10, '删除', 'sys:auth:user:remove', 3, 400);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (11, '添加', 'sys:auth:user:add', 3, 200);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (12, '修改', 'sys:auth:role:edit', 7, 1);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (13, '删除', 'sys:auth:role:remove', 7, 1);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (14, '添加', 'sys:auth:role:add', 7, 1);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (15, '修改', 'sys:auth:per:edit', 5, 300);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (16, '删除', 'sys:auth:per:remove', 5, 400);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (17, '添加', 'sys:auth:per:add', 5, 200);
INSERT INTO sys_permission (id, title, permission, parent_id, sort) VALUES (18,'授权','sys:auth:role:authz',7,100);
-- 表sys_role
CREATE TABLE `sys_role` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `name` varchar(100) NOT NULL, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
INSERT INTO sys_role (id, name) VALUES (1, '管理员');
INSERT INTO sys_role (id, name) VALUES (2, '只读角色');
-- 表sys_role_permission
CREATE TABLE `sys_role_permission` (`role_id` bigint NOT NULL, `permission_id` bigint NOT NULL, PRIMARY KEY (`role_id`, `permission_id`));
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 1);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 2);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 3);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 4);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 5);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 6);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 7);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 8);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 9);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 10);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 11);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 12);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 13);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 14);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 15);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 16);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 17);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 18);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, -1);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 4);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 6);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 8);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 1);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 2);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 3);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 5);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, 7);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (2, -1);
-- 表sys_user
CREATE TABLE `sys_user` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `username` varchar(100) NOT NULL, `password` varchar(100) NOT NULL, `nick_name` varchar(50), `avatar` varchar(255), `phone_code` varchar(20), `mobile` varchar(20), `email` varchar(100),`remark` varchar(100), `status` bigint NOT NULL DEFAULT 1, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
INSERT INTO sys_user (id, username, password, nick_name, avatar, phone_code, mobile, email, status,remark) VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 'admin', NULL, NULL, NULL, NULL, 1, NULL);
INSERT INTO sys_user (id, username, password, nick_name, avatar, phone_code, mobile, email, status,remark) VALUES (2, 'readonly', 'e10adc3949ba59abbe56e057f20f883e', '只读用户', NULL, NULL, NULL, NULL, 0, '密码123456');
-- 表sys_user_role
CREATE TABLE `sys_user_role` (`role_id` bigint NOT NULL, `user_id` bigint NOT NULL, PRIMARY KEY (`role_id`, `user_id`));
INSERT INTO sys_user_role (role_id, user_id) VALUES (1, 1);
INSERT INTO sys_user_role (role_id, user_id) VALUES (2, 2);
-- 索引IDX_223de54d6badbe43a5490450c3
CREATE UNIQUE INDEX `IDX_223de54d6badbe43a5490450c3` ON `sys_role` (`name`);
-- 索引IDX_9e7164b2f1ea1348bc0eb0a7da
CREATE UNIQUE INDEX `IDX_9e7164b2f1ea1348bc0eb0a7da` ON `sys_user` (`username`);

View File

@@ -0,0 +1,4 @@
-- for preview 限制演示环境的数据修改
ALTER TABLE sys_user AUTO_INCREMENT = 1000;
ALTER TABLE sys_permission AUTO_INCREMENT = 1000;
ALTER TABLE sys_role AUTO_INCREMENT = 1000;

View File

@@ -0,0 +1,24 @@
--
-- 由SQLiteStudio v3.3.3 产生的文件 周六 7月 3 00:38:02 2021
--
-- 文本编码UTF-8
--
-- 表cd_access
CREATE TABLE `cd_access` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `name` varchar(100) NOT NULL, `type` varchar(100) NOT NULL, `setting` varchar(1024), `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
-- 表cd_cert
CREATE TABLE `cd_cert` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `domains` varchar(2048) NOT NULL, `email` varchar(100) NOT NULL, `cert_issuer_id` bigint, `challenge_type` varchar(100), `challenge_dns_type` varchar(100),`challenge_access_id` bigint, `country` varchar(100), `state` varchar(100), `locality` varchar(100), `organization` varchar(100), `organization_unit` varchar(100), `remark` varchar(100), `last_history_id` bigint, `last_success_id` bigint, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
-- 表cd_cert_apply_history
CREATE TABLE `cd_cert_apply_history` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `cert_id` bigint NOT NULL, `success` boolean, `result` varchar(1024), `cert_crt` varchar(1024), `cert_key` varchar(1024), `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
-- 表cd_cert_issuer
CREATE TABLE `cd_cert_issuer` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `type` varchar(20) NOT NULL, `account` varchar(100) NOT NULL, `private_key` varchar(1024), `setting` varchar(1024), `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
-- 表cd_task
CREATE TABLE `cd_task` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `name` varchar(100), `type` varchar(100), `setting` varchar(2048), `cert_id` bigint NOT NULL, `last_history_id` bigint, `last_success_id` bigint, `remark` varchar(100), `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
-- 表cd_task_history
CREATE TABLE `cd_task_history` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `task_id` bigint NOT NULL, `cert_id` bigint NOT NULL, `cert_apply_history_id` bigint NOT NULL, `success` boolean, `result` varchar(2048), `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);

View File

@@ -0,0 +1,7 @@
CREATE TABLE `pi_history` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `pipeline_id` bigint NOT NULL, `pipeline` TEXT, `status` varchar(20), `end_time` timestamp, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
CREATE TABLE `pi_history_log` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `pipeline_id` bigint NOT NULL, `history_id` bigint NOT NULL, `node_id` varchar(100), `logs` TEXT, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
CREATE TABLE `pi_pipeline` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `title` varchar(200) NOT NULL, `content` TEXT NOT NULL, `keep_history_count` bigint, `remark` varchar(100), `status` varchar(100), `disabled` boolean DEFAULT 0, `last_history_time` bigint, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);
CREATE TABLE `pi_storage` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `scope` varchar(100) NOT NULL, `namespace` varchar(100) NOT NULL, `version` varchar(100),`key` varchar(100), `value` TEXT, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);

View File

@@ -0,0 +1,9 @@
CREATE TABLE `sys_settings` (
`id` bigint NOT NULL PRIMARY KEY AUTO_INCREMENT,
`user_id` bigint NOT NULL,
`key` varchar(100) NOT NULL,
`title` varchar(100) NOT NULL,
`setting` varchar(1024),
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);

View File

@@ -0,0 +1 @@
INSERT INTO sys_role (id, name) VALUES (3, '普通用户');

View File

@@ -0,0 +1,22 @@
ALTER TABLE `sys_settings` RENAME TO `user_settings`;
CREATE TABLE `sys_settings` (
`id` bigint NOT NULL PRIMARY KEY AUTO_INCREMENT,
`key` varchar(100) NOT NULL,
`title` varchar(100) NOT NULL,
`setting` varchar(1024),
`access` varchar(100) NOT NULL,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
SET @parent_id = (SELECT id FROM sys_permission WHERE permission = 'sys');
INSERT INTO sys_permission (title, permission, parent_id, sort) VALUES ('系统设置', 'sys:settings', @parent_id, 1);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, LAST_INSERT_ID());
SET @parent_id = (SELECT id FROM sys_permission WHERE permission = 'sys:settings');
INSERT INTO sys_permission (title, permission, parent_id, sort) VALUES ('查看', 'sys:settings:view',@parent_id, 1);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, LAST_INSERT_ID());
INSERT INTO sys_permission (title, permission, parent_id, sort) VALUES ('编辑', 'sys:settings:edit', @parent_id, 1);
INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, LAST_INSERT_ID());

View File

@@ -0,0 +1,10 @@
INSERT INTO sys_settings (`key`, title, setting, access)
VALUES (
'sys.install',
'安装信息',
CONCAT('{"installTime":', (SELECT timestamp FROM flyway_history WHERE id = 1), '}'),
'private'
);
ALTER TABLE sys_user ADD COLUMN password_version bigint DEFAULT 1;
ALTER TABLE sys_user ADD COLUMN password_salt varchar(36);

View File

@@ -0,0 +1,3 @@
alter table pi_pipeline add COLUMN `order` bigint default 0;

View File

@@ -0,0 +1,2 @@
alter table cd_access add COLUMN `encrypt_setting` text;

View File

@@ -0,0 +1,27 @@
CREATE TABLE `cd_cname_provider`
(
`id` bigint NOT NULL PRIMARY KEY AUTO_INCREMENT,
`domain` varchar(100) NOT NULL,
`dns_provider_type` varchar(100) NOT NULL,
`access_id` bigint NOT NULL,
`is_default` boolean NOT NULL,
`remark` varchar(200),
`disabled` boolean NOT NULL,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE `cd_cname_record`
(
`id` bigint NOT NULL PRIMARY KEY AUTO_INCREMENT,
`user_id` bigint NOT NULL,
`domain` varchar(100) NOT NULL,
`host_record` varchar(100) NOT NULL,
`record_value` varchar(200) NOT NULL,
`cname_provider_id` bigint NOT NULL,
`status` varchar(100) NOT NULL,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);

View File

@@ -0,0 +1,18 @@
CREATE TABLE `pi_plugin`
(
`id` bigint NOT NULL PRIMARY KEY AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`icon` varchar(100),
`title` varchar(200),
`desc` varchar(500),
`group` varchar(100),
`version` varchar(100),
`setting` text,
`sys_setting` text,
`content` text,
`type` varchar(100) NOT NULL,
`disabled` boolean NOT NULL,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);

View File

@@ -0,0 +1,4 @@
ALTER TABLE cd_cname_provider ADD COLUMN user_id bigint;
update cd_cname_provider set user_id = 1;

View File

@@ -0,0 +1,3 @@
update sys_user set status = 0 where id = 2;

View File

@@ -0,0 +1,2 @@
CREATE TABLE `pi_notification` (`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL, `user_id` bigint NOT NULL, `name` varchar(100) NOT NULL, `type` varchar(100) NOT NULL, `setting` text, `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP);

View File

@@ -0,0 +1 @@
ALTER TABLE pi_notification ADD COLUMN is_default boolean DEFAULT 0;

View File

@@ -0,0 +1,13 @@
CREATE TABLE `pi_pipeline_group`
(
`id` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL,
`user_id` bigint NOT NULL,
`name` varchar(100) NOT NULL,
`icon` varchar(100),
`favorite` boolean NOT NULL DEFAULT false,
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);
ALTER TABLE pi_pipeline
ADD COLUMN group_id bigint;

View File

@@ -0,0 +1,30 @@
CREATE INDEX `index_access_user_id` ON `cd_access` (`user_id`);
CREATE INDEX `index_cname_record_user_id` ON `cd_cname_record` (`user_id`);
CREATE INDEX `index_history_user_id` ON `pi_history` (`user_id`);
CREATE INDEX `index_history_log_user_id` ON `pi_history_log` (`user_id`);
CREATE INDEX `index_history_log_pipeline_id` ON `pi_history_log` (`pipeline_id`);
CREATE INDEX `index_notification_user_id` ON `pi_notification` (`user_id`);
CREATE INDEX `index_pipeline_user_id` ON `pi_pipeline` (`user_id`);
CREATE INDEX `index_pipeline_group_user_id` ON `pi_pipeline_group` (`user_id`);
CREATE INDEX `index_storage_default_get` ON `pi_storage` (`scope`(50), `namespace`(50), `key`(50));
CREATE INDEX `index_storage_user_id` ON `pi_storage` (`user_id`);
CREATE INDEX `index_user_email` ON `sys_user` (`email`);
CREATE INDEX `index_user_mobile` ON `sys_user` (`mobile`);
CREATE INDEX `index_permission` ON `sys_permission` (`permission`);
CREATE INDEX `index_user_settings_user_id` ON `user_settings` (`user_id`);

View File

@@ -0,0 +1,31 @@
CREATE INDEX "index_access_user_id" ON "cd_access" ("user_id");
CREATE INDEX "index_cname_record_user_id" ON "cd_cname_record" ("user_id");
CREATE INDEX "index_history_user_id" ON "pi_history" ("user_id");
CREATE INDEX "index_history_log_user_id" ON "pi_history_log" ("user_id");
CREATE INDEX "index_history_log_pipeline_id" ON "pi_history_log" ("pipeline_id");
CREATE INDEX "index_notification_user_id" ON "pi_notification" ("user_id");
CREATE INDEX "index_pipeline_user_id" ON "pi_pipeline" ("user_id");
CREATE INDEX "index_pipeline_group_user_id" ON "pi_pipeline_group" ("user_id");
CREATE INDEX "index_storage_default_get" ON "pi_storage" ("scope", "namespace", "key");
CREATE INDEX "index_storage_user_id" ON "pi_storage" ("user_id");
CREATE INDEX "index_user_email" ON "sys_user" ("email");
CREATE INDEX "index_user_mobile" ON "sys_user" ("mobile");
CREATE INDEX "index_permission" ON "sys_permission" ("permission");
CREATE INDEX "index_user_settings_user_id" ON "user_settings" ("user_id");

View File

@@ -0,0 +1,31 @@
CREATE INDEX "index_access_user_id" ON "cd_access" ("user_id");
CREATE INDEX "index_cname_record_user_id" ON "cd_cname_record" ("user_id");
CREATE INDEX "index_history_user_id" ON "pi_history" ("user_id");
CREATE INDEX "index_history_log_user_id" ON "pi_history_log" ("user_id");
CREATE INDEX "index_history_log_pipeline_id" ON "pi_history_log" ("pipeline_id");
CREATE INDEX "index_notification_user_id" ON "pi_notification" ("user_id");
CREATE INDEX "index_pipeline_user_id" ON "pi_pipeline" ("user_id");
CREATE INDEX "index_pipeline_group_user_id" ON "pi_pipeline_group" ("user_id");
CREATE INDEX "index_storage_default_get" ON "pi_storage" ("scope", "namespace", "key");
CREATE INDEX "index_storage_user_id" ON "pi_storage" ("user_id");
CREATE INDEX "index_user_email" ON "sys_user" ("email");
CREATE INDEX "index_user_mobile" ON "sys_user" ("mobile");
CREATE INDEX "index_permission" ON "sys_permission" ("permission");
CREATE INDEX "index_user_settings_user_id" ON "user_settings" ("user_id");

View File

@@ -25,21 +25,21 @@ import fs from 'fs';
* sqlite: integer
* postgresql: bigint
*/
function transform() {
function transformPG() {
// 读取文件列表
const sqliteFiles = fs.readdirSync('./migration/');
const pgFiles = fs.readdirSync('./migration-pg');
const pgFiles = fs.readdirSync('./migration-pg/');
//找出pg里面没有的文件
const notFiles = sqliteFiles.filter(file => !pgFiles.includes(file));
for (const notFile of notFiles) {
//开始转换
const sqliteSql = fs.readFileSync(`./migration/${notFile}`, 'utf-8');
let pgSql = sqliteSql.replace(/AUTOINCREMENT/g, 'GENERATED BY DEFAULT AS IDENTITY');
pgSql = pgSql.replace(/datetime/g, 'timestamp');
pgSql = pgSql.replace(/boolean DEFAULT \(0\)/g, 'boolean DEFAULT (false)');
pgSql = pgSql.replace(/boolean.*NOT NULL DEFAULT \(0\)/g, 'boolean NOT NULL DEFAULT (false)');
pgSql = pgSql.replace(/integer/g, 'bigint');
pgSql = pgSql.replace(/last_insert_rowid\(\)/g, 'LASTVAL()');
let pgSql = sqliteSql.replaceAll(/AUTOINCREMENT/g, 'GENERATED BY DEFAULT AS IDENTITY');
pgSql = pgSql.replaceAll(/datetime/g, 'timestamp');
pgSql = pgSql.replaceAll(/boolean DEFAULT \(0\)/g, 'boolean DEFAULT (false)');
pgSql = pgSql.replaceAll(/boolean.*NOT NULL DEFAULT \(0\)/g, 'boolean NOT NULL DEFAULT (false)');
pgSql = pgSql.replaceAll(/integer/g, 'bigint');
pgSql = pgSql.replaceAll(/last_insert_rowid\(\)/g, 'LASTVAL()');
fs.writeFileSync(`./migration-pg/${notFile}`, pgSql);
}
@@ -51,4 +51,37 @@ function transform() {
console.log('sql无需更新');
}
}
transform();
function transformMysql() {
// 读取文件列表
const sqliteFiles = fs.readdirSync('./migration/');
const pgFiles = fs.readdirSync('./migration-mysql/');
//找出pg里面没有的文件
const notFiles = sqliteFiles.filter(file => !pgFiles.includes(file));
for (const notFile of notFiles) {
//开始转换
const sqliteSql = fs.readFileSync(`./migration/${notFile}`, 'utf-8');
let pgSql = sqliteSql.replaceAll(/AUTOINCREMENT/g, 'AUTO_INCREMENT');
pgSql = pgSql.replaceAll(/datetime/g, 'timestamp');
//DEFAULT (xxx) 替换成 DEFAULT xxx
pgSql = pgSql.replaceAll(/DEFAULT \(([^)]*)\)/g, 'DEFAULT $1');
pgSql = pgSql.replaceAll(/integer/g, 'bigint');
pgSql = pgSql.replaceAll(/last_insert_rowid\(\)/g, 'LAST_INSERT_ID()');
//双引号 替换成反引号
pgSql = pgSql.replaceAll(/"/g, '`');
fs.writeFileSync(`./migration-mysql/${notFile}`, pgSql);
}
if (notFiles.length > 0) {
console.log('sqlite->mysql 转换完成');
throw new Error('sqlite->mysql 转换完成有更新需要测试mysql');
} else {
console.log('sql无需更新');
}
}
transformPG();
transformMysql();

View File

@@ -1 +0,0 @@
CREATE INDEX "index_user_id" ON "pi_pipeline" ("user_id");

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/ui-server",
"version": "1.28.1",
"version": "1.28.2",
"description": "fast-server base midway",
"private": true,
"type": "module",
@@ -10,6 +10,7 @@
"commdev": "cross-env NODE_ENV=commdev mwtsc --watch --run @midwayjs/mock/app",
"commpro": "cross-env NODE_ENV=commpro mwtsc --watch --run @midwayjs/mock/app",
"pgdev": "cross-env NODE_ENV=pgdev mwtsc --watch --run @midwayjs/mock/app",
"mysqldev": "cross-env NODE_ENV=mysqldev mwtsc --watch --run @midwayjs/mock/app",
"local-plus": "cross-env NODE_ENV=localplus mwtsc --watch --run @midwayjs/mock/app",
"pgpl": "cross-env NODE_ENV=pgpl mwtsc --watch --run @midwayjs/mock/app",
"dev-new": "cross-env NODE_ENV=devnew mwtsc --watch --run @midwayjs/mock/app",
@@ -23,24 +24,25 @@
"dev-build": "echo 1",
"build-on-docker": "node ./before-build.js && npm run build",
"up-mw-deps": "npx midway-version -u -w",
"heap": "cross-env NODE_ENV=pgpl clinic heapprofiler -- node ./bootstrap.js",
"heap": "cross-env NODE_ENV=local clinic heapprofiler -- node ./bootstrap.js",
"flame": "clinic flame -- node ./bootstrap.js",
"tsc": "tsc --skipLibCheck"
"tsc": "tsc --skipLibCheck",
"slimming": "node ./slimming.js"
},
"dependencies": {
"@alicloud/pop-core": "^1.7.10",
"@certd/acme-client": "^1.28.1",
"@certd/basic": "^1.28.1",
"@certd/commercial-core": "^1.28.1",
"@certd/lib-huawei": "^1.28.1",
"@certd/lib-k8s": "^1.28.1",
"@certd/lib-server": "^1.28.1",
"@certd/midway-flyway-js": "^1.28.1",
"@certd/pipeline": "^1.28.1",
"@certd/plugin-cert": "^1.28.1",
"@certd/plugin-lib": "^1.28.1",
"@certd/plugin-plus": "^1.28.1",
"@certd/plus-core": "^1.28.1",
"@certd/acme-client": "^1.28.2",
"@certd/basic": "^1.28.2",
"@certd/commercial-core": "^1.28.2",
"@certd/lib-huawei": "^1.28.2",
"@certd/lib-k8s": "^1.28.2",
"@certd/lib-server": "^1.28.2",
"@certd/midway-flyway-js": "^1.28.2",
"@certd/pipeline": "^1.28.2",
"@certd/plugin-cert": "^1.28.2",
"@certd/plugin-lib": "^1.28.2",
"@certd/plugin-plus": "^1.28.2",
"@certd/plus-core": "^1.28.2",
"@huaweicloud/huaweicloud-sdk-cdn": "^3.1.120",
"@huaweicloud/huaweicloud-sdk-core": "^3.1.120",
"@koa/cors": "^5.0.0",
@@ -79,6 +81,7 @@
"lru-cache": "^11.0.1",
"mwts": "^1.3.0",
"mwtsc": "^1.4.0",
"mysql": "^2.18.1",
"nanoid": "^5.0.7",
"node-forge": "^1.3.1",
"nodemailer": "^6.9.3",

View File

@@ -71,7 +71,8 @@ const development = {
type: 'better-sqlite3',
database: './data/db.sqlite',
synchronize: false, // 如果第一次使用,不存在表,有同步的需求可以写 true
logging: true,
logging: false,
highlightSql: false,
// 配置实体模型 或者 entities: '/entity',
entities: ['**/modules/**/entity/*.js', ...libServerEntities, ...commercialEntities, PipelineEntity, FlywayHistory, UserEntity],

View File

@@ -20,7 +20,8 @@ export class CnameProviderController extends BaseController {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
const res = await this.providerService.list({});
return this.ok(res);
}

View File

@@ -39,7 +39,8 @@ export class CnameRecordController extends CrudController<CnameRecordService> {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
const list = await this.getService().list(body);
return this.ok(list);
}

View File

@@ -25,7 +25,8 @@ export class UserSettingsController extends CrudController<UserSettingsService>
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.list(body);
}

View File

@@ -37,7 +37,8 @@ export class AccessController extends CrudController<AccessService> {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.list(body);
}

View File

@@ -38,7 +38,8 @@ export class NotificationController extends CrudController<NotificationService>
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.list(body);
}

View File

@@ -36,7 +36,8 @@ export class PipelineGroupController extends CrudController<PipelineGroupService
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return await super.list(body);
}
@@ -67,7 +68,9 @@ export class PipelineGroupController extends CrudController<PipelineGroupService
@Post('/all', { summary: Constants.per.authOnly })
async all() {
const list: any = await this.service.find({
userId: this.getUserId(),
where: {
userId: this.getUserId(),
},
});
return this.ok(list);
}

View File

@@ -29,20 +29,16 @@ export class SysSettingsController extends CrudController<SysSettingsService> {
@Post('/page', { summary: 'sys:settings:view' })
async page(@Body(ALL) body) {
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.page(body);
}
@Post('/list', { summary: 'sys:settings:view' })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
return super.list(body);
}
@Post('/add', { summary: 'sys:settings:edit' })
async add(@Body(ALL) bean) {
bean.userId = this.getUserId();
return super.add(bean);
}

View File

@@ -2,6 +2,7 @@ import { SqliteAdapter } from './sqlite.js';
import { PostgresqlAdapter } from './postgresql.js';
import { Config, Init, Provide, Scope, ScopeEnum } from '@midwayjs/core';
import { SqlAdapter } from './d.js';
import { MysqlAdapter } from './mysql.js';
@Provide()
@Scope(ScopeEnum.Singleton)
@@ -16,8 +17,10 @@ export class DbAdapter implements SqlAdapter {
this.adapter = new SqliteAdapter();
} else if (this.isPostgresql()) {
this.adapter = new PostgresqlAdapter();
} else if (this.isMysql()) {
this.adapter = new MysqlAdapter();
} else {
throw new Error(`dbType ${this.dbType} not support`);
throw new Error(`dbType ${this.dbType} not support 请实现Adapter`);
}
}
@@ -27,6 +30,9 @@ export class DbAdapter implements SqlAdapter {
isPostgresql() {
return this.dbType === 'postgres';
}
isMysql() {
return this.dbType === 'mysql' || this.dbType === 'mariadb';
}
date(columnName: string) {
return this.adapter.date(columnName);

View File

@@ -0,0 +1,7 @@
import { SqlAdapter } from './d.js';
export class MysqlAdapter implements SqlAdapter {
date(columnName: string) {
return `DATE_FORMAT(${columnName}, '%Y-%m-%d')`;
}
}

View File

@@ -35,7 +35,7 @@ export class UserEntity {
@Column({ comment: '备注', length: 100, nullable: true })
remark: string;
@Column({ comment: '状态 0:禁用 1启用', default: 1, type: 'int' })
@Column({ comment: '状态 0:禁用 1启用', default: 1 })
status: number;
@Column({
name: 'create_time',

View File

@@ -1,3 +1,2 @@
export * from './dns-provider.js';
export * from './plugins/index.js';
export * from './access.js';

View File

@@ -1 +0,0 @@
export * from './plugin-deploy-to-cdn.js';

View File

@@ -1,92 +0,0 @@
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
import { CertInfo, CertReader } from '@certd/plugin-cert';
@IsTaskPlugin({
name: 'CloudflareDeployToCDN',
title: '部署证书到CF CDN',
icon: 'simple-icons:cloudflare',
group: pluginGroups.other.key,
desc: '暂未实现,不可用',
default: {
strategy: {
runStrategy: RunStrategy.SkipWhenSucceed,
},
},
})
export class CloudflareDeployToCDNPlugin extends AbstractTaskPlugin {
//测试参数
@TaskInput({
title: '属性示例',
component: {
//前端组件配置,具体配置见组件文档 https://www.antdv.com/components/input-cn
name: 'a-input',
},
})
text!: string;
//测试参数
@TaskInput({
title: '选择框',
component: {
//前端组件配置,具体配置见组件文档 https://www.antdv.com/components/select-cn
name: 'a-auto-complete',
vModel: 'value',
options: [
{ value: '1', label: '选项1' },
{ value: '2', label: '选项2' },
],
},
})
select!: string;
//测试参数
@TaskInput({
title: 'switch',
component: {
//前端组件配置,具体配置见组件文档 https://www.antdv.com/components/switch-cn
name: 'a-switch',
vModel: 'checked',
},
})
switch!: boolean;
//证书选择,此项必须要有
@TaskInput({
title: '域名证书',
helper: '请选择前置任务输出的域名证书',
component: {
name: 'output-selector',
from: ['CertApply', 'CertApplyLego'],
},
required: true,
})
cert!: CertInfo;
//授权选择框
@TaskInput({
title: 'demo授权',
helper: 'demoAccess授权',
component: {
name: 'access-selector',
type: 'plugins',
},
rules: [{ required: true, message: '此项必填' }],
})
accessId!: string;
async onInstance() {}
async execute(): Promise<void> {
const { select, text, cert, accessId } = this;
const certReader = new CertReader(cert);
const access = await this.accessService.getById(accessId);
this.logger.debug('access', access);
this.logger.debug('certReader', certReader);
this.logger.info('DemoTestPlugin execute');
this.logger.info('text:', text);
this.logger.info('select:', select);
this.logger.info('switch:', this.switch);
this.logger.info('授权id:', accessId);
//TODO 这里实现你要部署的执行方法
}
}
//TODO 这里实例化插件,进行注册
new CloudflareDeployToCDNPlugin();