mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 03:46:37 +01:00
enex import recognizes images, media references are converted to links
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
const crypto = require('crypto');
|
||||
const randtoken = require('rand-token').generator({source: 'crypto'});
|
||||
const unescape = require('unescape');
|
||||
const escape = require('escape-html');
|
||||
|
||||
function newEntityId() {
|
||||
return randomString(12);
|
||||
@@ -16,6 +17,10 @@ function randomSecureToken(bytes = 32) {
|
||||
return crypto.randomBytes(bytes).toString('base64');
|
||||
}
|
||||
|
||||
function md5(content) {
|
||||
return crypto.createHash('md5').update(content).digest('hex');
|
||||
}
|
||||
|
||||
function toBase64(plainText) {
|
||||
return Buffer.from(plainText).toString('base64');
|
||||
}
|
||||
@@ -59,6 +64,10 @@ async function stopWatch(what, func) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
function escapeHtml(str) {
|
||||
return escape(str);
|
||||
}
|
||||
|
||||
function unescapeHtml(str) {
|
||||
return unescape(str);
|
||||
}
|
||||
@@ -108,6 +117,7 @@ function union(a, b) {
|
||||
module.exports = {
|
||||
randomSecureToken,
|
||||
randomString,
|
||||
md5,
|
||||
newEntityId,
|
||||
toBase64,
|
||||
fromBase64,
|
||||
@@ -117,6 +127,7 @@ module.exports = {
|
||||
isEmptyOrWhitespace,
|
||||
sanitizeSql,
|
||||
stopWatch,
|
||||
escapeHtml,
|
||||
unescapeHtml,
|
||||
toObject,
|
||||
stripTags,
|
||||
|
||||
Reference in New Issue
Block a user