From 50f92f55e2865c4e3409dd1bc951a218f6cbe6e5 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Sat, 13 Sep 2025 16:27:20 +0800 Subject: [PATCH] chore: --- .../ui/certd-client/src/store/plugin/index.ts | 2 +- .../plugins/plugin-captcha/geetest/index.ts | 2 +- .../src/plugins/plugin-captcha/image/index.ts | 50 +++++++++++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 packages/ui/certd-server/src/plugins/plugin-captcha/image/index.ts diff --git a/packages/ui/certd-client/src/store/plugin/index.ts b/packages/ui/certd-client/src/store/plugin/index.ts index 6ecb356e..7f0880ee 100644 --- a/packages/ui/certd-client/src/store/plugin/index.ts +++ b/packages/ui/certd-client/src/store/plugin/index.ts @@ -167,7 +167,7 @@ export const usePluginStore = defineStore({ }, async clear() { this.group = null; - this.originGroup = null + this.originGroup = null; }, async getList(): Promise { await this.init(); diff --git a/packages/ui/certd-server/src/plugins/plugin-captcha/geetest/index.ts b/packages/ui/certd-server/src/plugins/plugin-captcha/geetest/index.ts index 1e1cb999..60f99d2d 100644 --- a/packages/ui/certd-server/src/plugins/plugin-captcha/geetest/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-captcha/geetest/index.ts @@ -1,4 +1,4 @@ -import { AddonInput, BaseAddon, IsAddon } from "@certd/lib-server/dist/user/addon/api/index.js"; +import { AddonInput, BaseAddon, IsAddon } from "@certd/lib-server"; import crypto from 'crypto'; import { ICaptchaAddon } from "../api.js"; @IsAddon({ diff --git a/packages/ui/certd-server/src/plugins/plugin-captcha/image/index.ts b/packages/ui/certd-server/src/plugins/plugin-captcha/image/index.ts new file mode 100644 index 00000000..c7f3ddf3 --- /dev/null +++ b/packages/ui/certd-server/src/plugins/plugin-captcha/image/index.ts @@ -0,0 +1,50 @@ +import { AddonInput, BaseAddon, IsAddon } from "@certd/lib-server"; +import crypto from 'crypto'; +import { ICaptchaAddon } from "../api.js"; +@IsAddon({ + addonType:"captcha", + name: 'image', + title: '图片验证码', + desc: '', +}) +export class ImageCaptcha extends BaseAddon implements ICaptchaAddon{ + + + + + async onValidate(data?:any) { + + + } + + // 生成签名 +// Generate signature + hmac_sha256_encode(value, key){ + var hash = crypto.createHmac("sha256", key) + .update(value, 'utf8') + .digest('hex'); + return hash; + } + + +// 发送post请求, 响应json数据如:{"result": "success", "reason": "", "captcha_args": {}} +// Send a post request and respond to JSON data, such as: {result ":" success "," reason ":" "," captcha_args ": {}} + async doRequest(datas, url){ + var options = { + url: url, + method: "POST", + params: datas, + timeout: 5000 + }; + const result = await this.ctx.http.request(options); + return result; + } + + async getClientParams(): Promise { + return { + captchaId: this.captchaId, + } + } + + +}