mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
make sure entity IDs are generated only with alphanumeric characters (base62)
This commit is contained in:
parent
372cce8f8e
commit
f55f0a4ed3
7
package-lock.json
generated
7
package-lock.json
generated
@ -2590,7 +2590,7 @@
|
|||||||
},
|
},
|
||||||
"fs-extra": {
|
"fs-extra": {
|
||||||
"version": "0.30.0",
|
"version": "0.30.0",
|
||||||
"resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz",
|
||||||
"integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=",
|
"integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"graceful-fs": "4.1.11",
|
"graceful-fs": "4.1.11",
|
||||||
@ -6650,6 +6650,11 @@
|
|||||||
"strict-uri-encode": "1.1.0"
|
"strict-uri-encode": "1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"rand-token": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/rand-token/-/rand-token-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-FLNNsir2R+XY8LKsZ+8u/w0qZ4sGit7cpNdznsI77cAVob6UlVPueDKRyjJ3W1Q6FJLgAVH98JvlqqpSaL7NEQ=="
|
||||||
|
},
|
||||||
"random-bytes": {
|
"random-bytes": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz",
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
"helmet": "^3.9.0",
|
"helmet": "^3.9.0",
|
||||||
"html": "^1.0.0",
|
"html": "^1.0.0",
|
||||||
"ini": "^1.3.4",
|
"ini": "^1.3.4",
|
||||||
|
"rand-token": "^0.4.0",
|
||||||
"request": "^2.83.0",
|
"request": "^2.83.0",
|
||||||
"request-promise": "^4.2.2",
|
"request-promise": "^4.2.2",
|
||||||
"rimraf": "^2.6.2",
|
"rimraf": "^2.6.2",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const messaging = (function() {
|
const messaging = (function() {
|
||||||
|
const changesToPushCountEl = $("#changes-to-push-count");
|
||||||
let ws = null;
|
let ws = null;
|
||||||
|
|
||||||
function logError(message) {
|
function logError(message) {
|
||||||
@ -39,7 +40,6 @@ const messaging = (function() {
|
|||||||
recentNotes.reload();
|
recentNotes.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
const changesToPushCountEl = $("#changesToPushCount");
|
|
||||||
changesToPushCountEl.html(message.changesToPushCount);
|
changesToPushCountEl.html(message.changesToPushCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -502,7 +502,7 @@ const noteTree = (function() {
|
|||||||
startNotePath = document.location.hash.substr(1); // strip initial #
|
startNotePath = document.location.hash.substr(1); // strip initial #
|
||||||
}
|
}
|
||||||
|
|
||||||
return prepareNoteTree(resp.notes, resp.notes_parent);
|
return prepareNoteTree(resp.notes);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
|
const randtoken = require('rand-token').generator({source: 'crypto'});
|
||||||
|
|
||||||
function newNoteId() {
|
function newNoteId() {
|
||||||
return randomString(12);
|
return randomString(12);
|
||||||
@ -15,9 +16,7 @@ function newNoteHistoryId() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function randomString(length) {
|
function randomString(length) {
|
||||||
const token = randomSecureToken(32);
|
return randtoken.generate(length);
|
||||||
|
|
||||||
return token.substr(0, length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function randomSecureToken(bytes = 32) {
|
function randomSecureToken(bytes = 32) {
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button class="btn btn-xs" onclick="syncNow();">Sync now (<span id="changesToPushCount">0</span>)</button>
|
<button class="btn btn-xs" onclick="syncNow();">Sync now (<span id="changes-to-push-count">0</span>)</button>
|
||||||
|
|
||||||
<button class="btn btn-xs" onclick="settings.showDialog();">Settings</button>
|
<button class="btn btn-xs" onclick="settings.showDialog();">Settings</button>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user