Merge pull request '合并arm-build-zw' (#142) from arm-build-zw into arm-build

This commit is contained in:
cp3hnu 2024-11-07 10:27:29 +08:00
commit c235dcb350
2 changed files with 35 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import FullScreenFrame from '@/components/FullScreenFrame';
import KFSpin from '@/components/KFSpin';
import { getLabelStudioUrl } from '@/services/developmentEnvironment';
import { generateSign } from '@/utils';
import { to } from '@/utils/promise';
import SessionStorage from '@/utils/sessionStorage';
import classNames from 'classnames';
@ -19,8 +20,18 @@ const getRequestAPI = (type: IframePageType): (() => Promise<any>) => {
switch (type) {
case IframePageType.DatasetAnnotation:
return getLabelStudioUrl;
case IframePageType.AppDevelopment:
return () => Promise.resolve({ code: 200, data: 'http://172.20.32.185:30080/' });
case IframePageType.AppDevelopment: {
// return () => Promise.resolve({ code: 200, data: 'http://172.20.32.185:30080/' });
const loginName = 'test3';
const sign = generateSign(loginName);
return () =>
Promise.resolve({
code: 200,
data: `http://10.43.107.27:24078/uap/nudt/sso/login?name=${loginName}&sign=${sign}`,
});
}
case IframePageType.DevEnv:
return () =>
Promise.resolve({

View File

@ -6,6 +6,7 @@
import { PageEnum } from '@/enums/pagesEnums';
import G6 from '@antv/g6';
import CryptoJS from 'crypto-js';
// 生成 8 位随机数
export function s8() {
@ -241,3 +242,24 @@ export const tableSorter = (a: any, b: any) => {
}
return 0;
};
// 生成火石平台 sign
export const generateSign = (loginName: string) => {
// 16-character custom password
const key = '8c4ddb8cb50ade0e';
const content = `${loginName}-${Math.floor(Date.now() / 1000)}`;
// Generate the AES key (16 bytes for AES-128 or 32 bytes for AES-256)
const byteKey = CryptoJS.enc.Utf8.parse(key);
// Encrypt the content
const encrypted = CryptoJS.AES.encrypt(content, byteKey, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7,
});
const encryptedHex = encrypted.ciphertext.toString(CryptoJS.enc.Hex);
return encryptedHex;
};