From 4f103375b5180f20075d192e39dddc8c2e537874 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 29 Oct 2025 20:20:35 +0200 Subject: [PATCH] fix(share): 404 not rendering in dev mode --- apps/server/src/share/content_renderer.ts | 2 +- apps/server/src/share/routes.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/server/src/share/content_renderer.ts b/apps/server/src/share/content_renderer.ts index 60ff07967..afdbc2342 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/views return 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.ts index 275474c2d..80544fd99 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: stri function render404(res: Response) { res.status(404); - const shareThemePath = `../../share-theme/templates/404.ejs`; + const shareThemePath = getDefaultTemplatePath("404"); res.render(shareThemePath); }