Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(share): 404 not rendering in dev mode
Elian Doran4f103375b518
diff --git a/apps/server/src/share/content_renderer.ts b/apps/server/src/share/content_renderer.tsindex 60ff07967f..afdbc23422 100644--- a/apps/server/src/share/content_renderer.ts+++ b/apps/server/src/share/content_renderer.ts@@ -205,7 +205,7 @@ function renderNoteContentInternal(note: SNote | BNote, renderArgs: RenderArgs)});}-function getDefaultTemplatePath(template: string) {+export function getDefaultTemplatePath(template: string) {// Path is relative to apps/server/dist/assets/viewsreturn process.env.NODE_ENV === "development"? join(__dirname, `../../../../packages/share-theme/src/templates/${template}.ejs`)diff --git a/apps/server/src/share/routes.ts b/apps/server/src/share/routes.tsindex 275474c2d1..80544fd998 100644--- a/apps/server/src/share/routes.ts+++ b/apps/server/src/share/routes.ts@@ -8,7 +8,7 @@ import searchService from "../services/search/services/search.js";import SearchContext from "../services/search/search_context.js";import type SNote from "./shaca/entities/snote.js";import type SAttachment from "./shaca/entities/sattachment.js";-import { renderNoteContent } from "./content_renderer.js";+import { getDefaultTemplatePath, renderNoteContent } from "./content_renderer.js";import utils from "../services/utils.js";function addNoIndexHeader(note: SNote, res: Response) {@@ -110,7 +110,7 @@ function renderImageAttachment(image: SNote, res: Response, attachmentName: strifunction render404(res: Response) {res.status(404);- const shareThemePath = `../../share-theme/templates/404.ejs`;+ const shareThemePath = getDefaultTemplatePath("404");res.render(shareThemePath);}