From ba1ca506af1a8fb619494823d9daae138393bf82 Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 27 Jan 2019 22:34:41 +0100 Subject: [PATCH] change in referencing CSS resources to allow easier relative linking --- src/public/javascripts/desktop.js | 2 +- src/public/javascripts/dialogs/options.js | 2 +- src/routes/routes.js | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/public/javascripts/desktop.js b/src/public/javascripts/desktop.js index f9142eb02..50697abb9 100644 --- a/src/public/javascripts/desktop.js +++ b/src/public/javascripts/desktop.js @@ -81,7 +81,7 @@ window.onerror = function (msg, url, lineNo, columnNo, error) { }; for (const appCssNoteId of window.appCssNoteIds) { - cssLoader.requireCss(`/api/notes/${appCssNoteId}/download`); + cssLoader.requireCss(`/api/notes/download/${appCssNoteId}`); } const wikiBaseUrl = "https://github.com/zadam/trilium/wiki/"; diff --git a/src/public/javascripts/dialogs/options.js b/src/public/javascripts/dialogs/options.js index c84bb3074..5d5f4fbc1 100644 --- a/src/public/javascripts/dialogs/options.js +++ b/src/public/javascripts/dialogs/options.js @@ -98,7 +98,7 @@ addTabHandler((function() { if (noteId) { // make sure the CSS is loaded // if the CSS has been loaded and then updated then the changes won't take effect though - cssLoader.requireCss(`/api/notes/${noteId}/download`); + cssLoader.requireCss(`/api/notes/download/${noteId}`); } $body.addClass("theme-" + newTheme); diff --git a/src/routes/routes.js b/src/routes/routes.js index 22c96f7a1..4c499e73a 100644 --- a/src/routes/routes.js +++ b/src/routes/routes.js @@ -135,6 +135,8 @@ function register(app) { filesRoute.uploadFile, apiResultHandler); route(GET, '/api/notes/:noteId/download', [auth.checkApiAuthOrElectron], filesRoute.downloadFile); + // this "hacky" path is used for easier referencing of CSS resources + route(GET, '/api/notes/download/:noteId', [auth.checkApiAuthOrElectron], filesRoute.downloadFile); apiRoute(GET, '/api/notes/:noteId/attributes', attributesRoute.getEffectiveNoteAttributes); apiRoute(PUT, '/api/notes/:noteId/attributes', attributesRoute.updateNoteAttributes);