mirror of https://github.com/certd/certd
chore:
parent
87620b9072
commit
93b37a89c9
|
@ -4,6 +4,8 @@ import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq,
|
||||||
import { pipelineGroupApi } from "./api";
|
import { pipelineGroupApi } from "./api";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { Modal } from "ant-design-vue";
|
import { Modal } from "ant-design-vue";
|
||||||
|
import CertView from "/@/views/certd/pipeline/cert-view.vue";
|
||||||
|
import { useModal } from "/@/use/use-modal";
|
||||||
|
|
||||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -27,7 +29,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||||
const res = await api.AddObj(form);
|
const res = await api.AddObj(form);
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
const model = useModal();
|
||||||
return {
|
return {
|
||||||
crudOptions: {
|
crudOptions: {
|
||||||
request: {
|
request: {
|
||||||
|
@ -83,13 +85,19 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||||
text: "测试ApiToken",
|
text: "测试ApiToken",
|
||||||
async click({ row }) {
|
async click({ row }) {
|
||||||
const apiToken = await api.GetApiToken(row.id);
|
const apiToken = await api.GetApiToken(row.id);
|
||||||
Modal.info({
|
|
||||||
|
model.success({
|
||||||
title: "ApiToken",
|
title: "ApiToken",
|
||||||
|
maskClosable: true,
|
||||||
|
okText: "确定",
|
||||||
|
width: 600,
|
||||||
content: () => {
|
content: () => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div>测试ApiKey如下,您可以在3分钟内使用它进行开放接口请求测试</div>
|
<div class={"m-10 p-10"}>测试ApiKey如下,您可以在3分钟内使用它进行开放接口请求测试</div>
|
||||||
<div>{apiToken}</div>
|
<div class={"m-10 p-10"} style={{ border: "1px solid #333" }}>
|
||||||
|
<fs-copyable model-value={apiToken}></fs-copyable>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ export class OpenKeyService extends BaseService<OpenKeyEntity> {
|
||||||
} else {
|
} else {
|
||||||
throw new CodeException(Constants.res.openKeySignTypeError);
|
throw new CodeException(Constants.res.openKeySignTypeError);
|
||||||
}
|
}
|
||||||
if (computedSign !== sign) {
|
if (Buffer.from(computedSign).toString('base64') !== sign) {
|
||||||
throw new CodeException(Constants.res.openKeySignError);
|
throw new CodeException(Constants.res.openKeySignError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +101,6 @@ export class OpenKeyService extends BaseService<OpenKeyEntity> {
|
||||||
};
|
};
|
||||||
const content = JSON.stringify(openKey);
|
const content = JSON.stringify(openKey);
|
||||||
const sign = utils.hash.md5(content + keySecret);
|
const sign = utils.hash.md5(content + keySecret);
|
||||||
return Buffer.from(content).toString('base64') + '.' + sign;
|
return Buffer.from(content).toString('base64') + '.' + Buffer.from(sign).toString('base64');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue