change in referencing CSS resources to allow easier relative linking

This commit is contained in:
zadam 2019-01-27 22:34:41 +01:00
parent f90ed99a40
commit ba1ca506af
3 changed files with 4 additions and 2 deletions

View File

@ -81,7 +81,7 @@ window.onerror = function (msg, url, lineNo, columnNo, error) {
}; };
for (const appCssNoteId of window.appCssNoteIds) { 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/"; const wikiBaseUrl = "https://github.com/zadam/trilium/wiki/";

View File

@ -98,7 +98,7 @@ addTabHandler((function() {
if (noteId) { if (noteId) {
// make sure the CSS is loaded // make sure the CSS is loaded
// if the CSS has been loaded and then updated then the changes won't take effect though // 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); $body.addClass("theme-" + newTheme);

View File

@ -135,6 +135,8 @@ function register(app) {
filesRoute.uploadFile, apiResultHandler); filesRoute.uploadFile, apiResultHandler);
route(GET, '/api/notes/:noteId/download', [auth.checkApiAuthOrElectron], filesRoute.downloadFile); 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(GET, '/api/notes/:noteId/attributes', attributesRoute.getEffectiveNoteAttributes);
apiRoute(PUT, '/api/notes/:noteId/attributes', attributesRoute.updateNoteAttributes); apiRoute(PUT, '/api/notes/:noteId/attributes', attributesRoute.updateNoteAttributes);