This commit is contained in:
qq
2026-04-22 14:45:05 +08:00
parent 01cbdcd695
commit d8ceb298aa
10 changed files with 59 additions and 54 deletions
+6 -4
View File
@@ -26,11 +26,13 @@ class CommonCaptchaController {
this.captchaService = captchaService;
}
async getCaptcha(query) {
const type = query.type ?? 'text';
const size = query.size ?? 4;
const result = type === 'math'
? await this.captchaService.generateMath()
: await this.captchaService.generate({ size });
const color = query.color ?? '#028304';
const result = await this.captchaService.generate({
size,
noise: 4,
color,
});
return api_1.Api.success({
svg: result.svg,
key: result.key,