mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	fix(dx/share): templates and script not accessible
This commit is contained in:
		@@ -18,6 +18,7 @@ import utils, { isDev, safeExtractMessageAndStackFromError } from "../services/u
 | 
				
			|||||||
import options from "../services/options.js";
 | 
					import options from "../services/options.js";
 | 
				
			||||||
import { t } from "i18next";
 | 
					import { t } from "i18next";
 | 
				
			||||||
import ejs from "ejs";
 | 
					import ejs from "ejs";
 | 
				
			||||||
 | 
					import { join } from "path";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } {
 | 
					function getSharedSubTreeRoot(note: SNote): { note?: SNote; branch?: SBranch } {
 | 
				
			||||||
    if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) {
 | 
					    if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) {
 | 
				
			||||||
@@ -401,7 +402,9 @@ function register(router: Router) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function renderDefault(res: Response<any, Record<string, any>>, template: "page" | "404", opts: any = {}) {
 | 
					function renderDefault(res: Response<any, Record<string, any>>, template: "page" | "404", opts: any = {}) {
 | 
				
			||||||
    // Path is relative to apps/server/dist/assets/views
 | 
					    // Path is relative to apps/server/dist/assets/views
 | 
				
			||||||
    const shareThemePath = `../../share-theme/templates/${template}.ejs`;
 | 
					    const shareThemePath = process.env.NODE_ENV === "development"
 | 
				
			||||||
 | 
					        ? join(__dirname, `../../../../packages/share-theme/src/templates/${template}.ejs`)
 | 
				
			||||||
 | 
					        : `../../share-theme/templates/${template}.ejs`;
 | 
				
			||||||
    res.render(shareThemePath, opts);
 | 
					    res.render(shareThemePath, opts);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@
 | 
				
			|||||||
    <meta name="viewport" content="width=device-width, initial-scale=1">
 | 
					    <meta name="viewport" content="width=device-width, initial-scale=1">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <link rel="shortcut icon" href="<% if (note.hasRelation("shareFavicon")) { %>api/notes/<%= note.getRelation("shareFavicon").value %>/download<% } else { %>../favicon.ico<% } %>">
 | 
					    <link rel="shortcut icon" href="<% if (note.hasRelation("shareFavicon")) { %>api/notes/<%= note.getRelation("shareFavicon").value %>/download<% } else { %>../favicon.ico<% } %>">
 | 
				
			||||||
    <script src="<%= appPath %>/share.js" type="module"></script>
 | 
					    <script src="../<%= appPath %>/share.js" type="module"></script>
 | 
				
			||||||
    <% if (!isDev && !note.isLabelTruthy("shareOmitDefaultCss")) { %>
 | 
					    <% if (!isDev && !note.isLabelTruthy("shareOmitDefaultCss")) { %>
 | 
				
			||||||
        <link href="<%= assetPath %>/src/share.css" rel="stylesheet">
 | 
					        <link href="<%= assetPath %>/src/share.css" rel="stylesheet">
 | 
				
			||||||
        <link href="<%= assetPath %>/src/boxicons.css" rel="stylesheet">
 | 
					        <link href="<%= assetPath %>/src/boxicons.css" rel="stylesheet">
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user