From ee0833390a8114732423b48edeb7107f944814ce Mon Sep 17 00:00:00 2001 From: azivner Date: Tue, 27 Feb 2018 09:47:05 -0500 Subject: [PATCH] fix export in electron (auth problem) --- src/public/javascripts/export.js | 3 ++- src/routes/api/export.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/public/javascripts/export.js b/src/public/javascripts/export.js index 33b498b99..68fb053e4 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 47b241361..49bb74fc5 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]);