fix(share): 404 not rendering in dev mode

This commit is contained in:
Elian Doran 2025-10-29 20:20:35 +02:00
parent 496091677b
commit 4f103375b5
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View File

@ -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`)

View File

@ -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);
}