mirror of
https://github.com/certd/certd.git
synced 2026-04-10 02:10:59 +08:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf19363092 | ||
|
|
589b38c75d | ||
|
|
90a8f818bf | ||
|
|
642f57ff6d | ||
|
|
cbccd9e3d0 | ||
|
|
cf7a3e6f70 | ||
|
|
8993687c37 | ||
|
|
ff1d7b115a | ||
|
|
98bd5149e9 | ||
|
|
4efa2e0c6a | ||
|
|
f805036054 | ||
|
|
3c723c4325 | ||
|
|
14a83f6b52 | ||
|
|
ff0686670c |
11
CHANGELOG.md
11
CHANGELOG.md
@@ -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.27.9](https://github.com/certd/certd/compare/v1.27.8...v1.27.9) (2024-11-26)
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* 通知支持自定义webhook、anpush、iyuu、server酱 ([cbccd9e](https://github.com/certd/certd/commit/cbccd9e3d0a4c24aba772af62734666d40b22c57))
|
||||
* 通知支持vocechat、bark、telegram、discord、slack ([642f57f](https://github.com/certd/certd/commit/642f57ff6d7152a9e14f59c7fc0e32a6b1751fb7))
|
||||
|
||||
## [1.27.8](https://github.com/certd/certd/compare/v1.27.7...v1.27.8) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package root
|
||||
|
||||
## [1.27.7](https://github.com/certd/certd/compare/v1.27.6...v1.27.7) (2024-11-25)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1 +1 @@
|
||||
18:15
|
||||
02:09
|
||||
|
||||
@@ -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.27.8](https://github.com/certd/certd/compare/v1.27.7...v1.27.8) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package root
|
||||
|
||||
## [1.27.7](https://github.com/certd/certd/compare/v1.27.6...v1.27.7) (2024-11-25)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 修复关键字查询bug ([fab6660](https://github.com/certd/certd/commit/fab66606b35a540fac31fee902331ba1ffdebc16))
|
||||
* 修复CNAME时子域名级数超出限制的问题 ([3af6d96](https://github.com/certd/certd/commit/3af6d96e6e353c9b2111cff81679b79c55195a0a))
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* 谷歌EAB绑定邮箱改成必填 ([81a8123](https://github.com/certd/certd/commit/81a8123725d7bf4bd6a32a64a066bd760b7b6a7f))
|
||||
* 华为云密钥获取提示及访问链接 ([de43391](https://github.com/certd/certd/commit/de43391e4c12dc3ad976f8fa8787f4eb70a41e75))
|
||||
* 通知管理 ([d9a00ee](https://github.com/certd/certd/commit/d9a00eeaf72735ced67c59d7983d84e3c730064a))
|
||||
* 通知渠道支持测试按钮 ([b54ae27](https://github.com/certd/certd/commit/b54ae272ebc2d31b32b049d44e2299a6be7f153c))
|
||||
* 优化插件开发,dnsProvider无需写http logger 变量 ([fcbb5e4](https://github.com/certd/certd/commit/fcbb5e46a112174150a62648319b8224fce3b7ed))
|
||||
* 支持部署到阿里云WAF ([c96fcb7](https://github.com/certd/certd/commit/c96fcb7afced979435cffa73591275008033c90d))
|
||||
* 支持企业微信群聊机器人通知 ([b805a29](https://github.com/certd/certd/commit/b805a2925984144a31575b8aaa622f0c30d41b56))
|
||||
|
||||
## [1.27.6](https://github.com/certd/certd/compare/v1.27.5...v1.27.6) (2024-11-19)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -40,7 +40,7 @@ admin/123456
|
||||
## 三、如何升级
|
||||
|
||||
### 1. 应用商店安装,直接更新镜像即可
|
||||
|
||||
`docker`->`容器编排`->`左侧选择Certd-xxxx`->`更新镜像`
|
||||

|
||||
|
||||
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
}
|
||||
},
|
||||
"npmClient": "pnpm",
|
||||
"version": "1.27.7"
|
||||
"version": "1.27.9"
|
||||
}
|
||||
|
||||
@@ -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.27.9](https://github.com/publishlab/node-acme-client/compare/v1.27.8...v1.27.9) (2024-11-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/acme-client
|
||||
|
||||
## [1.27.8](https://github.com/publishlab/node-acme-client/compare/v1.27.7...v1.27.8) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/acme-client
|
||||
|
||||
## [1.27.7](https://github.com/publishlab/node-acme-client/compare/v1.27.6...v1.27.7) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/acme-client
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"description": "Simple and unopinionated ACME client",
|
||||
"private": false,
|
||||
"author": "nmorsman",
|
||||
"version": "1.27.7",
|
||||
"version": "1.27.9",
|
||||
"type": "module",
|
||||
"module": "scr/index.js",
|
||||
"main": "src/index.js",
|
||||
@@ -18,7 +18,7 @@
|
||||
"types"
|
||||
],
|
||||
"dependencies": {
|
||||
"@certd/basic": "^1.27.7",
|
||||
"@certd/basic": "^1.27.9",
|
||||
"@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": "85ca85045361cfbe75189e4cf4c1591197f3bf13"
|
||||
"gitHead": "ff1d7b115ad211e65fdbbcb625837aa7cc911cfd"
|
||||
}
|
||||
|
||||
@@ -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.27.9](https://github.com/certd/certd/compare/v1.27.8...v1.27.9) (2024-11-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/basic
|
||||
|
||||
## [1.27.8](https://github.com/certd/certd/compare/v1.27.7...v1.27.8) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/basic
|
||||
|
||||
## [1.27.7](https://github.com/certd/certd/compare/v1.27.6...v1.27.7) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/basic
|
||||
|
||||
@@ -1 +1 @@
|
||||
01:39
|
||||
15:25
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@certd/basic",
|
||||
"private": false,
|
||||
"version": "1.27.7",
|
||||
"version": "1.27.9",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
@@ -43,5 +43,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "85ca85045361cfbe75189e4cf4c1591197f3bf13"
|
||||
"gitHead": "ff1d7b115ad211e65fdbbcb625837aa7cc911cfd"
|
||||
}
|
||||
|
||||
@@ -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.27.9](https://github.com/certd/certd/compare/v1.27.8...v1.27.9) (2024-11-26)
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* 通知支持自定义webhook、anpush、iyuu、server酱 ([cbccd9e](https://github.com/certd/certd/commit/cbccd9e3d0a4c24aba772af62734666d40b22c57))
|
||||
* 通知支持vocechat、bark、telegram、discord、slack ([642f57f](https://github.com/certd/certd/commit/642f57ff6d7152a9e14f59c7fc0e32a6b1751fb7))
|
||||
|
||||
## [1.27.8](https://github.com/certd/certd/compare/v1.27.7...v1.27.8) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/pipeline
|
||||
|
||||
## [1.27.7](https://github.com/certd/certd/compare/v1.27.6...v1.27.7) (2024-11-25)
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@certd/pipeline",
|
||||
"private": false,
|
||||
"version": "1.27.7",
|
||||
"version": "1.27.9",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
@@ -16,8 +16,8 @@
|
||||
"test": "mocha --loader=ts-node/esm"
|
||||
},
|
||||
"dependencies": {
|
||||
"@certd/basic": "^1.27.7",
|
||||
"@certd/plus-core": "^1.27.7",
|
||||
"@certd/basic": "^1.27.9",
|
||||
"@certd/plus-core": "^1.27.9",
|
||||
"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": "85ca85045361cfbe75189e4cf4c1591197f3bf13"
|
||||
"gitHead": "ff1d7b115ad211e65fdbbcb625837aa7cc911cfd"
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { RunHistory, RunnableCollection } from "./run-history.js";
|
||||
import { AbstractTaskPlugin, PluginDefine, pluginRegistry, TaskInstanceContext, UserInfo } from "../plugin/index.js";
|
||||
import { ContextFactory, IContext } from "./context.js";
|
||||
import { IStorage } from "./storage.js";
|
||||
import { createAxiosService, hashUtils, HttpRequestConfig, ILogger, logger, utils } from "@Certd/basic";
|
||||
import { createAxiosService, hashUtils, HttpRequestConfig, ILogger, logger, utils } from "@certd/basic";
|
||||
import { IAccessService } from "../access/index.js";
|
||||
import { RegistryItem } from "../registry/index.js";
|
||||
import { Decorator } from "../decorator/index.js";
|
||||
@@ -366,17 +366,17 @@ export class Executor {
|
||||
let content = "";
|
||||
const errorMessage = error?.message;
|
||||
if (when === "start") {
|
||||
subject = `【Certd】开始执行,【${this.pipeline.id}】${this.pipeline.title}`;
|
||||
content = `buildId:${this.runtime.id}\n查看详情:${url}`;
|
||||
subject = `【Certd】开始执行,${this.pipeline.title}【${this.pipeline.id}】`;
|
||||
content = `流水线ID:${this.pipeline.id},运行ID:${this.runtime.id}`;
|
||||
} else if (when === "success") {
|
||||
subject = `【Certd】执行成功,【${this.pipeline.id}】${this.pipeline.title}`;
|
||||
content = `buildId:${this.runtime.id}\n查看详情:${url}`;
|
||||
subject = `【Certd】执行成功,${this.pipeline.title}【${this.pipeline.id}】`;
|
||||
content = `流水线ID:${this.pipeline.id},运行ID:${this.runtime.id}`;
|
||||
} else if (when === "turnToSuccess") {
|
||||
subject = `【Certd】执行成功(失败转成功),【${this.pipeline.id}】${this.pipeline.title}`;
|
||||
content = `buildId:${this.runtime.id}\n查看详情:${url}`;
|
||||
subject = `【Certd】执行成功(失败转成功),${this.pipeline.title}【${this.pipeline.id}】`;
|
||||
content = `流水线ID:${this.pipeline.id},运行ID:${this.runtime.id}`;
|
||||
} else if (when === "error") {
|
||||
subject = `【Certd】执行失败,【${this.pipeline.id}】${this.pipeline.title}`;
|
||||
content = `buildId:${this.runtime.id}\n查看详情:${url}\nerror:${error.message}`;
|
||||
subject = `【Certd】执行失败,${this.pipeline.title}【${this.pipeline.id}】`;
|
||||
content = `流水线ID:${this.pipeline.id},运行ID:${this.runtime.id}\n错误详情:${error.message}`;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ export abstract class BaseNotification implements INotification {
|
||||
async onTestRequest() {
|
||||
await this.send({
|
||||
userId: 0,
|
||||
title: "测试通知",
|
||||
title: "【Certd】测试通知",
|
||||
content: "测试通知",
|
||||
pipeline: {
|
||||
id: 1,
|
||||
@@ -105,7 +105,7 @@ export abstract class BaseNotification implements INotification {
|
||||
} as any,
|
||||
pipelineId: 1,
|
||||
historyId: 1,
|
||||
url: "http://www.baidu.com",
|
||||
url: "https://certd.docmirror.cn",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.27.9](https://github.com/certd/certd/compare/v1.27.8...v1.27.9) (2024-11-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-huawei
|
||||
|
||||
## [1.27.8](https://github.com/certd/certd/compare/v1.27.7...v1.27.8) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-huawei
|
||||
|
||||
## [1.27.7](https://github.com/certd/certd/compare/v1.27.6...v1.27.7) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-huawei
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@certd/lib-huawei",
|
||||
"private": false,
|
||||
"version": "1.27.7",
|
||||
"version": "1.27.9",
|
||||
"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": "85ca85045361cfbe75189e4cf4c1591197f3bf13"
|
||||
"gitHead": "ff1d7b115ad211e65fdbbcb625837aa7cc911cfd"
|
||||
}
|
||||
|
||||
@@ -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.27.9](https://github.com/certd/certd/compare/v1.27.8...v1.27.9) (2024-11-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-iframe
|
||||
|
||||
## [1.27.8](https://github.com/certd/certd/compare/v1.27.7...v1.27.8) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-iframe
|
||||
|
||||
## [1.27.7](https://github.com/certd/certd/compare/v1.27.6...v1.27.7) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-iframe
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@certd/lib-iframe",
|
||||
"private": false,
|
||||
"version": "1.27.7",
|
||||
"version": "1.27.9",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
@@ -30,5 +30,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "85ca85045361cfbe75189e4cf4c1591197f3bf13"
|
||||
"gitHead": "ff1d7b115ad211e65fdbbcb625837aa7cc911cfd"
|
||||
}
|
||||
|
||||
@@ -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.27.9](https://github.com/certd/certd/compare/v1.27.8...v1.27.9) (2024-11-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-k8s
|
||||
|
||||
## [1.27.8](https://github.com/certd/certd/compare/v1.27.7...v1.27.8) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-k8s
|
||||
|
||||
## [1.27.7](https://github.com/certd/certd/compare/v1.27.6...v1.27.7) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-k8s
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@certd/lib-k8s",
|
||||
"private": false,
|
||||
"version": "1.27.7",
|
||||
"version": "1.27.9",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
@@ -16,7 +16,7 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@certd/basic": "^1.27.7",
|
||||
"@certd/basic": "^1.27.9",
|
||||
"@kubernetes/client-node": "0.21.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -31,5 +31,5 @@
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "85ca85045361cfbe75189e4cf4c1591197f3bf13"
|
||||
"gitHead": "ff1d7b115ad211e65fdbbcb625837aa7cc911cfd"
|
||||
}
|
||||
|
||||
@@ -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.27.9](https://github.com/certd/certd/compare/v1.27.8...v1.27.9) (2024-11-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-server
|
||||
|
||||
## [1.27.8](https://github.com/certd/certd/compare/v1.27.7...v1.27.8) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-server
|
||||
|
||||
## [1.27.7](https://github.com/certd/certd/compare/v1.27.6...v1.27.7) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/lib-server
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@certd/lib-server",
|
||||
"version": "1.27.7",
|
||||
"version": "1.27.9",
|
||||
"description": "midway with flyway, sql upgrade way ",
|
||||
"private": false,
|
||||
"type": "module",
|
||||
@@ -27,10 +27,10 @@
|
||||
],
|
||||
"license": "AGPL",
|
||||
"dependencies": {
|
||||
"@certd/acme-client": "^1.27.7",
|
||||
"@certd/basic": "^1.27.7",
|
||||
"@certd/pipeline": "^1.27.7",
|
||||
"@certd/plus-core": "^1.27.7",
|
||||
"@certd/acme-client": "^1.27.9",
|
||||
"@certd/basic": "^1.27.9",
|
||||
"@certd/pipeline": "^1.27.9",
|
||||
"@certd/plus-core": "^1.27.9",
|
||||
"@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": "85ca85045361cfbe75189e4cf4c1591197f3bf13"
|
||||
"gitHead": "ff1d7b115ad211e65fdbbcb625837aa7cc911cfd"
|
||||
}
|
||||
|
||||
@@ -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.27.9](https://github.com/certd/certd/compare/v1.27.8...v1.27.9) (2024-11-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||
|
||||
## [1.27.8](https://github.com/certd/certd/compare/v1.27.7...v1.27.8) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||
|
||||
## [1.27.7](https://github.com/certd/certd/compare/v1.27.6...v1.27.7) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@certd/midway-flyway-js",
|
||||
"version": "1.27.7",
|
||||
"version": "1.27.9",
|
||||
"description": "midway with flyway, sql upgrade way ",
|
||||
"private": false,
|
||||
"type": "module",
|
||||
@@ -46,5 +46,5 @@
|
||||
"typeorm": "^0.3.11",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"gitHead": "85ca85045361cfbe75189e4cf4c1591197f3bf13"
|
||||
"gitHead": "ff1d7b115ad211e65fdbbcb625837aa7cc911cfd"
|
||||
}
|
||||
|
||||
@@ -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.27.9](https://github.com/certd/certd/compare/v1.27.8...v1.27.9) (2024-11-26)
|
||||
|
||||
**Note:** Version bump only for package @certd/plugin-cert
|
||||
|
||||
## [1.27.8](https://github.com/certd/certd/compare/v1.27.7...v1.27.8) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/plugin-cert
|
||||
|
||||
## [1.27.7](https://github.com/certd/certd/compare/v1.27.6...v1.27.7) (2024-11-25)
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@certd/plugin-cert",
|
||||
"private": false,
|
||||
"version": "1.27.7",
|
||||
"version": "1.27.9",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -15,9 +15,9 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@certd/acme-client": "^1.27.7",
|
||||
"@certd/basic": "^1.27.7",
|
||||
"@certd/pipeline": "^1.27.7",
|
||||
"@certd/acme-client": "^1.27.9",
|
||||
"@certd/basic": "^1.27.9",
|
||||
"@certd/pipeline": "^1.27.9",
|
||||
"@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": "85ca85045361cfbe75189e4cf4c1591197f3bf13"
|
||||
"gitHead": "ff1d7b115ad211e65fdbbcb625837aa7cc911cfd"
|
||||
}
|
||||
|
||||
@@ -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.27.9](https://github.com/certd/certd/compare/v1.27.8...v1.27.9) (2024-11-26)
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* 通知支持自定义webhook、anpush、iyuu、server酱 ([cbccd9e](https://github.com/certd/certd/commit/cbccd9e3d0a4c24aba772af62734666d40b22c57))
|
||||
* 通知支持vocechat、bark、telegram、discord、slack ([642f57f](https://github.com/certd/certd/commit/642f57ff6d7152a9e14f59c7fc0e32a6b1751fb7))
|
||||
|
||||
## [1.27.8](https://github.com/certd/certd/compare/v1.27.7...v1.27.8) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/ui-client
|
||||
|
||||
## [1.27.7](https://github.com/certd/certd/compare/v1.27.6...v1.27.7) (2024-11-25)
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@certd/ui-client",
|
||||
"version": "1.27.7",
|
||||
"version": "1.27.9",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite --open",
|
||||
@@ -65,8 +65,8 @@
|
||||
"vuedraggable": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@certd/lib-iframe": "^1.27.7",
|
||||
"@certd/pipeline": "^1.27.7",
|
||||
"@certd/lib-iframe": "^1.27.9",
|
||||
"@certd/pipeline": "^1.27.9",
|
||||
"@rollup/plugin-commonjs": "^25.0.7",
|
||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||
"@types/chai": "^4.3.12",
|
||||
|
||||
@@ -199,11 +199,13 @@ function openUpgrade() {
|
||||
const vipTypeDefine = {
|
||||
free: {
|
||||
title: "基础版",
|
||||
desc: "免费使用",
|
||||
type: "free",
|
||||
privilege: ["证书申请功能无限制", "证书流水线数量10条", "常用的主机、cdn等部署插件"]
|
||||
},
|
||||
plus: {
|
||||
title: "专业版",
|
||||
desc: "功能增强,适用于个人企业内部使用",
|
||||
type: "plus",
|
||||
privilege: ["可加VIP群,需求优先实现", "证书流水线数量无限制", "免配置发邮件功能", "支持宝塔、易盾、群晖、1Panel、cdnfly等部署插件"],
|
||||
trial: {
|
||||
@@ -215,6 +217,7 @@ function openUpgrade() {
|
||||
},
|
||||
comm: {
|
||||
title: "商业版",
|
||||
desc: "商业授权,可对外运营",
|
||||
type: "comm",
|
||||
privilege: ["拥有专业版所有特权", "允许商用,可修改logo、标题", "数据统计", "插件管理", "多用户无限制", "支持用户支付(敬请期待)"]
|
||||
}
|
||||
@@ -268,6 +271,7 @@ function openUpgrade() {
|
||||
</span>
|
||||
)}
|
||||
</h3>
|
||||
<div>{item.desc}</div>
|
||||
<ul>
|
||||
{item.privilege.map((p: string) => (
|
||||
<li>
|
||||
@@ -333,7 +337,7 @@ function openUpgrade() {
|
||||
padding: 10px;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 5px;
|
||||
height: 170px;
|
||||
height: 195px;
|
||||
//background-color: rgba(250, 237, 167, 0.79);
|
||||
&.current {
|
||||
border-color: green;
|
||||
|
||||
@@ -77,6 +77,12 @@ h1, h2, h3, h4, h5, h6 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.align-left{
|
||||
text-align: left;
|
||||
}
|
||||
.align-right{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.scroll-y {
|
||||
overflow-y: auto;
|
||||
|
||||
@@ -37,11 +37,6 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
editRequest,
|
||||
delRequest
|
||||
},
|
||||
form: {
|
||||
labelCol: {
|
||||
span: 6
|
||||
}
|
||||
},
|
||||
rowHandle: {
|
||||
width: 200
|
||||
},
|
||||
|
||||
@@ -39,7 +39,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
form: {
|
||||
labelCol: {
|
||||
span: 6
|
||||
//固定label宽度
|
||||
span: null,
|
||||
style: {
|
||||
width: "145px"
|
||||
}
|
||||
}
|
||||
},
|
||||
rowHandle: {
|
||||
|
||||
@@ -58,6 +58,13 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
form: {
|
||||
wrapper: {
|
||||
width: "1050px"
|
||||
},
|
||||
labelCol: {
|
||||
//固定label宽度
|
||||
span: null,
|
||||
style: {
|
||||
width: "145px"
|
||||
}
|
||||
}
|
||||
},
|
||||
rowHandle: {
|
||||
|
||||
@@ -180,8 +180,10 @@
|
||||
</div>
|
||||
<div class="task">
|
||||
<a-button shape="round" @click="notificationEdit(item, ii as number)">
|
||||
<fs-icon icon="ion:notifications"></fs-icon>
|
||||
【通知】 {{ item.title || item.type }}
|
||||
<div class="flex-o w-100">
|
||||
<fs-icon icon="ion:notifications"></fs-icon>
|
||||
<span class="ellipsis flex-1 step-title align-left"> 【通知】 {{ item.title || item.type }} </span>
|
||||
</div>
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -198,8 +200,10 @@
|
||||
</div>
|
||||
<div class="task">
|
||||
<a-button shape="round" @click="notificationEdit(item, index)">
|
||||
<fs-icon icon="ion:notifications"></fs-icon>
|
||||
【通知】 {{ item.title || item.type }}
|
||||
<div class="flex-o w-100">
|
||||
<fs-icon icon="ion:notifications"></fs-icon>
|
||||
<span class="ellipsis flex-1 step-title align-left"> 【通知】 {{ item.title || item.type }} </span>
|
||||
</div>
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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.27.9](https://github.com/certd/certd/compare/v1.27.8...v1.27.9) (2024-11-26)
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* 通知支持自定义webhook、anpush、iyuu、server酱 ([cbccd9e](https://github.com/certd/certd/commit/cbccd9e3d0a4c24aba772af62734666d40b22c57))
|
||||
* 通知支持vocechat、bark、telegram、discord、slack ([642f57f](https://github.com/certd/certd/commit/642f57ff6d7152a9e14f59c7fc0e32a6b1751fb7))
|
||||
|
||||
## [1.27.8](https://github.com/certd/certd/compare/v1.27.7...v1.27.8) (2024-11-25)
|
||||
|
||||
**Note:** Version bump only for package @certd/ui-server
|
||||
|
||||
## [1.27.7](https://github.com/certd/certd/compare/v1.27.6...v1.27.7) (2024-11-25)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@certd/ui-server",
|
||||
"version": "1.27.7",
|
||||
"version": "1.27.9",
|
||||
"description": "fast-server base midway",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
@@ -29,17 +29,17 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@alicloud/pop-core": "^1.7.10",
|
||||
"@certd/acme-client": "^1.27.7",
|
||||
"@certd/basic": "^1.27.7",
|
||||
"@certd/commercial-core": "^1.27.7",
|
||||
"@certd/lib-huawei": "^1.27.7",
|
||||
"@certd/lib-k8s": "^1.27.7",
|
||||
"@certd/lib-server": "^1.27.7",
|
||||
"@certd/midway-flyway-js": "^1.27.7",
|
||||
"@certd/pipeline": "^1.27.7",
|
||||
"@certd/plugin-cert": "^1.27.7",
|
||||
"@certd/plugin-plus": "^1.27.7",
|
||||
"@certd/plus-core": "^1.27.7",
|
||||
"@certd/acme-client": "^1.27.9",
|
||||
"@certd/basic": "^1.27.9",
|
||||
"@certd/commercial-core": "^1.27.9",
|
||||
"@certd/lib-huawei": "^1.27.9",
|
||||
"@certd/lib-k8s": "^1.27.9",
|
||||
"@certd/lib-server": "^1.27.9",
|
||||
"@certd/midway-flyway-js": "^1.27.9",
|
||||
"@certd/pipeline": "^1.27.9",
|
||||
"@certd/plugin-cert": "^1.27.9",
|
||||
"@certd/plugin-plus": "^1.27.9",
|
||||
"@certd/plus-core": "^1.27.9",
|
||||
"@huaweicloud/huaweicloud-sdk-cdn": "^3.1.120",
|
||||
"@huaweicloud/huaweicloud-sdk-core": "^3.1.120",
|
||||
"@koa/cors": "^5.0.0",
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from '@certd/pipeline';
|
||||
|
||||
@IsNotification({
|
||||
name: 'anpush',
|
||||
title: 'AnPush',
|
||||
desc: 'https://anpush.com',
|
||||
})
|
||||
export class AnPushNotification extends BaseNotification {
|
||||
@NotificationInput({
|
||||
title: 'API密钥',
|
||||
component: {
|
||||
placeholder: '',
|
||||
},
|
||||
helper: '[获取API密钥](https://anpush.com/push/tool) ',
|
||||
required: true,
|
||||
})
|
||||
token = '';
|
||||
|
||||
@NotificationInput({
|
||||
title: '通道ID',
|
||||
component: {
|
||||
placeholder: '',
|
||||
},
|
||||
helper: '[获取通道ID](https://anpush.com/push/setting)创建通道,复制通道id,填入此处',
|
||||
required: true,
|
||||
})
|
||||
channel = '';
|
||||
|
||||
async send(body: NotificationBody) {
|
||||
if (!this.token) {
|
||||
throw new Error('token不能为空');
|
||||
}
|
||||
const config = {
|
||||
url: `https://api.anpush.com/push/${this.token}`,
|
||||
method: 'POST',
|
||||
timeout: 0,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
data: {
|
||||
title: body.title,
|
||||
content: body.content + '[查看详情](' + body.url + ')',
|
||||
channel: this.channel,
|
||||
},
|
||||
};
|
||||
await this.http.request(config);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* curl -X "POST" "https://api.day.app/your_key" \
|
||||
* -H 'Content-Type: application/json; charset=utf-8' \
|
||||
* -d $'{
|
||||
* "body": "Test Bark Server",
|
||||
* "title": "Test Title",
|
||||
* "badge": 1,
|
||||
* "category": "myNotificationCategory",
|
||||
* "sound": "minuet.caf",
|
||||
* "icon": "https://day.app/assets/images/avatar.jpg",
|
||||
* "group": "test",
|
||||
* "url": "https://mritd.com"
|
||||
* }'
|
||||
*/
|
||||
|
||||
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from '@certd/pipeline';
|
||||
|
||||
@IsNotification({
|
||||
name: 'bark',
|
||||
title: 'Bark 通知',
|
||||
desc: 'Bark 推送通知插件',
|
||||
})
|
||||
export class BarkNotification extends BaseNotification {
|
||||
@NotificationInput({
|
||||
title: '服务地址',
|
||||
component: {
|
||||
placeholder: 'https://api.day.app/your_key',
|
||||
},
|
||||
required: true,
|
||||
helper: '你的bark服务地址+key',
|
||||
})
|
||||
webhook = '';
|
||||
async send(body: NotificationBody) {
|
||||
if (!this.webhook) {
|
||||
throw new Error('服务器地址不能为空');
|
||||
}
|
||||
|
||||
const payload = {
|
||||
body: body.content, // 使用传入的内容或默认内容
|
||||
title: body.title, // 使用传入的标题或默认标题
|
||||
};
|
||||
|
||||
await this.http.request({
|
||||
url: `${this.webhook}`,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json; charset=utf-8',
|
||||
},
|
||||
data: payload,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from '@certd/pipeline';
|
||||
|
||||
@IsNotification({
|
||||
name: 'discord',
|
||||
title: 'Discord 通知',
|
||||
desc: 'Discord 机器人通知',
|
||||
})
|
||||
export class DiscordNotification extends BaseNotification {
|
||||
@NotificationInput({
|
||||
title: 'Webhook URL',
|
||||
component: {
|
||||
placeholder: 'https://discord.com/api/webhooks/xxxxx/xxxx',
|
||||
},
|
||||
helper: '[Discord Webhook 说明](https://discord.com/developers/docs/resources/webhook#execute-webhook)',
|
||||
required: true,
|
||||
})
|
||||
webhook = '';
|
||||
|
||||
@NotificationInput({
|
||||
title: '提醒指定成员',
|
||||
component: {
|
||||
name: 'a-select',
|
||||
vModel: 'value',
|
||||
mode: 'tags',
|
||||
open: false,
|
||||
},
|
||||
required: false,
|
||||
helper: '填写成员的Id,或者角色Id(&id),或者everyone',
|
||||
})
|
||||
mentionedList!: string[];
|
||||
|
||||
async send(body: NotificationBody) {
|
||||
if (!this.webhook) {
|
||||
throw new Error('Webhook URL 不能为空');
|
||||
}
|
||||
|
||||
// 创建 Discord 消息体
|
||||
let content = `${body.title}\n${body.content}\n[查看详情](${body.url})`;
|
||||
if (this.mentionedList && this.mentionedList.length > 0) {
|
||||
content += `\n${this.mentionedList.map(item => `<@${item}> `).join('')}`;
|
||||
}
|
||||
|
||||
const json = {
|
||||
content: content,
|
||||
};
|
||||
|
||||
await this.http.request({
|
||||
url: this.webhook,
|
||||
method: 'POST',
|
||||
data: json,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ export class EmailNotification extends BaseNotification {
|
||||
await this.ctx.emailService.send({
|
||||
userId: body.userId,
|
||||
subject: body.title,
|
||||
content: body.content,
|
||||
content: body.content + '\n[查看详情](' + body.url + ')',
|
||||
receivers: this.receivers,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,2 +1,10 @@
|
||||
export * from './qywx/index.js';
|
||||
export * from './email/index.js';
|
||||
export * from './iyuu/index.js';
|
||||
export * from './webhook/index.js';
|
||||
export * from './serverchan/index.js';
|
||||
export * from './anpush/index.js';
|
||||
export * from './telegram/index.js';
|
||||
export * from './discord/index.js';
|
||||
export * from './slack/index.js';
|
||||
export * from './bark/index.js';
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from '@certd/pipeline';
|
||||
|
||||
@IsNotification({
|
||||
name: 'iyuu',
|
||||
title: '爱语飞飞微信通知(iyuu)',
|
||||
desc: 'https://iyuu.cn/',
|
||||
})
|
||||
export class IyuuNotification extends BaseNotification {
|
||||
@NotificationInput({
|
||||
title: 'Token令牌',
|
||||
component: {
|
||||
placeholder: '',
|
||||
},
|
||||
helper: 'https://iyuu.cn/ 微信扫码获取',
|
||||
required: true,
|
||||
})
|
||||
token = '';
|
||||
|
||||
async send(body: NotificationBody) {
|
||||
if (!this.token) {
|
||||
throw new Error('token不能为空');
|
||||
}
|
||||
const res = await this.http.request({
|
||||
url: `https://iyuu.cn/${this.token}.send`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
text: body.title,
|
||||
desp: body.content + '[查看详情](' + body.url + ')',
|
||||
},
|
||||
});
|
||||
|
||||
if (res.errcode !== 0) {
|
||||
throw new Error(res.errmsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from '@certd/pipeline';
|
||||
|
||||
@IsNotification({
|
||||
name: 'serverchan',
|
||||
title: 'Server酱',
|
||||
desc: 'https://sct.ftqq.com/',
|
||||
})
|
||||
export class ServerChanNotification extends BaseNotification {
|
||||
@NotificationInput({
|
||||
title: '服务地址',
|
||||
value: 'https://sctapi.ftqq.com',
|
||||
required: true,
|
||||
})
|
||||
endpoint = 'https://sctapi.ftqq.com';
|
||||
|
||||
@NotificationInput({
|
||||
title: 'SendKey',
|
||||
component: {
|
||||
placeholder: 'https://sctapi.ftqq.com/<SENDKEY>.send',
|
||||
},
|
||||
helper: 'https://sct.ftqq.com/ 微信扫码获取',
|
||||
required: true,
|
||||
})
|
||||
sendKey = '';
|
||||
|
||||
@NotificationInput({
|
||||
title: '消息通道号',
|
||||
component: {
|
||||
placeholder: '9|66',
|
||||
},
|
||||
helper: '可以不填,最多两个通道,[通道配置说明](https://sct.ftqq.com/sendkey)',
|
||||
required: false,
|
||||
})
|
||||
channel: string;
|
||||
|
||||
@NotificationInput({
|
||||
title: '是否隐藏IP',
|
||||
component: {
|
||||
name: 'a-switch',
|
||||
vModel: 'checked',
|
||||
},
|
||||
required: false,
|
||||
})
|
||||
noip: boolean;
|
||||
|
||||
async send(body: NotificationBody) {
|
||||
if (!this.sendKey) {
|
||||
throw new Error('sendKey不能为空');
|
||||
}
|
||||
await this.http.request({
|
||||
url: `${this.endpoint}/${this.sendKey}.send`,
|
||||
method: 'POST',
|
||||
data: {
|
||||
text: body.title,
|
||||
desp: body.content + '[查看详情](' + body.url + ')',
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from '@certd/pipeline';
|
||||
|
||||
@IsNotification({
|
||||
name: 'slack',
|
||||
title: 'Slack通知',
|
||||
desc: 'Slack消息推送通知',
|
||||
})
|
||||
export class SlackNotification extends BaseNotification {
|
||||
@NotificationInput({
|
||||
title: 'webhook地址',
|
||||
component: {
|
||||
placeholder: 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX',
|
||||
},
|
||||
helper: '[APPS](https://api.slack.com/apps/)->进入APP->incoming-webhooks->Add New Webhook to Workspace',
|
||||
required: true,
|
||||
})
|
||||
webhook = '';
|
||||
|
||||
async send(body: NotificationBody) {
|
||||
if (!this.webhook) {
|
||||
throw new Error('token不能为空');
|
||||
}
|
||||
|
||||
await this.http.request({
|
||||
url: this.webhook,
|
||||
method: 'POST',
|
||||
data: {
|
||||
text: `${body.title}\n${body.content}\n[查看详情](${body.url})`,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from '@certd/pipeline';
|
||||
|
||||
@IsNotification({
|
||||
name: 'telegram',
|
||||
title: 'Telegram通知',
|
||||
desc: 'Telegram Bot推送通知',
|
||||
})
|
||||
export class TelegramNotification extends BaseNotification {
|
||||
@NotificationInput({
|
||||
title: 'Bot Token',
|
||||
component: {
|
||||
placeholder: '123456789:ABCdefGhijklmnopqrstUVWXyz',
|
||||
},
|
||||
helper: '[token获取](https://core.telegram.org/bots/features#botfather)',
|
||||
required: true,
|
||||
})
|
||||
botToken = '';
|
||||
|
||||
@NotificationInput({
|
||||
title: '聊天ID',
|
||||
component: {
|
||||
placeholder: '聊天ID,例如 -123456789 或 @channelusername',
|
||||
},
|
||||
helper: '聊天的唯一标识符或用户名',
|
||||
required: true,
|
||||
})
|
||||
chatId = '';
|
||||
|
||||
async send(body: NotificationBody) {
|
||||
if (!this.botToken || !this.chatId) {
|
||||
throw new Error('Bot Token 和聊天ID不能为空');
|
||||
}
|
||||
|
||||
// 构建消息内容
|
||||
const messageContent = `*${body.title}*\n\n${body.content}\n[查看详情](${body.url})`;
|
||||
|
||||
// Telegram API URL
|
||||
const url = `https://api.telegram.org/bot${this.botToken}/sendMessage`;
|
||||
|
||||
// 发送 HTTP 请求
|
||||
await this.http.request({
|
||||
url: url,
|
||||
method: 'POST',
|
||||
data: {
|
||||
chat_id: this.chatId,
|
||||
text: messageContent,
|
||||
parse_mode: 'MarkdownV2', // 或使用 'HTML' 取决于需要的格式
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from '@certd/pipeline';
|
||||
|
||||
@IsNotification({
|
||||
name: 'vocechat',
|
||||
title: 'VoceChat通知',
|
||||
desc: 'https://voce.chat',
|
||||
})
|
||||
export class VoceChatNotification extends BaseNotification {
|
||||
@NotificationInput({
|
||||
title: '服务地址',
|
||||
component: {
|
||||
placeholder: 'https://replace.your.domain',
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
endpoint = '';
|
||||
|
||||
@NotificationInput({
|
||||
title: 'apiKey',
|
||||
component: {
|
||||
placeholder: '',
|
||||
},
|
||||
helper: '[获取APIKEY](https://doc.voce.chat/bot/bot-and-webhook)',
|
||||
required: true,
|
||||
})
|
||||
apiKey = '';
|
||||
|
||||
@NotificationInput({
|
||||
title: '目标类型',
|
||||
component: {
|
||||
name: 'a-select',
|
||||
options: [
|
||||
{ value: 'user', label: '用户' },
|
||||
{ value: 'channel', label: '频道' },
|
||||
],
|
||||
},
|
||||
required: true,
|
||||
helper: '发送消息的目标类型',
|
||||
})
|
||||
targetType = '';
|
||||
|
||||
@NotificationInput({
|
||||
title: '目标ID',
|
||||
component: {
|
||||
placeholder: '发送消息的目标ID',
|
||||
},
|
||||
required: true,
|
||||
helper: '目标ID可以是用户ID或频道ID',
|
||||
})
|
||||
targetId = '';
|
||||
|
||||
async send(body: NotificationBody) {
|
||||
if (!this.apiKey) {
|
||||
throw new Error('API Key不能为空');
|
||||
}
|
||||
|
||||
if (!this.targetId) {
|
||||
throw new Error('目标ID不能为空');
|
||||
}
|
||||
|
||||
const url = this.targetType === 'user' ? '/api/bot/send_to_user/' : '/api/bot/send_to_group/';
|
||||
await this.http.request({
|
||||
url: url + this.targetId, // 这是示例API URL,请根据实际API文档调整
|
||||
baseURL: this.endpoint,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'x-api-key': this.apiKey,
|
||||
'Content-Type': 'text/markdown',
|
||||
},
|
||||
data: `# ${body.title}\n\n${body.content}\n[查看详情](${body.url})`,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from '@certd/pipeline';
|
||||
|
||||
@IsNotification({
|
||||
name: 'webhook',
|
||||
title: '自定义webhook',
|
||||
desc: '根据模版自定义http请求',
|
||||
})
|
||||
export class WebhookNotification extends BaseNotification {
|
||||
@NotificationInput({
|
||||
title: 'webhook地址',
|
||||
component: {
|
||||
placeholder: '',
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
webhook = '';
|
||||
|
||||
@NotificationInput({
|
||||
title: '请求方式',
|
||||
value: 'post',
|
||||
component: {
|
||||
name: 'a-select',
|
||||
placeholder: 'post/put',
|
||||
options: [
|
||||
{ value: 'post', label: 'post' },
|
||||
{ value: 'put', label: 'put' },
|
||||
],
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
method = '';
|
||||
|
||||
@NotificationInput({
|
||||
title: 'ContentType',
|
||||
value: 'json',
|
||||
component: {
|
||||
name: 'a-select',
|
||||
options: [
|
||||
{ value: 'application/json', label: 'json' },
|
||||
{ value: 'application/x-www-form-urlencoded', label: 'x-www-form-urlencoded' },
|
||||
],
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
contentType = '';
|
||||
|
||||
@NotificationInput({
|
||||
title: 'Headers',
|
||||
component: {
|
||||
name: 'a-textarea',
|
||||
rows: 3,
|
||||
},
|
||||
helper: '一行一个,格式为key:value',
|
||||
required: true,
|
||||
})
|
||||
headers = '';
|
||||
|
||||
@NotificationInput({
|
||||
title: '消息body模版',
|
||||
value: `{
|
||||
"text":"{title}",
|
||||
"desp":"{content}\\n[查看详情]({url})"
|
||||
}`,
|
||||
component: {
|
||||
name: 'a-textarea',
|
||||
rows: 4,
|
||||
},
|
||||
col: {
|
||||
span: 24,
|
||||
},
|
||||
helper: `根据实际的webhook接口,构建一个json对象作为参数,支持变量:{title}、{content}、{url},变量用{}包裹,字符串需要双引号`,
|
||||
required: true,
|
||||
})
|
||||
template = '';
|
||||
|
||||
async send(body: NotificationBody) {
|
||||
if (!this.template) {
|
||||
throw new Error('模版不能为空');
|
||||
}
|
||||
|
||||
const bodyStr = this.template.replaceAll('{title}', body.title).replaceAll('{content}', body.content).replaceAll('{url}', body.url);
|
||||
|
||||
const data = JSON.parse(bodyStr);
|
||||
|
||||
const headers: any = {};
|
||||
this.headers.split('\n').forEach(item => {
|
||||
const [key, value] = item.trim().split(':');
|
||||
headers[key] = value;
|
||||
});
|
||||
await this.http.request({
|
||||
url: this.webhook,
|
||||
method: this.method,
|
||||
headers: {
|
||||
'Content-Type': `${this.contentType}; charset=UTF-8`,
|
||||
...headers,
|
||||
},
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user