Revert to use crypto module on the server code, fix couple of minor code issues

This commit is contained in:
ivanThePleasant 2022-10-25 16:42:47 +03:00
parent 5620b25138
commit 16c0e79557
3 changed files with 4 additions and 7 deletions

View File

@ -1,14 +1,12 @@
'use strict';
const hash = require('hash.js');
const crypto = require('crypto');
const generateAdminUserHash = (ctx) => {
if (!ctx?.state?.user) return '';
try {
return hash.sha256().update(ctx.state.user.email).digest('hex');
} catch (error) {
if (!ctx?.state?.user) {
return '';
}
return crypto.createHash('sha256').update(ctx.state.user.email).digest('hex');
};
module.exports = {

View File

@ -106,7 +106,6 @@
"execa": "5.1.1",
"fs-extra": "10.0.0",
"glob": "7.2.0",
"hash.js": "1.1.7",
"http-errors": "1.8.1",
"inquirer": "8.2.4",
"is-docker": "2.2.1",

View File

@ -40,7 +40,7 @@ module.exports = {
if (deletedFiles.length + deletedFolders.length > 1) {
strapi.telemetry.send('didBulkDeleteMediaLibraryElements', {
groupProperties: {
eventProperties: {
rootFolderNumber: deletedFolders.length,
rootAssetNumber: deletedFiles.length,
totalFolderNumber,