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(server): some assets not served properly
Elian Dorandd73517e7f6e
diff --git a/apps/server/src/routes/assets.ts b/apps/server/src/routes/assets.tsindex c0428f049a..57f511663f 100644--- a/apps/server/src/routes/assets.ts+++ b/apps/server/src/routes/assets.ts@@ -42,21 +42,20 @@ async function register(app: express.Application) {return url;}});++ function buildAssetProxy(name: string) {+ return proxy(publicUrl!, {+ proxyReqPathResolver: (req) => `/${assetPath}/app/src/${name}/${req.url}`+ });+ }+app.use(`/${assetPath}/app/doc_notes`, persistentCacheStatic(path.join(srcRoot, "assets", "doc_notes")));app.use(`/${assetPath}/app`, clientProxy);app.use(`/${assetPath}/app-dist`, clientProxy);- app.use(`/${assetPath}/stylesheets`, proxy(publicUrl, {- proxyReqPathResolver: (req) => `/${assetPath}/app/src/stylesheets/${req.url}`- }));- app.use(`/${assetPath}/libraries`, proxy(publicUrl, {- proxyReqPathResolver: (req) => "/libraries" + req.url- }));- app.use(`/${assetPath}/fonts`, proxy(publicUrl, {- proxyReqPathResolver: (req) => "/fonts" + req.url- }));- app.use(`/${assetPath}/translations`, proxy(publicUrl, {- proxyReqPathResolver: (req) => "/translations" + req.url- }));+ app.use(`/${assetPath}/stylesheets`, buildAssetProxy("stylesheets"));+ app.use(`/${assetPath}/libraries`, buildAssetProxy("libraries"));+ app.use(`/${assetPath}/fonts`, buildAssetProxy("fonts"));+ app.use(`/${assetPath}/translations`, buildAssetProxy("translations"));app.use(`/${assetPath}/images`, persistentCacheStatic(path.join(srcRoot, "assets", "images")));} else {const clientStaticCache = persistentCacheStatic(path.join(resourceDir, "public"));