Merge branch 'v2-dev' of https://github.com/certd/certd into v2-dev

This commit is contained in:
xiaojunnuo
2026-03-17 23:33:18 +08:00
8 changed files with 90 additions and 39 deletions

View File

@@ -43,6 +43,7 @@ export function createRemoteSelectInputDefine(opts?: {
pager?: boolean;
component?: any;
value?: any;
pageSize?: number;
}) {
const title = opts?.title || "请选择";
const certDomainsInputKey = opts?.certDomainsInputKey || "certDomains";
@@ -71,6 +72,7 @@ export function createRemoteSelectInputDefine(opts?: {
search,
pager,
multi,
pageSize: opts?.pageSize,
watches: [certDomainsInputKey, accessIdInputKey, ...watches],
...opts.component,
},

View File

@@ -64,6 +64,7 @@ const props = defineProps<
search?: boolean;
pager?: boolean;
multi?: boolean;
pageSize?: number;
} & ComponentPropsType
>();
@@ -103,7 +104,7 @@ const loading = ref(false);
const pagerRef: Ref = ref({
pageNo: 1,
total: 0,
pageSize: 100,
pageSize: props.pageSize || 100,
});
const getOptions = async () => {
if (loading.value) {

View File

@@ -278,20 +278,22 @@ async function doRegisterPasskey(deviceName: string) {
// type: "public-key",
// }));
const credential = await (navigator.credentials as any).create({
publicKey: {
challenge: Uint8Array.from(atob(options.challenge.replace(/-/g, "+").replace(/_/g, "/")), c => c.charCodeAt(0)),
rp: options.rp,
pubKeyCredParams: options.pubKeyCredParams,
timeout: options.timeout || 60000,
attestation: options.attestation,
// excludeCredentials: excludeCredentials,
user: {
id: new TextEncoder().encode(options.userId + ""),
name: userInfo.value.username,
displayName: deviceName,
},
const publicKey = {
challenge: Uint8Array.from(atob(options.challenge.replace(/-/g, "+").replace(/_/g, "/")), c => c.charCodeAt(0)),
rp: options.rp,
pubKeyCredParams: options.pubKeyCredParams,
timeout: options.timeout || 60000,
attestation: options.attestation,
// excludeCredentials: excludeCredentials,
user: {
id: new TextEncoder().encode(options.userId + ""),
name: userInfo.value.username,
displayName: deviceName,
},
};
console.log("passkey register publicKey:", publicKey);
const credential = await (navigator.credentials as any).create({
publicKey,
});
if (!credential) {

View File

@@ -100,7 +100,10 @@ function formatDate(dateStr: string): string {
.cert-detail {
table {
width: 100%;
table-layout: fixed;
table-layout: fixed !important;
}
.ant-descriptions-item-label {
width: 90px;
}
.fingerprint {
.label {

View File

@@ -6,6 +6,7 @@ import { SiteInfoService } from '../../../modules/monitor/index.js';
import { HistoryService } from '../../../modules/pipeline/service/history-service.js';
import { PipelineService } from '../../../modules/pipeline/service/pipeline-service.js';
import { AuthService } from '../../../modules/sys/authority/service/auth-service.js';
import { PipelineEntity } from '../../../modules/pipeline/entity/pipeline.js';
const pipelineExample = `
@@ -183,21 +184,15 @@ export class PipelineController extends CrudController<PipelineService> {
}
// @Post('/add', { description: Constants.per.authOnly })
// async add(@Body(ALL) bean: PipelineEntity) {
// const { projectId, userId } = await this.getProjectUserIdWrite()
// bean.userId = userId
// bean.projectId = projectId
// return super.add(bean);
// }
@Post('/add', { description: Constants.per.authOnly })
async add(@Body(ALL) bean: PipelineEntity) {
return await this.save(bean as any);
}
// @Post('/update', { description: Constants.per.authOnly })
// async update(@Body(ALL) bean) {
// await this.checkOwner(this.getService(), bean.id,"write",true);
// delete bean.userId;
// delete bean.projectId;
// return super.update(bean);
// }
@Post('/update', { description: Constants.per.authOnly })
async update(@Body(ALL) bean) {
return await this.save(bean);
}
@Post('/save', { description: Constants.per.authOnly, summary: '新增/更新流水线' })
async save(@Body() bean: PipelineSaveDTO) {

View File

@@ -1,4 +1,4 @@
import { cache } from "@certd/basic";
import { cache, logger } from "@certd/basic";
import { AuthException, BaseService, SysInstallInfo, SysSettingsService, SysSiteInfo } from "@certd/lib-server";
import { isComm } from "@certd/plus-core";
import { Inject, Provide, Scope, ScopeEnum } from "@midwayjs/core";
@@ -54,14 +54,14 @@ export class PasskeyService extends BaseService<PasskeyEntity> {
const options = await generateRegistrationOptions({
rpName: rpName,
rpID: rpId,
userID: new Uint8Array([userId]),
userID: new TextEncoder().encode(userId + ""),
userName: username,
userDisplayName: user.nickName || username,
timeout: 60000,
attestationType: "none",
excludeCredentials: [],
});
logger.info('[passkey] 注册选项:', JSON.stringify(options));
cache.set(`passkey:registration:${options.challenge}`, userId, {
ttl: 5 * 60 * 1000,
});
@@ -86,16 +86,24 @@ export class PasskeyService extends BaseService<PasskeyEntity> {
const { rpId, origin } = await this.getRpInfo();
const verification = await verifyRegistrationResponse({
let verification: any = null;
const verifyReq = {
response,
expectedChallenge: challenge,
expectedOrigin: origin,
expectedRPID: rpId,
});
};
try {
verification = await verifyRegistrationResponse(verifyReq);
} catch (error) {
// 后端验证时
logger.error('[passkey] 注册验证失败:', JSON.stringify(verifyReq));
throw new AuthException(`注册验证失败:${error.message || error}`);
}
if (!verification.verified) {
throw new AuthException("注册验证失败");
}
cache.delete(`passkey:registration:${challenge}`);

View File

@@ -20,6 +20,7 @@ export abstract class CertApplyBasePlugin extends CertApplyBaseConvertPlugin {
@TaskInput({
title: "更新天数",
value:20,
component: {
name: "a-input-number",
vModel: "value",

View File

@@ -28,11 +28,36 @@ export class CertApplyGetFormAliyunPlugin extends CertApplyBasePlugin {
})
accessId!: string;
@TaskInput(
{
title:"订单类型",
value:"CPACK",
component:{
name:"a-select",
vModel:"value",
options:[
{
label:"资源虚拟订单(一般选这个)",
value:"CPACK",
},
{
label:"售卖订单",
value:"BUY",
}
]
}
}
)
orderType!: string;
@TaskInput(
createRemoteSelectInputDefine({
title: "证书订单ID",
helper: "订阅模式的证书订单Id",
typeName: "CertApplyGetFormAliyun",
pageSize: 50,
component: {
name: "RemoteSelect",
vModel: "value",
@@ -140,6 +165,7 @@ export class CertApplyGetFormAliyunPlugin extends CertApplyBasePlugin {
pathname: `/`,
data: {
query: {
OrderType: this.orderType,
Status: "ISSUED",
CurrentPage: pager.pageNo,
ShowSize : pager.pageSize,
@@ -151,14 +177,27 @@ export class CertApplyGetFormAliyunPlugin extends CertApplyBasePlugin {
return []
}
return list.map((item: any) => {
const label = `${item.Domain}<${item.OrderId}>`;
const total = res.TotalCount || 0;
const records = list.map((item: any) => {
let value = item.OrderId;
let domain = item.Domain;
let label = `${item.Domain}<${item.OrderId}>`;
if (!item.OrderId) {
label = `${item.CommonName}<${item.Name}>`;
value = item.Name;
domain = item.CommonName;
}
return {
label: label,
value: item.OrderId,
Domain: item.Domain,
value: value,
Domain: domain,
};
});
return {
list:records,
total,
}
}
}