Compare commits

..
47 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 a6cd532035 v1.28.1 2024-12-09 01:53:42 +08:00
xiaojunnuo b1db952fcb build: prepare to build 2024-12-09 01:50:40 +08:00
xiaojunnuo 51e8bab352 build: prepare to build 2024-12-09 01:49:03 +08:00
xiaojunnuo 618ec93786 perf: 支持邀请奖励 2024-12-09 01:40:55 +08:00
xiaojunnuo a673f9c8ca chore: 2024-12-09 01:39:11 +08:00
xiaojunnuo e8c9c2a47d perf: cname value优化 2024-12-09 01:31:16 +08:00
xiaojunnuo aafa5d5f90 chore: 1 2024-12-09 01:25:23 +08:00
xiaojunnuo 8b9c47daf1 perf: favicon支持自定义 2024-12-09 00:12:15 +08:00
xiaojunnuo 4042577c0b chore: 2024-12-08 02:30:25 +08:00
xiaojunnuo 6c9f9940e3 chore: 2024-12-07 16:16:50 +08:00
xiaojunnuo 8f7b3f29ce chore: 2024-12-07 16:13:00 +08:00
xiaojunnuo 6bca7333c9 Merge remote-tracking branch 'origin/v2-dev' into v2-dev 2024-12-07 15:20:08 +08:00
xiaojunnuo 3dfeeec899 fix: 修复cname排查方法 nslookup命令显示黑色的问题 2024-12-07 15:19:28 +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
xiaojunnuo 1b267813c9 Merge remote-tracking branch 'origin/v2-dev' into v2-dev 2024-12-05 11:10:39 +08:00
xiaojunnuo 96b5981f8c chore: 2024-12-05 11:09:14 +08:00
xiaojunnuo a2fd9559c5 chore: 2024-12-04 23:05:12 +08:00
xiaojunnuo 3f06419d47 chore: 2024-12-04 22:27:48 +08:00
xiaojunnuo 2aefca3813 chore: 2024-12-04 12:36:17 +08:00
xiaojunnuo 6aa487269c perf: 新增server酱3通知 2024-12-03 10:32:47 +08:00
xiaojunnuo 393ea27fa4 chore: 2024-12-03 00:55:37 +08:00
xiaojunnuo febe87508c chore: 2024-12-03 00:43:43 +08:00
xiaojunnuo 30db27980c Merge remote-tracking branch 'origin/v2-dev' into v2-dev 2024-12-03 00:35:51 +08:00
xiaojunnuo 4e768ec50f chore: 2024-12-03 00:35:34 +08:00
xiaojunnuo 4467e09426 chore: 2024-12-03 00:07:30 +08:00
xiaojunnuo 66b95d52fd Merge remote-tracking branch 'origin/v2-dev' into v2-dev 2024-12-02 23:21:43 +08:00
xiaojunnuo 1398417829 chore: 2024-12-02 23:17:40 +08:00
xiaojunnuo 58dd5e2750 chore: 2024-12-02 18:15:27 +08:00
xiaojunnuo 70210f567a chore: 2024-12-02 16:43:09 +08:00
xiaojunnuo 49e7dc56e1 perf: 新增七牛云插件分组 2024-12-02 16:35:31 +08:00
xiaojunnuo 72cc586f88 chore: 2024-12-02 15:19:13 +08:00
xiaojunnuo 94fa77fcd2 perf: 支持易发云短信 2024-12-02 15:11:29 +08:00
xiaojunnuo 2c0cbdd29e perf: 通知选择器优化 2024-12-02 14:06:55 +08:00
xiaojunnuo 68a503796c build: publish 2024-12-01 03:25:17 +08:00
xiaojunnuo 48cf28dd7f build: trigger build image 2024-12-01 03:24:59 +08:00
140 changed files with 1715 additions and 503 deletions
+28
View File
@@ -3,6 +3,34 @@
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
* 修复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
+1 -1
View File
@@ -1 +1 @@
15:28
01:55
+14 -2
View File
@@ -23,7 +23,6 @@ services:
# # ↓↓↓↓ --------------------------------------------------------- 如果你服务器部署在国外,可以用这个替换上面阿里云的公共dns
# - 8.8.8.8 # 谷歌公共dns
# - 8.8.4.4
# extra_hosts:
# # ↓↓↓↓ -------------------------------------------------------- 这里可以配置自定义hosts,外网域名可以指向本地局域网ip地址
# - "localdomain.comm:192.168.1.3"
@@ -34,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 # 数据库地址
@@ -43,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
+41
View File
@@ -3,6 +3,47 @@
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
* 修复自定义webhook contextType的bug ([7e5ea0c](https://github.com/certd/certd/commit/7e5ea0cee003acda952d922ca70592f1e8a2ed80))
### Features
* 手机号登录、邮箱验证码注册 ([7b55337](https://github.com/certd/certd/commit/7b55337c5edb470cca7aa62201eda8d274784004))
### Performance Improvements
* 部署到IIS插件 ([1534f45](https://github.com/certd/certd/commit/1534f4523633265d219d7b3a249a9ea1af99c512))
* 登录失败增加重试次数限制及冷却时间 ([954b6df](https://github.com/certd/certd/commit/954b6df3608695fe074130f8149a33e311d80cc4))
* 流水线支持批量修改分组,批量删除 ([a847e66](https://github.com/certd/certd/commit/a847e66c4fc843b98f1520b2b8072d3586ce8b81))
* 取消docker-compose的dns配置 ([87bbf6f](https://github.com/certd/certd/commit/87bbf6f14080b9fa287c250d7fc4d33279c83ff7))
* 首页新增修改密码提示 ([0772d3b](https://github.com/certd/certd/commit/0772d3b3fd24afdde4086d9f09ef19d037b431b4))
* 选项显示图标 ([aedc462](https://github.com/certd/certd/commit/aedc46213571a3bd93809b7af7fa17a08d546237))
* 优化七牛云cdn,获取域名列表可以选择 ([5a20242](https://github.com/certd/certd/commit/5a20242111d6bd255b25dac86fe1f062c8543096))
* 优化七牛云cdn部署,保持http2和forceHttp设置,当未开启https时,主动开启https ([196f7d9](https://github.com/certd/certd/commit/196f7d9dc23d7dd96b663c686542e85270b81aef))
* 优化证书申请成功通知发送方式 ([8002a56](https://github.com/certd/certd/commit/8002a56efc5998aa03db5711ae87f9eb4bc9e160))
* 支持短信验证码登录 ([387bcc5](https://github.com/certd/certd/commit/387bcc5fa418cdeea81a06da5e3f8cd6b43cd082))
* 支持威联通证书部署 ([0d8913e](https://github.com/certd/certd/commit/0d8913ea2f56fdebbcc9bb207eae59e8ddbb8cad))
* 自定义webhook显示详细的错误信息 ([3254afc](https://github.com/certd/certd/commit/3254afc75640eed3729d0fc02a818fefbe5c7fc3))
## [1.27.9](https://github.com/certd/certd/compare/v1.27.8...v1.27.9) (2024-11-26)
### Performance Improvements
-3
View File
@@ -14,9 +14,6 @@ git clone https://github.com/certd/certd --depth=1
#进入项目目录
cd certd
# 切换到最新版本代码【如果v2分支无法编译,请尝试切换到最新版tag】
# git checkout v1.27.0 # 这里换成最新版本号
```
### 修改pnpm-workspace.yaml文件
+2 -2
View File
@@ -30,5 +30,5 @@ Certd 是一款开源、免费、全自动申请和部署更新SSL证书的工
## 三、证书颁发机构对比
* Let's Encrypt:申请最简单。
* Google: 大厂光环,兼容性好,需要翻墙获取EAB。
* ZeroSSL: 有数量限制,获取EAB无需翻墙。
* Google: 大厂光环,兼容性好,首次需要翻墙获取EAB。
* ZeroSSL: 需要EAB,获取EAB无需翻墙。
+1 -1
View File
@@ -41,7 +41,7 @@ docker compose up -d
> 如果提示 没有docker compose命令,请安装docker-compose
> https://docs.docker.com/compose/install/linux/
> 然后使用 `docker-compose up -d` 启动
### 3. 访问测试
+1 -1
View File
@@ -9,5 +9,5 @@
}
},
"npmClient": "pnpm",
"version": "1.28.0"
"version": "1.28.2"
}
+10
View File
@@ -3,6 +3,16 @@
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
# [1.28.0](https://github.com/publishlab/node-acme-client/compare/v1.27.9...v1.28.0) (2024-11-30)
**Note:** Version bump only for package @certd/acme-client
+3 -3
View File
@@ -3,7 +3,7 @@
"description": "Simple and unopinionated ACME client",
"private": false,
"author": "nmorsman",
"version": "1.28.0",
"version": "1.28.2",
"type": "module",
"module": "scr/index.js",
"main": "src/index.js",
@@ -18,7 +18,7 @@
"types"
],
"dependencies": {
"@certd/basic": "^1.28.0",
"@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": "cf1936309241d3cf05c2fba767f530bbb3b62b15"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}
@@ -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*/];
}
});
}); })();
+10
View File
@@ -3,6 +3,16 @@
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
* 通知选择器优化 ([2c0cbdd](https://github.com/certd/certd/commit/2c0cbdd29ecb74cc939b2ae7ee86b8d40f70ba31))
# [1.28.0](https://github.com/certd/certd/compare/v1.27.9...v1.28.0) (2024-11-30)
### Performance Improvements
+1 -1
View File
@@ -1 +1 @@
03:20
22:42
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@certd/basic",
"private": false,
"version": "1.28.0",
"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": "cf1936309241d3cf05c2fba767f530bbb3b62b15"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}
+19 -3
View File
@@ -98,10 +98,22 @@ export function createAxiosService({ logger }: { logger: Logger }) {
config.timeout = 15000;
}
let agents = defaultAgents;
if (config.skipSslVerify) {
logger.info('跳过SSL验证');
agents = createAgent({ rejectUnauthorized: false } as any);
if (config.skipSslVerify || config.httpProxy) {
let rejectUnauthorized = true;
if (config.skipSslVerify) {
logger.info('跳过SSL验证');
rejectUnauthorized = false;
}
const proxy: any = {};
if (config.httpProxy) {
logger.info('使用自定义http代理:', config.httpProxy);
proxy.httpProxy = config.httpProxy;
proxy.httpsProxy = config.httpProxy;
}
agents = createAgent({ rejectUnauthorized, ...proxy } as any);
}
delete config.skipSslVerify;
config.httpsAgent = agents.httpsAgent;
config.httpAgent = agents.httpAgent;
@@ -132,6 +144,9 @@ export function createAxiosService({ logger }: { logger: Logger }) {
} else {
logger.info('http response status:', response?.status);
}
if (response?.config?.returnResponse) {
return response;
}
return response.data;
},
(error: any) => {
@@ -200,6 +215,7 @@ export type HttpRequestConfig<D = any> = {
skipCheckRes?: boolean;
logParams?: boolean;
logRes?: boolean;
httpProxy?: string;
} & AxiosRequestConfig<D>;
export type HttpClient = {
request<D = any, R = any>(config: HttpRequestConfig<D>): Promise<HttpClientResponse<R>>;
+11
View File
@@ -3,6 +3,17 @@
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
* 通知选择器优化 ([2c0cbdd](https://github.com/certd/certd/commit/2c0cbdd29ecb74cc939b2ae7ee86b8d40f70ba31))
* 新增七牛云插件分组 ([49e7dc5](https://github.com/certd/certd/commit/49e7dc56e1a95fbdea3e30cdeb945b48415b69e3))
# [1.28.0](https://github.com/certd/certd/compare/v1.27.9...v1.28.0) (2024-11-30)
### Features
+4 -4
View File
@@ -1,7 +1,7 @@
{
"name": "@certd/pipeline",
"private": false,
"version": "1.28.0",
"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.0",
"@certd/plus-core": "^1.28.0",
"@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": "cf1936309241d3cf05c2fba767f530bbb3b62b15"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}
+21 -5
View File
@@ -11,6 +11,10 @@ import { ICnameProxyService, IEmailService, IPluginConfigService, IUrlService }
import { FileStore } from "./file-store.js";
import { cloneDeep, forEach, merge } from "lodash-es";
import { INotificationService, NotificationBody, NotificationContext, notificationRegistry } from "../notification/index.js";
export type SysInfo = {
//系统标题
title?: string;
};
export type ExecutorOptions = {
pipeline: Pipeline;
@@ -25,6 +29,7 @@ export type ExecutorOptions = {
fileRootDir?: string;
user: UserInfo;
baseURL?: string;
sysInfo?: SysInfo;
};
export class Executor {
@@ -368,17 +373,18 @@ export class Executor {
let subject = "";
let content = "";
const errorMessage = error?.message;
const sysTitle = this.options.sysInfo?.title || "Certd";
if (when === "start") {
subject = `【Certd】开始执行,${this.pipeline.title}【${this.pipeline.id}】`;
subject = `【${sysTitle}】开始执行,${this.pipeline.title}【${this.pipeline.id}】`;
content = `流水线ID:${this.pipeline.id},运行ID:${this.runtime.id}`;
} else if (when === "success") {
subject = `【Certd】执行成功,${this.pipeline.title}【${this.pipeline.id}】`;
subject = `【${sysTitle}】执行成功,${this.pipeline.title}【${this.pipeline.id}】`;
content = `流水线ID:${this.pipeline.id},运行ID:${this.runtime.id}`;
} else if (when === "turnToSuccess") {
subject = `【Certd】执行成功(失败转成功),${this.pipeline.title}【${this.pipeline.id}】`;
subject = `【${sysTitle}】执行成功(失败转成功),${this.pipeline.title}【${this.pipeline.id}】`;
content = `流水线ID:${this.pipeline.id},运行ID:${this.runtime.id}`;
} else if (when === "error") {
subject = `【Certd】执行失败,${this.pipeline.title}【${this.pipeline.id}】`;
subject = `【${sysTitle}】执行失败,${this.pipeline.title}【${this.pipeline.id}】`;
content = `流水线ID:${this.pipeline.id},运行ID:${this.runtime.id}\n错误详情:${error.message}`;
} else {
return;
@@ -388,6 +394,7 @@ export class Executor {
if (!notification.when.includes(when)) {
continue;
}
if (notification.type === "email") {
try {
await this.options.emailService?.send({
@@ -401,7 +408,16 @@ export class Executor {
} else {
try {
//构建notification插件,发送通知
const notifyConfig = await this.options.notificationService.getById(notification.notificationId);
let notifyConfig: any;
if (notification.notificationId === 0) {
notifyConfig = await this.options.notificationService.getDefault();
} else {
notifyConfig = await this.options.notificationService.getById(notification.notificationId);
}
if (notifyConfig == null) {
throw new Error(`通知配置<id:${notification.notificationId}>不存在`);
}
const notificationPlugin = notificationRegistry.get(notifyConfig.type);
const notificationCls: any = notificationPlugin.target;
const notificationSender = new notificationCls();
+5 -4
View File
@@ -20,8 +20,9 @@ export const pluginGroups = {
aliyun: new PluginGroup("aliyun", "阿里云", 2),
huawei: new PluginGroup("huawei", "华为云", 3),
tencent: new PluginGroup("tencent", "腾讯云", 4),
host: new PluginGroup("host", "主机", 5),
cdn: new PluginGroup("cdn", "CDN", 6),
panel: new PluginGroup("panel", "面板", 7),
other: new PluginGroup("other", "其他", 8),
qiniu: new PluginGroup("qiniu", "七牛云", 5),
host: new PluginGroup("host", "主机", 6),
cdn: new PluginGroup("cdn", "CDN", 7),
panel: new PluginGroup("panel", "面板", 8),
other: new PluginGroup("other", "其他", 9),
};
+8
View File
@@ -3,6 +3,14 @@
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
# [1.28.0](https://github.com/certd/certd/compare/v1.27.9...v1.28.0) (2024-11-30)
**Note:** Version bump only for package @certd/lib-huawei
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@certd/lib-huawei",
"private": false,
"version": "1.28.0",
"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": "cf1936309241d3cf05c2fba767f530bbb3b62b15"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}
+8
View File
@@ -3,6 +3,14 @@
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
# [1.28.0](https://github.com/certd/certd/compare/v1.27.9...v1.28.0) (2024-11-30)
**Note:** Version bump only for package @certd/lib-iframe
+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@certd/lib-iframe",
"private": false,
"version": "1.28.0",
"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": "cf1936309241d3cf05c2fba767f530bbb3b62b15"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}
+8
View File
@@ -3,6 +3,14 @@
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
# [1.28.0](https://github.com/certd/certd/compare/v1.27.9...v1.28.0) (2024-11-30)
**Note:** Version bump only for package @certd/lib-k8s
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "@certd/lib-k8s",
"private": false,
"version": "1.28.0",
"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.0",
"@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": "cf1936309241d3cf05c2fba767f530bbb3b62b15"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}
+10
View File
@@ -3,6 +3,16 @@
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
* 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)
### Performance Improvements
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@certd/lib-server",
"version": "1.28.0",
"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.0",
"@certd/basic": "^1.28.0",
"@certd/pipeline": "^1.28.0",
"@certd/plus-core": "^1.28.0",
"@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": "cf1936309241d3cf05c2fba767f530bbb3b62b15"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}
@@ -38,9 +38,9 @@ export class PlusService {
return installInfo.siteId;
}
async active(code: string) {
async active(code: string, inviteCode?: string) {
const plusRequestService = await this.getPlusRequestService();
return await plusRequestService.active(code);
return await plusRequestService.active(code, inviteCode);
}
async updateLicense(license: string) {
@@ -3,6 +3,14 @@
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
# [1.28.0](https://github.com/certd/certd/compare/v1.27.9...v1.28.0) (2024-11-30)
**Note:** Version bump only for package @certd/midway-flyway-js
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@certd/midway-flyway-js",
"version": "1.28.0",
"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": "cf1936309241d3cf05c2fba767f530bbb3b62b15"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}
@@ -3,6 +3,14 @@
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
# [1.28.0](https://github.com/certd/certd/compare/v1.27.9...v1.28.0) (2024-11-30)
### Features
+5 -5
View File
@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-cert",
"private": false,
"version": "1.28.0",
"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.0",
"@certd/basic": "^1.28.0",
"@certd/pipeline": "^1.28.0",
"@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": "cf1936309241d3cf05c2fba767f530bbb3b62b15"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}
@@ -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;
+8
View File
@@ -3,6 +3,14 @@
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
# [1.28.0](https://github.com/certd/certd/compare/v1.27.9...v1.28.0) (2024-11-30)
### Features
+5 -5
View File
@@ -1,7 +1,7 @@
{
"name": "@certd/plugin-lib",
"private": false,
"version": "1.28.0",
"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.0",
"@certd/pipeline": "^1.28.0",
"@certd/plugin-cert": "^1.28.0",
"@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": "cf1936309241d3cf05c2fba767f530bbb3b62b15"
"gitHead": "a6cd532035f55a7ce122ea1229bb65f9d41e7125"
}
+1
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
+21
View File
@@ -3,6 +3,27 @@
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
* 修复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))
* 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)
### Features
+1 -1
View File
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8"/>
<link rel="icon" href="/static/images/logo/logo.svg"/>
<link rel="icon" href="/api/app/favicon"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Loading</title>
<script src="/static/icons/iconfont.js"></script>
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@certd/ui-client",
"version": "1.28.0",
"version": "1.28.2",
"private": true,
"scripts": {
"dev": "vite --open",
@@ -26,10 +26,10 @@
"dependencies": {
"@ant-design/colors": "^7.0.2",
"@ant-design/icons-vue": "^6.1.0",
"@fast-crud/fast-crud": "^1.23.1",
"@fast-crud/fast-extends": "^1.23.1",
"@fast-crud/ui-antdv4": "^1.23.1",
"@fast-crud/ui-interface": "^1.23.1",
"@fast-crud/fast-crud": "^1.23.4",
"@fast-crud/fast-extends": "^1.23.4",
"@fast-crud/ui-antdv4": "^1.23.4",
"@fast-crud/ui-interface": "^1.23.4",
"@iconify/vue": "^4.1.1",
"@soerenmartius/vue3-clipboard": "^0.1.2",
"@vue-js-cron/light": "^4.0.5",
@@ -65,8 +65,8 @@
"vuedraggable": "^4.1.0"
},
"devDependencies": {
"@certd/lib-iframe": "^1.28.0",
"@certd/pipeline": "^1.28.0",
"@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",
+2 -1
View File
@@ -76,7 +76,7 @@ function createService() {
error.message = "拒绝访问";
break;
case 404:
error.message = `请求地址出错: ${error.response.config.url}`;
error.message = `请求地址出错`;
break;
case 408:
error.message = "请求超时";
@@ -102,6 +102,7 @@ function createService() {
default:
break;
}
error.message += `: ${error.response?.config?.url}`;
errorLog(error, error?.response?.config?.showErrorNotify);
if (status === 401) {
const userStore = useUserStore();
@@ -6,9 +6,8 @@
<div>1. 解析记录应该添加在{{ record.domain }}域名下</div>
<div>2. 要添加的是CNAME类型的记录,不是TXT</div>
<div>3. 核对记录值是否是:{{ record.recordValue }}</div>
<div>
4. 运行命令 <a-tag>nslookup -qa=txt {{ record.hostRecord }}{{ record.domain }}</a-tag> 查看解析配置是否正确
</div>
<div>4. 运行下面的命令,查看解析是否正确 <fs-copyable :style="{ color: '#52c41a' }" :model-value="nslookupCmd"></fs-copyable></div>
<div>5. 如果以上检查都没有问题,则可能是DNS解析生效时间比较慢,某些提供商延迟可能高达几个小时</div>
</div>
</template>
<fs-icon class="ml-5 pointer" icon="mingcute:question-line"></fs-icon>
@@ -16,7 +15,12 @@
</template>
<script lang="ts" setup>
import { computed } from "vue";
const props = defineProps<{
record: any;
}>();
const nslookupCmd = computed(() => {
return `nslookup -qa=txt _acme-challenge.${props.record.domain}`;
});
</script>
@@ -12,7 +12,7 @@ const slots = defineSlots();
<template>
<div class="tutorial-button pointer" @click="open">
<template v-if="!slots.default">
<fs-icon icon="mingcute:question-line"></fs-icon>
<fs-icon icon="ant-design:question-circle-outlined"></fs-icon>
<div class="ml-5">使用教程</div>
</template>
<slot></slot>
@@ -118,7 +118,8 @@ const expiredDays = computed(() => {
});
const formState = reactive({
code: ""
code: "",
inviteCode: ""
});
const router = useRouter();
@@ -268,7 +269,7 @@ function openUpgrade() {
activationCodeGetWay = (
<span>
<a href="https://afdian.com/a/greper" target="_blank">
爱发电赞助“VIP会员”后获取专业版
爱发电赞助“VIP会员(¥29.9)”后获取一年期专业版激活码
</a>
<span> 商业版请直接联系作者</span>
</span>
@@ -327,6 +328,7 @@ function openUpgrade() {
<fs-copyable class="flex-1" v-model={computedSiteId.value}></fs-copyable>
</div>
<a-input class="mt-10" v-model:value={formState.code} placeholder={placeholder} />
<a-input class="mt-10" v-model:value={formState.inviteCode} placeholder={"邀请码【选填】,可额外获得专业版30天/商业版15天时长"} />
</div>
<div class="mt-10">
@@ -77,9 +77,7 @@ export default {
closeAll: pageStore.closeAll,
openedSort: pageStore.openedSort
};
console.log("opened", pageStore.getOpened);
const computeOpened = computed(() => {
console.log("opened", pageStore.getOpened);
return pageStore.getOpened;
});
@@ -23,7 +23,6 @@ defineOptions({
name: "FsUserInfo"
});
const userStore = useUserStore();
console.log("user", userStore);
const { t } = useI18n();
const router = useRouter();
@@ -37,3 +37,7 @@
margin-right: 3px;
}
}
.fs-search .ant-row{
}
@@ -77,6 +77,9 @@ h1, h2, h3, h4, h5, h6 {
.flex-1 {
flex: 1;
}
.flex-0 {
flex: 0;
}
.flex-col {
display: flex;
@@ -1,6 +1,6 @@
import { request } from "/src/api/service";
export function createApi() {
export function createNotificationApi() {
const apiPrefix = "/pi/notification";
return {
async GetList(query: any) {
@@ -43,6 +43,13 @@ export function createApi() {
});
},
async GetOptions(id: number) {
return await request({
url: apiPrefix + "/options",
method: "post"
});
},
async SetDefault(id: number) {
return await request({
url: apiPrefix + "/setDefault",
@@ -66,6 +73,13 @@ export function createApi() {
});
},
async GetDefineTypes() {
return await request({
url: apiPrefix + "/getTypeDict",
method: "post"
});
},
async GetProviderDefine(type: string) {
return await request({
url: apiPrefix + "/define",
@@ -80,6 +94,13 @@ export function createApi() {
method: "post",
params: { type }
});
},
async GetOrCreateDefault(param: { email: any }) {
return await request({
url: apiPrefix + "/getOrCreateDefault",
method: "post",
data: param
});
}
};
}
@@ -6,11 +6,14 @@ import { Modal } from "ant-design-vue";
import * as api from "/@/views/sys/cname/provider/api";
import { mitter } from "/@/utils/util.mitt";
export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
export function notificationProvide(api: any) {
provide("notificationApi", api);
provide("get:plugin:type", () => {
return "notification";
});
}
export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
const notificationTypeDictRef = dict({
url: "/pi/notification/getTypeDict"
});
@@ -1,12 +1,9 @@
// @ts-ignore
import { useI18n } from "vue-i18n";
import { ref } from "vue";
import { getCommonColumnDefine } from "./common";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import { createNotificationApi } from "/@/views/certd/notification/api";
const api = createNotificationApi();
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const { t } = useI18n();
const api = context.api;
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
return await api.GetList(query);
};
@@ -14,12 +14,14 @@
import { defineComponent, onActivated, onMounted } from "vue";
import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud";
import { createApi } from "./api";
import { createNotificationApi } from "./api";
import { notificationProvide } from "/@/views/certd/notification/common";
export default defineComponent({
name: "NotificationManager",
setup() {
const api = createApi();
const api = createNotificationApi();
notificationProvide(api);
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { api } });
// 页面打开后获取列表数据
@@ -1,162 +1,162 @@
<template>
<div class="notification-selector">
<span v-if="target?.name" class="mr-5 cd-flex-inline">
<a-tag class="mr-5" color="green">{{ target.name }}</a-tag>
<fs-icon class="cd-icon-button" icon="ion:close-circle-outline" @click="clear"></fs-icon>
</span>
<span v-else class="mlr-5 text-gray">{{ placeholder }}</span>
<a-button class="ml-5" :disabled="disabled" :size="size" @click="chooseForm.open">选择</a-button>
<a-form-item-rest v-if="chooseForm.show">
<a-modal v-model:open="chooseForm.show" title="选择通知渠道" width="905px" @ok="chooseForm.ok">
<div style="height: 400px; position: relative">
<cert-notification-modal v-model="selectedId"></cert-notification-modal>
</div>
</a-modal>
</a-form-item-rest>
<div class="flex-o w-100">
<fs-dict-select
class="flex-1"
:value="modelValue"
:dict="optionsDictRef"
:disabled="disabled"
:render-label="renderLabel"
:slots="selectSlots"
:allow-clear="true"
@update:value="onChange"
/>
<fs-table-select
ref="tableSelectRef"
class="flex-0"
:model-value="modelValue"
:dict="optionsDictRef"
:create-crud-options="createCrudOptions"
:crud-options-override="{
search: { show: false },
table: {
scroll: {
x: 540
}
}
}"
:show-current="false"
:show-select="false"
:dialog="{ width: 960 }"
:destroy-on-close="false"
height="400px"
@update:model-value="onChange"
@dialog-closed="doRefresh"
>
<template #default="scope">
<fs-button class="ml-5" :disabled="disabled" :size="size" type="primary" icon="ant-design:edit-outlined" @click="scope.open"></fs-button>
</template>
</fs-table-select>
</div>
</div>
</template>
<script>
import { defineComponent, reactive, ref, watch, inject } from "vue";
import CertNotificationModal from "./modal/index.vue";
import { createApi } from "../api";
<script lang="tsx" setup>
import { inject, ref, Ref, watch } from "vue";
import { createNotificationApi } from "../api";
import { message } from "ant-design-vue";
import { dict } from "@fast-crud/fast-crud";
import createCrudOptions from "../crud";
import { notificationProvide } from "/@/views/certd/notification/common";
export default defineComponent({
name: "NotificationSelector",
components: { CertNotificationModal },
props: {
modelValue: {
type: [Number, String],
default: null
},
type: {
type: String,
default: ""
},
placeholder: {
type: String,
default: "请选择"
},
size: {
type: String,
default: "middle"
},
disabled: {
type: Boolean,
default: false
},
useDefault: {
type: Boolean,
default: false
}
},
emits: ["update:modelValue", "selectedChange", "change"],
setup(props, ctx) {
const api = createApi();
defineOptions({
name: "NotificationSelector"
});
const target = ref({});
const selectedId = ref();
async function refreshTarget(value) {
selectedId.value = value;
if (value > 0) {
target.value = await api.GetSimpleInfo(value);
}
}
const props = defineProps<{
modelValue?: number | string;
type?: string;
placeholder?: string;
size?: string;
disabled?: boolean;
}>();
async function loadDefault() {
const defId = await api.GetDefaultId();
if (defId) {
await emitValue(defId);
}
}
const onChange = async (value: number) => {
await emitValue(value);
};
loadDefault();
const emit = defineEmits(["update:modelValue", "selectedChange", "change"]);
function clear() {
if (props.disabled) {
return;
}
emitValue(null);
}
async function emitValue(value) {
if (pipeline?.value && target?.value && pipeline.value.userId !== target.value.userId) {
message.error("对不起,您不能修改他人流水线的通知");
return;
}
if (value == null) {
selectedId.value = "";
target.value = null;
} else {
selectedId.value = value;
await refreshTarget(selectedId.value);
}
ctx.emit("change", selectedId.value);
ctx.emit("update:modelValue", selectedId.value);
ctx.emit("selectedChange", target.value);
}
watch(
() => {
return props.modelValue;
},
async (value) => {
selectedId.value = null;
target.value = null;
if (value == null) {
return;
}
await refreshTarget(value);
},
const api = createNotificationApi();
notificationProvide(api);
// const types = ref({});
// async function loadNotificationTypes() {
// const types = await api.GetDefineTypes();
// const map: any = {};
// for (const item of types) {
// map[item.type] = item;
// }
// types.value = map;
// }
// loadNotificationTypes();
const tableSelectRef = ref();
const optionsDictRef = dict({
url: "/pi/notification/options",
value: "id",
label: "name",
onReady: ({ dict }) => {
const data = [
{
immediate: true
}
);
const providerDefine = ref({});
async function refreshProviderDefine(type) {
providerDefine.value = await api.GetProviderDefine(type);
}
// watch(
// () => {
// return props.type;
// },
// async (value) => {
// await refreshProviderDefine(value);
// },
// {
// immediate: true
// }
// );
//当不在pipeline中编辑时,可能为空
const pipeline = inject("pipeline", null);
const chooseForm = reactive({
show: false,
open() {
chooseForm.show = true;
id: 0,
name: "使用默认通知",
icon: "ion:notifications"
},
ok: () => {
console.log("choose ok:", selectedId.value);
emitValue(selectedId.value);
chooseForm.show = false;
}
});
return {
clear,
target,
selectedId,
providerDefine,
chooseForm
};
...dict.data
];
dict.setData(data);
}
});
const renderLabel = (option: any) => {
return <span>{option.name}</span>;
};
async function openTableSelectDialog(e: any) {
e.preventDefault();
await tableSelectRef.value.open();
await tableSelectRef.value.crudExpose.openAdd({});
}
const selectSlots = ref({
dropdownRender({ menuNode }: any) {
const res = [];
res.push(menuNode);
res.push(<a-divider style="margin: 4px 0" />);
res.push(<a-space style="padding: 4px 8px" />);
res.push(<fs-button class="w-100" type="text" icon="plus-outlined" text="新建通知渠道" onClick={openTableSelectDialog}></fs-button>);
return res;
}
});
const target: Ref<any> = ref({});
function clear() {
if (props.disabled) {
return;
}
emitValue(null);
}
async function emitValue(value: any) {
if (value !== 0 && pipeline?.value && target && pipeline.value.userId !== target.value.userId) {
message.error("对不起,您不能修改他人流水线的通知");
return;
}
emit("change", value);
emit("update:modelValue", value);
}
watch(
() => {
return props.modelValue;
},
async (value) => {
await optionsDictRef.loadDict();
target.value = optionsDictRef.dataMap[value];
emit("selectedChange", target.value);
},
{
immediate: true
}
);
//当不在pipeline中编辑时,可能为空
const pipeline = inject("pipeline", null);
async function doRefresh() {
await optionsDictRef.reloadDict();
}
</script>
<style lang="less">
.notification-selector {
width: 100%;
}
</style>
@@ -8,7 +8,7 @@
import { defineComponent, onMounted, watch } from "vue";
import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud";
import { createApi } from "../../api";
import { createNotificationApi } from "../../api";
export default defineComponent({
name: "CertNotificationModal",
@@ -17,7 +17,7 @@ export default defineComponent({
},
emits: ["update:modelValue"],
setup(props, ctx) {
const api = createApi();
const api = createNotificationApi();
const context: any = { props, ctx, api };
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
onMounted(() => {
@@ -10,11 +10,10 @@ export async function GetList(query: any) {
data: query
});
for (const item of list) {
if (item.pipeline) {
if (item.pipeline && typeof item.pipeline === "string") {
item.pipeline = JSON.parse(item.pipeline);
}
}
console.log("history", list);
return list;
}
@@ -29,7 +29,6 @@ function initPlugins(plugins: any) {
plugin.input[key] = field;
}
}
console.log("plugins", plugins);
}
export async function GetList(query: any) {
@@ -56,6 +55,18 @@ export async function GetGroups(query: any) {
return groups;
}
export async function GetPluginDefine(type: string) {
const define = await request({
url: apiPrefix + "/getDefineByType",
method: "post",
data: {
type
}
});
initPlugins([define]);
return define;
}
export async function GetPluginConfig(req: { id?: number; name: string; type: string }): Promise<PluginConfigBean> {
return await request({
url: apiPrefix + "/config",
@@ -1,16 +1,16 @@
import { compute, CreateCrudOptionsRet, dict } from "@fast-crud/fast-crud";
import { PluginGroup } from "@certd/pipeline";
import { useReference } from "/@/use/use-refrence";
import _, { merge } from "lodash-es";
import { useUserStore } from "/@/store/modules/user";
import { useSettingStore } from "/@/store/modules/settings";
import * as api from "../api.plugin";
import NotificationSelector from "/@/views/certd/notification/notification-selector/index.vue";
export default function (certPluginGroup: PluginGroup, formWrapperRef: any): CreateCrudOptionsRet {
export default function (certPlugins: any[], formWrapperRef: any): CreateCrudOptionsRet {
const inputs: any = {};
const userStore = useUserStore();
const settingStore = useSettingStore();
for (const plugin of certPluginGroup.plugins) {
for (const plugin of certPlugins) {
for (const inputKey in plugin.input) {
if (inputs[inputKey]) {
inputs[inputKey].form.show = true;
@@ -107,13 +107,18 @@ export default function (certPluginGroup: PluginGroup, formWrapperRef: any): Cre
title: "失败通知",
type: "text",
form: {
value: 0,
component: {
name: NotificationSelector,
vModel: "modelValue",
useDefault: true
on: {
selectedChange({ $event, form }) {
form.notificationTarget = $event;
}
}
},
order: 101,
helper: "建议设置,任务执行失败实时提醒"
helper: "任务执行失败实时提醒"
}
}
}
@@ -9,6 +9,8 @@ import { ref } from "vue";
import * as _ from "lodash-es";
import * as api from "../api.plugin";
import { PluginGroup, PluginGroups } from "/@/views/certd/pipeline/pipeline/type";
import { GetPluginDefine } from "../api.plugin";
import { createNotificationApi } from "/@/views/certd/notification/api";
export default {
name: "PiCertdForm",
setup(props: any, ctx: any) {
@@ -19,17 +21,29 @@ export default {
const pluginGroups: { [key: string]: PluginGroup } = await api.GetGroups({});
const certPluginGroup = pluginGroups.cert;
const certPlugins = [];
for (const plugin of certPluginGroup.plugins) {
const detail: any = await api.GetPluginDefine(plugin.name);
certPlugins.push(detail);
}
// 自定义表单配置
const { buildFormOptions } = useColumns();
//使用crudOptions结构来构建自定义表单配置
let { crudOptions } = createCrudOptions(certPluginGroup, formWrapperRef);
let { crudOptions } = createCrudOptions(certPlugins, formWrapperRef);
const formOptions = buildFormOptions(
_.merge(crudOptions, {
form: {
doSubmit({ form }: any) {
async doSubmit({ form }: any) {
// 创建certd 的pipeline
doSubmitRef.value({ form });
await doSubmitRef.value({ form });
if (form.email) {
//创建一个默认的邮件通知
const notificationApi = createNotificationApi();
await notificationApi.GetOrCreateDefault({ email: form.email });
}
}
}
}) as any
@@ -14,7 +14,7 @@ import * as _ from "lodash-es";
import { useModal } from "/@/use/use-modal";
import CertView from "./cert-view.vue";
import { eachStages } from "./utils";
import { createApi as createNotificationApi } from "../notification/api";
import { createNotificationApi as createNotificationApi } from "../notification/api";
export default function ({ crudExpose, context: { certdFormRef, groupDictRef, selectedRowKeys } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter();
const { t } = useI18n();
@@ -102,13 +102,12 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
triggers.push({ title: "定时触发", type: "timer", props: { cron: form.triggerCron } });
}
const notifications = [];
if (form.notification) {
const notify = await createNotificationApi().GetSimpleInfo(form.notification);
if (form.notification != null) {
notifications.push({
type: "custom",
when: ["error", "turnToSuccess"],
notificationId: form.notification,
title: notify.name
title: form.notificationTarget?.name || "自定义通知"
});
}
let pipeline = {
@@ -174,9 +173,9 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
const downloadCert = async (row: any) => {
const files = await api.GetFiles(row.id);
model.success({
title: "文件下载",
title: "点击链接下载",
maskClosable: true,
okText: "↑↑↑ 点击上面链接下载",
okText: "关闭",
content: () => {
const children = [];
for (const file of files) {
@@ -192,7 +191,16 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se
);
}
return <div class={"mt-3"}>{children}</div>;
if (children.length === 0) {
return <div>暂无文件下载</div>;
}
return (
<div class={"mt-3"}>
<h3>点击链接下载</h3>
<div> {children}</div>
</div>
);
}
});
};
@@ -239,13 +239,13 @@ export default {
const stepType = step.type;
step.type = stepType;
step._isAdd = false;
let pluginDefine = pluginGroups.get(stepType);
const pluginDefine = await pluginApi.GetPluginDefine(stepType);
// let pluginDefine = pluginGroups.get(stepType);
if (pluginDefine == null) {
console.log("插件未找到", stepType);
return;
}
pluginDefine = _.cloneDeep(pluginDefine);
// pluginDefine = _.cloneDeep(pluginDefine);
const columns = pluginDefine.input;
for (let key in columns) {
const column = columns[key];
@@ -321,7 +321,6 @@ export default defineComponent({
currentHistory.value = history;
pipeline.value = history.pipeline;
await loadCurrentHistoryDetail();
console.log("currentHistory:", currentHistory);
};
async function loadHistoryList(reload = false) {
@@ -128,7 +128,6 @@ export default defineComponent({
};
const handleFinish = async (values: any) => {
utils.logger.log(values, formState);
loading.value = true;
try {
const loginType = formState.loginType;
@@ -1,11 +1,11 @@
<template>
<fs-page class="cd-page-account">
<template #header>
<div class="title">
站点绑定
<span class="sub">管理你安装过的Certd站点,可以通过转移功能避免丢失VIP,强烈建议绑定</span>
</div>
</template>
<!-- <template #header>-->
<!-- <div class="title">-->
<!-- 站点绑定-->
<!-- <span class="sub">管理你安装过的Certd站点,可以通过转移功能避免丢失VIP,强烈建议绑定</span>-->
<!-- </div>-->
<!-- </template>-->
<iframe ref="iframeRef" class="account-iframe" :src="iframeSrcRef"> </iframe>
</fs-page>
@@ -19,7 +19,7 @@
<a-form-item label="公共ZeroSSL EAB授权" :name="['CertApply', 'sysSetting', 'input', 'zerosslCommonEabAccessId']">
<access-selector v-model:model-value="formState.CertApply.sysSetting.input.zerosslCommonEabAccessId" type="eab" from="sys"></access-selector>
<div class="helper">
<div>设置公共ZeroSSL EAB授权给用户使用,避免用户自己去翻墙获取Zero EAB授权,注意:ZeroSSL免费证书有数量限制</div>
<div>设置公共ZeroSSL EAB授权给用户使用,避免用户自己去翻墙获取Zero EAB授权</div>
<div>
<a href="https://app.zerossl.com/developer">zerossl开发者中心获取EAB </a>
</div>
@@ -85,3 +85,13 @@ export async function TestSms(data: any) {
data
});
}
export async function GetSmsTypeDefine(type: string) {
return await request({
url: apiPrefix + "/getSmsTypeDefine",
method: "post",
data: {
type
}
});
}
@@ -65,6 +65,7 @@
<a-form :model="testFormState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onTestSend">
<a-form-item label="测试收件邮箱" name="receiver" :rules="[{ required: true, message: '请输入测试收件邮箱' }]">
<a-input v-model:value="testFormState.receiver" />
<div class="helper">保存后再点击测试</div>
<div class="helper">发送失败???<a href="https://certd.docmirror.cn/guide/use/email/" target="_blank">邮件配置帮助文档</a></div>
<div class="helper">您还可以试试使用官方邮件服务器↗↗↗↗↗↗↗↗</div>
</a-form-item>
@@ -32,23 +32,15 @@
</a-form-item>
<template v-if="formState.public.smsLoginEnabled">
<a-form-item label="短信提供商" :name="['private', 'sms', 'type']">
<a-select v-model:value="formState.private.sms.type">
<a-select-option value="aliyun">阿里云</a-select-option>
<a-select v-model:value="formState.private.sms.type" @change="smsTypeChange">
<a-select-option value="aliyun">阿里云短信</a-select-option>
<a-select-option value="yfysms">易发云短信</a-select-option>
</a-select>
</a-form-item>
<template v-for="item of smsTypeDefineInputs" :key="item.simpleKey">
<fs-form-item v-model="formState.private.sms.config[item.simpleKey]" :path="'private.sms.config' + item.key" :item="item" />
</template>
<a-form-item label="阿里云授权" :name="['private', 'sms', 'config', 'accessId']" :rules="rules.required">
<access-selector v-model="formState.private.sms.config.accessId" />
</a-form-item>
<a-form-item label="短信签名" :name="['private', 'sms', 'config', 'signName']" :rules="rules.required">
<a-input v-model:value="formState.private.sms.config.signName" />
</a-form-item>
<a-form-item label="验证码模版ID" :name="['private', 'sms', 'config', 'codeTemplateId']" :rules="rules.required">
<a-input v-model:value="formState.private.sms.config.codeTemplateId" />
<div class="helper">需要配置一个变量为{code}的验证码模版</div>
</a-form-item>
<a-form-item label="短信测试">
<div class="flex">
<a-input v-model:value="testMobile" placeholder="输入测试手机号" />
@@ -67,8 +59,8 @@
</template>
<script setup lang="tsx">
import { reactive, ref } from "vue";
import { SysSettings } from "/@/views/sys/settings/api";
import { reactive, ref, Ref } from "vue";
import { GetSmsTypeDefine, SysSettings } from "/@/views/sys/settings/api";
import * as api from "/@/views/sys/settings/api";
import { merge } from "lodash-es";
import { useSettingStore } from "/@/store/modules/settings";
@@ -121,9 +113,48 @@ const rules = {
}
};
async function smsTypeChange(value: string) {
if (formState.private?.sms?.config) {
formState.private.sms.config = {};
}
await loadTypeDefine(value);
}
const smsTypeDefineInputs: Ref = ref({});
async function loadTypeDefine(type: string) {
const define: any = await api.GetSmsTypeDefine(type);
const keys = Object.keys(define.input);
const inputs: any = {};
keys.forEach((key) => {
const value = define.input[key];
value.simpleKey = key;
value.key = "private.sms.config." + key;
if (!value.component) {
value.component = {
name: "a-input"
};
}
if (!value.component.name) {
value.component.vModel = "value";
}
if (!value.rules) {
value.rules = [];
}
if (value.required) {
value.rules.push(rules.required);
}
inputs[key] = define.input[key];
});
smsTypeDefineInputs.value = inputs;
}
async function loadSysSettings() {
const data: any = await api.SysSettingsGet();
merge(formState, data);
if (data?.private.sms?.type) {
await loadTypeDefine(data.private.sms.type);
}
}
const saveLoading = ref(false);
@@ -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
-12
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"
}
}
-7
View File
@@ -1,7 +0,0 @@
{
"printWidth": 160,
"bracketSpacing": true,
"singleQuote": true,
"trailingComma": "es5",
"arrowParens": "avoid"
}
@@ -1,4 +0,0 @@
module.exports = {
...require('mwts/.prettierrc.json'),
"printWidth": 160,
}
+23
View File
@@ -3,6 +3,29 @@
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
* 通知选择器优化 ([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))
* 支持易发云短信 ([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
+8 -21
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
+20 -1
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);
@@ -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`);
@@ -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;
@@ -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);
@@ -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);
@@ -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
);
@@ -0,0 +1 @@
INSERT INTO sys_role (id, name) VALUES (3, '普通用户');
@@ -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());
@@ -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);
@@ -0,0 +1,3 @@
alter table pi_pipeline add COLUMN `order` bigint default 0;
@@ -0,0 +1,2 @@
alter table cd_access add COLUMN `encrypt_setting` text;
@@ -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
);
@@ -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
);
@@ -0,0 +1,4 @@
ALTER TABLE cd_cname_provider ADD COLUMN user_id bigint;
update cd_cname_provider set user_id = 1;
@@ -0,0 +1,3 @@
update sys_user set status = 0 where id = 2;
@@ -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);
@@ -0,0 +1 @@
ALTER TABLE pi_notification ADD COLUMN is_default boolean DEFAULT 0;
@@ -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;
@@ -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`);
@@ -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");
@@ -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");
+42 -9
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();
+19 -16
View File
@@ -1,6 +1,6 @@
{
"name": "@certd/ui-server",
"version": "1.28.0",
"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.0",
"@certd/basic": "^1.28.0",
"@certd/commercial-core": "^1.28.0",
"@certd/lib-huawei": "^1.28.0",
"@certd/lib-k8s": "^1.28.0",
"@certd/lib-server": "^1.28.0",
"@certd/midway-flyway-js": "^1.28.0",
"@certd/pipeline": "^1.28.0",
"@certd/plugin-cert": "^1.28.0",
"@certd/plugin-lib": "^1.28.0",
"@certd/plugin-plus": "^1.28.0",
"@certd/plus-core": "^1.28.0",
"@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",
@@ -93,7 +96,7 @@
"socks-proxy-agent": "^8.0.4",
"strip-ansi": "^7.1.0",
"svg-captcha": "^1.4.0",
"tencentcloud-sdk-nodejs": "^4.0.44",
"tencentcloud-sdk-nodejs": "^4.0.983",
"typeorm": "^0.3.20",
"uuid": "^10.0.0"
},
@@ -72,6 +72,7 @@ const development = {
database: './data/db.sqlite',
synchronize: false, // 如果第一次使用,不存在表,有同步的需求可以写 true
logging: false,
highlightSql: false,
// 配置实体模型 或者 entities: '/entity',
entities: ['**/modules/**/entity/*.js', ...libServerEntities, ...commercialEntities, PipelineEntity, FlywayHistory, UserEntity],
@@ -1,11 +1,18 @@
import { Controller, Get, Provide } from '@midwayjs/core';
import { BaseController, Constants } from '@certd/lib-server';
import { Controller, Get, Inject, Provide } from '@midwayjs/core';
import { BaseController, Constants, FileService, SysSettingsService, SysSiteInfo } from '@certd/lib-server';
import { http, logger } from '@certd/basic';
import { isComm } from '@certd/plus-core';
/**
*/
@Provide()
@Controller('/api/app/')
export class AppController extends BaseController {
@Inject()
sysSettingsService: SysSettingsService;
@Inject()
fileService: FileService;
@Get('/latest', { summary: Constants.per.authOnly })
async latest(): Promise<any> {
const res = await http.request({
@@ -20,4 +27,21 @@ export class AppController extends BaseController {
return this.ok('');
}
}
@Get('/favicon', { summary: Constants.per.guest })
public async getFavicon() {
if (isComm()) {
const siteInfo = await this.sysSettingsService.getSetting<SysSiteInfo>(SysSiteInfo);
const favicon = siteInfo.logo;
if (favicon) {
const redirect = '/api/basic/file/download?key=' + favicon;
this.ctx.response.redirect(redirect);
this.ctx.response.set('Cache-Control', 'public,max-age=25920');
return;
}
}
const redirect = '/static/images/logo/logo.svg';
this.ctx.response.redirect(redirect);
this.ctx.response.set('Cache-Control', 'public,max-age=25920');
}
}
@@ -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);
}
@@ -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);
}

Some files were not shown because too many files have changed in this diff Show More