ok lot of smtp minors

This commit is contained in:
lesion
2021-10-18 15:46:38 +02:00
parent 858d6b31c8
commit b63f22fd31
8 changed files with 76 additions and 35 deletions

View File

@@ -47,6 +47,14 @@ domPurify.addHook('beforeSanitizeElements', node => {
})
module.exports = {
randomString (length = 12) {
const wishlist = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
return Array.from(crypto.randomFillSync(new Uint32Array(length)))
.map(x => wishlist[x % wishlist.length])
.join('')
},
sanitizeHTML (html) {
return domPurify.sanitize(html, {
ALLOWED_TAGS: ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'br',