Skip to content

Build your personal knowledge base with Trilium Notes

fix export in electron (auth problem)

azivneree0833390a81
diff --git a/src/public/javascripts/export.js b/src/public/javascripts/export.js
index 33b498b99f..68fb053e41 100644
--- a/src/public/javascripts/export.js
+++ b/src/public/javascripts/export.js
@@ -1,7 +1,8 @@
"use strict";
function exportSubTree(noteId) {
- const url = getHost() + "/api/export/" + noteId;
+ const url = getHost() + "/api/export/" + noteId + "?protectedSessionId="
+ + encodeURIComponent(protected_session.getProtectedSessionId());
download(url);
}
diff --git a/src/routes/api/export.js b/src/routes/api/export.js
index 47b2413617..49bb74fc5c 100644
--- a/src/routes/api/export.js
+++ b/src/routes/api/export.js
@@ -10,7 +10,7 @@ const wrap = require('express-promise-wrap').wrap;
const tar = require('tar-stream');
const sanitize = require("sanitize-filename");
-router.get('/:noteId/', auth.checkApiAuth, wrap(async (req, res, next) => {
+router.get('/:noteId/', auth.checkApiAuthOrElectron, wrap(async (req, res, next) => {
const noteId = req.params.noteId;
const noteTreeId = await sql.getValue('SELECT noteTreeId FROM note_tree WHERE noteId = ?', [noteId]);