fix: 上传商用证书,直接粘贴文本报错的问题;修复无法上传ec加密证书的bug

This commit is contained in:
xiaojunnuo
2025-04-19 15:00:34 +08:00
parent 0e07ae6ce8
commit 5750bb7067
6 changed files with 59 additions and 52 deletions

View File

@@ -1,7 +1,8 @@
import { Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
import {Body, Controller, Inject, Post, Provide, Query} from '@midwayjs/core';
import { PipelineService } from '../../../modules/pipeline/service/pipeline-service.js';
import { BaseController, Constants } from '@certd/lib-server';
import { StorageService } from '../../../modules/pipeline/service/storage-service.js';
import {CertReader} from "@certd/plugin-cert";
@Provide()
@Controller('/api/pi/cert')
@@ -18,4 +19,14 @@ export class CertController extends BaseController {
const privateVars = await this.storeService.getPipelinePrivateVars(id);
return this.ok(privateVars.cert);
}
@Post('/readCertDetail', { summary: Constants.per.authOnly })
async readCertDetail(@Body('crt') crt: string) {
if (!crt) {
throw new Error('crt is required');
}
const certDetail = CertReader.readCertDetail(crt)
return this.ok(certDetail);
}
}