mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
fix password protected notes rejection
This commit is contained in:
parent
46deceedc9
commit
e5fdd5128a
1
package-lock.json
generated
1
package-lock.json
generated
@ -5,6 +5,7 @@
|
|||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
|
"name": "trilium",
|
||||||
"version": "0.53.2",
|
"version": "0.53.2",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
|
@ -30,7 +30,7 @@ function addNoIndexHeader(note, res) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function reject(res) {
|
function requestCredentials(res) {
|
||||||
res.setHeader('WWW-Authenticate', 'Basic realm="User Visible Realm", charset="UTF-8"')
|
res.setHeader('WWW-Authenticate', 'Basic realm="User Visible Realm", charset="UTF-8"')
|
||||||
.sendStatus(401);
|
.sendStatus(401);
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ function checkNoteAccess(noteId, req, res) {
|
|||||||
const header = req.header("Authorization");
|
const header = req.header("Authorization");
|
||||||
|
|
||||||
if (!header?.startsWith("Basic ")) {
|
if (!header?.startsWith("Basic ")) {
|
||||||
reject(res);
|
requestCredentials(res);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +80,8 @@ function register(router) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!checkNoteAccess(note.noteId, req, res)) {
|
if (!checkNoteAccess(note.noteId, req, res)) {
|
||||||
|
requestCredentials(res);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user