Skip to content

Commit

Permalink
✨ Feature(custom): remove sensitive info in reponse field
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuingsmile committed Oct 18, 2023
1 parent 0189715 commit d9f25ac
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/server/routerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ router.post('/upload', async ({
logger.info('[PicList Server] upload result:', res)
if (res) {
const treatedFullResult = {
isAESEncrypted: 1,
AESEncryptedData: new AESHelper().encrypt(JSON.stringify(fullResult)),
isEncrypted: 1,
EncryptedData: new AESHelper().encrypt(JSON.stringify(fullResult)),
...fullResult
}
delete treatedFullResult.config
Expand Down Expand Up @@ -115,8 +115,8 @@ router.post('/upload', async ({
})
const fullResult = result.map((item: any) => {
const treatedItem = {
isAESEncrypted: 1,
AESEncryptedData: new AESHelper().encrypt(JSON.stringify(item.fullResult)),
isEncrypted: 1,
EncryptedData: new AESHelper().encrypt(JSON.stringify(item.fullResult)),
...item.fullResult
}
delete treatedItem.config
Expand Down Expand Up @@ -176,11 +176,11 @@ router.post('/delete', async ({
return
}
try {
// 区分是否是aes加密的数据,如果不是直接传入list,如果是,解密后再传入
// 区分是否是加密的数据,如果不是直接传入list,如果是,解密后再传入
const treatList = list.map(item => {
if (item.isAESEncrypted) {
if (item.isEncrypted) {
const aesHelper = new AESHelper()
const data = aesHelper.decrypt(item.AESEncryptedData)
const data = aesHelper.decrypt(item.EncryptedData)
return JSON.parse(data)
} else {
return item
Expand Down

0 comments on commit d9f25ac

Please sign in to comment.