mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Revamp array filtering
Replaced fakeMd5 with new Jua.randomId Cleanup more code
This commit is contained in:
parent
9992b20163
commit
c3a2da65df
23 changed files with 130 additions and 289 deletions
14
vendors/jua/jua.js
vendored
14
vendors/jua/jua.js
vendored
|
|
@ -488,13 +488,7 @@
|
|||
*/
|
||||
addNewFile(oFileInfo)
|
||||
{
|
||||
let iLen = 16,
|
||||
fakeMd5 = '';
|
||||
|
||||
while (iLen--)
|
||||
fakeMd5 += '0123456789abcdefghijklmnopqrstuvwxyz'.substr(Math.round(Math.random() * 36), 1);
|
||||
|
||||
this.addFile('jua-uid-' + fakeMd5 + '-' + (Date.now().toString()), oFileInfo);
|
||||
this.addFile('jua-uid-' + Jua.randomId(16) + '-' + (Date.now().toString()), oFileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -516,6 +510,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
Jua.randomId = len => {
|
||||
let arr = new Uint8Array((len || 32) / 2);
|
||||
crypto.getRandomValues(arr);
|
||||
return arr.map(dec => dec.toString(16).padStart(2,'0')).join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue