fix: 敏感字符增加传输加密 (#219)

1. 敏感字符增加传输加密
This commit is contained in:
ssongliu
2023-03-15 15:58:26 +08:00
committed by GitHub
parent fdf9215d43
commit 281d0cf880
11 changed files with 211 additions and 31 deletions

View File

@@ -1,4 +1,6 @@
import http from '@/api';
import { deepCopy } from '@/utils/util';
import { Base64 } from 'js-base64';
import { SearchWithPage, ResPage, DescriptionUpdate } from '../interface';
import { Database } from '../interface/database';
@@ -7,13 +9,21 @@ export const searchMysqlDBs = (params: SearchWithPage) => {
};
export const addMysqlDB = (params: Database.MysqlDBCreate) => {
return http.post(`/databases`, params);
let reqest = deepCopy(params) as Database.MysqlDBCreate;
if (reqest.password) {
reqest.password = Base64.encode(reqest.password);
}
return http.post(`/databases`, reqest);
};
export const updateMysqlAccess = (params: Database.ChangeInfo) => {
return http.post(`/databases/change/access`, params);
};
export const updateMysqlPassword = (params: Database.ChangeInfo) => {
return http.post(`/databases/change/password`, params);
let reqest = deepCopy(params) as Database.ChangeInfo;
if (reqest.value) {
reqest.value = Base64.encode(reqest.value);
}
return http.post(`/databases/change/password`, reqest);
};
export const updateMysqlDescription = (params: DescriptionUpdate) => {
return http.post(`/databases/description/update`, params);
@@ -58,7 +68,11 @@ export const redisPersistenceConf = () => {
return http.get<Database.RedisPersistenceConf>(`/databases/redis/persistence/conf`);
};
export const changeRedisPassword = (params: Database.ChangeInfo) => {
return http.post(`/databases/redis/password`, params);
let reqest = deepCopy(params) as Database.ChangeInfo;
if (reqest.value) {
reqest.value = Base64.encode(reqest.value);
}
return http.post(`/databases/redis/password`, reqest);
};
export const updateRedisPersistenceConf = (params: Database.RedisConfPersistenceUpdate) => {
return http.post(`/databases/redis/persistence/update`, params);