diff --git a/public/javascripts/note_tree.js b/public/javascripts/note_tree.js index 08ecc7987..7267949e0 100644 --- a/public/javascripts/note_tree.js +++ b/public/javascripts/note_tree.js @@ -304,9 +304,6 @@ const noteTree = (function() { let parentNoteId = 'root'; - console.log('notePath: ' + notePath); - console.log('notePath chunks: ', notePath.split('/')); - for (const noteId of notePath.split('/')) { console.log('noteId: ' + noteId); @@ -315,8 +312,6 @@ const noteTree = (function() { parentNoteId = noteId; } - console.log("Title path:", titlePath.join(' / ')); - return titlePath.join(' / '); } diff --git a/services/utils.js b/services/utils.js index d0979dc12..28d4acaf1 100644 --- a/services/utils.js +++ b/services/utils.js @@ -3,7 +3,7 @@ const crypto = require('crypto'); function newNoteId() { - return randomString(8); + return randomString(12); } function newNoteTreeId() { @@ -14,16 +14,10 @@ function newNoteHistoryId() { return randomString(12); } -const ALPHA_NUMERIC = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - function randomString(length) { - let result = ''; + const token = randomSecureToken(32); - for (let i = length; i > 0; --i) { - result += ALPHA_NUMERIC[Math.floor(Math.random() * ALPHA_NUMERIC.length)]; - } - - return result; + return token.substr(0, length); } function randomSecureToken(bytes = 32) {