mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-09-06 07:56:56 +08:00
✨ Feature(custom): remove sensitive info in reponse field
This commit is contained in:
@@ -78,8 +78,8 @@ router.post('/upload', async ({
|
|||||||
logger.info('[PicList Server] upload result:', res)
|
logger.info('[PicList Server] upload result:', res)
|
||||||
if (res) {
|
if (res) {
|
||||||
const treatedFullResult = {
|
const treatedFullResult = {
|
||||||
isAESEncrypted: 1,
|
isEncrypted: 1,
|
||||||
AESEncryptedData: new AESHelper().encrypt(JSON.stringify(fullResult)),
|
EncryptedData: new AESHelper().encrypt(JSON.stringify(fullResult)),
|
||||||
...fullResult
|
...fullResult
|
||||||
}
|
}
|
||||||
delete treatedFullResult.config
|
delete treatedFullResult.config
|
||||||
@@ -115,8 +115,8 @@ router.post('/upload', async ({
|
|||||||
})
|
})
|
||||||
const fullResult = result.map((item: any) => {
|
const fullResult = result.map((item: any) => {
|
||||||
const treatedItem = {
|
const treatedItem = {
|
||||||
isAESEncrypted: 1,
|
isEncrypted: 1,
|
||||||
AESEncryptedData: new AESHelper().encrypt(JSON.stringify(item.fullResult)),
|
EncryptedData: new AESHelper().encrypt(JSON.stringify(item.fullResult)),
|
||||||
...item.fullResult
|
...item.fullResult
|
||||||
}
|
}
|
||||||
delete treatedItem.config
|
delete treatedItem.config
|
||||||
@@ -176,11 +176,11 @@ router.post('/delete', async ({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// 区分是否是aes加密的数据,如果不是直接传入list,如果是,解密后再传入
|
// 区分是否是加密的数据,如果不是直接传入list,如果是,解密后再传入
|
||||||
const treatList = list.map(item => {
|
const treatList = list.map(item => {
|
||||||
if (item.isAESEncrypted) {
|
if (item.isEncrypted) {
|
||||||
const aesHelper = new AESHelper()
|
const aesHelper = new AESHelper()
|
||||||
const data = aesHelper.decrypt(item.AESEncryptedData)
|
const data = aesHelper.decrypt(item.EncryptedData)
|
||||||
return JSON.parse(data)
|
return JSON.parse(data)
|
||||||
} else {
|
} else {
|
||||||
return item
|
return item
|
||||||
|
|||||||
Reference in New Issue
Block a user