mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	fix missing doc resources for launchers, closes #3455
This commit is contained in:
		| @@ -2,7 +2,7 @@ image: | |||||||
|   file: .gitpod.dockerfile |   file: .gitpod.dockerfile | ||||||
|  |  | ||||||
| tasks: | tasks: | ||||||
|     - before: nvm install 16.18.0 && nvm use 16.18.0 |     - before: nvm install 16.19.0 && nvm use 16.19.0 | ||||||
|       init: npm install |       init: npm install | ||||||
|       command: npm run start-server |       command: npm run start-server | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| # !!! Don't try to build this Dockerfile directly, run it through bin/build-docker.sh script !!! | # !!! Don't try to build this Dockerfile directly, run it through bin/build-docker.sh script !!! | ||||||
| FROM node:16.18.0-alpine | FROM node:16.19.0-alpine | ||||||
|  |  | ||||||
| # Create app directory | # Create app directory | ||||||
| WORKDIR /usr/src/app | WORKDIR /usr/src/app | ||||||
| @@ -25,12 +25,8 @@ RUN set -x \ | |||||||
|     && apk del .build-dependencies \ |     && apk del .build-dependencies \ | ||||||
|     && npm run webpack \ |     && npm run webpack \ | ||||||
|     && npm prune --omit=dev \ |     && npm prune --omit=dev \ | ||||||
| # Set the path to the newly created webpack bundle |  | ||||||
|     && sed -i -e 's/app\/desktop.js/app-dist\/desktop.js/g' src/views/desktop.ejs \ |  | ||||||
|     && sed -i -e 's/app\/mobile.js/app-dist\/mobile.js/g' src/views/mobile.ejs \ |  | ||||||
|     && sed -i -e 's/app\/setup.js/app-dist\/setup.js/g' src/views/setup.ejs \ |  | ||||||
|     && sed -i -e 's/app\/share.js/app-dist\/share.js/g' src/views/share/*.ejs \ |  | ||||||
|     && cp src/public/app/share.js src/public/app-dist/. \ |     && cp src/public/app/share.js src/public/app-dist/. \ | ||||||
|  |     && cp -r src/public/app/doc_notes src/public/app-dist/. \ | ||||||
|     && rm -rf src/public/app |     && rm -rf src/public/app | ||||||
|  |  | ||||||
| # Some setup tools need to be kept | # Some setup tools need to be kept | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| #!/usr/bin/env bash | #!/usr/bin/env bash | ||||||
|  |  | ||||||
| PKG_DIR=dist/trilium-linux-x64-server | PKG_DIR=dist/trilium-linux-x64-server | ||||||
| NODE_VERSION=16.18.0 | NODE_VERSION=16.19.0 | ||||||
|  |  | ||||||
| if [ "$1" != "DONTCOPY" ] | if [ "$1" != "DONTCOPY" ] | ||||||
| then | then | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ if [[ $# -eq 0 ]] ; then | |||||||
|     exit 1 |     exit 1 | ||||||
| fi | fi | ||||||
|  |  | ||||||
| n exec 16.18.0 npm run webpack | n exec 16.19.0 npm run webpack | ||||||
|  |  | ||||||
| DIR=$1 | DIR=$1 | ||||||
|  |  | ||||||
| @@ -27,7 +27,7 @@ cp -r electron.js $DIR/ | |||||||
| cp webpack-* $DIR/ | cp webpack-* $DIR/ | ||||||
|  |  | ||||||
| # run in subshell (so we return to original dir) | # run in subshell (so we return to original dir) | ||||||
| (cd $DIR && n exec 16.18.0 npm install --only=prod) | (cd $DIR && n exec 16.19.0 npm install --only=prod) | ||||||
|  |  | ||||||
| # cleanup of useless files in dependencies | # cleanup of useless files in dependencies | ||||||
| rm -r $DIR/node_modules/image-q/demo | rm -r $DIR/node_modules/image-q/demo | ||||||
| @@ -45,10 +45,6 @@ find $DIR/node_modules -name demo -exec rm -rf {} \; | |||||||
| find $DIR/libraries -name "*.map" -type f -delete | find $DIR/libraries -name "*.map" -type f -delete | ||||||
|  |  | ||||||
| cp $DIR/src/public/app/share.js $DIR/src/public/app-dist/ | cp $DIR/src/public/app/share.js $DIR/src/public/app-dist/ | ||||||
|  | cp -r $DIR/src/public/app/doc_notes $DIR/src/public/app-dist/ | ||||||
|  |  | ||||||
| rm -rf $DIR/src/public/app | rm -rf $DIR/src/public/app | ||||||
|  |  | ||||||
| sed -i -e 's/app\/desktop.js/app-dist\/desktop.js/g' $DIR/src/views/desktop.ejs |  | ||||||
| sed -i -e 's/app\/mobile.js/app-dist\/mobile.js/g' $DIR/src/views/mobile.ejs |  | ||||||
| sed -i -e 's/app\/setup.js/app-dist\/setup.js/g' $DIR/src/views/setup.ejs |  | ||||||
| sed -i -e 's/app\/share.js/app-dist\/share.js/g' $DIR/src/views/share/*.ejs |  | ||||||
|   | |||||||
| @@ -80,7 +80,7 @@ const TPL = ` | |||||||
|         display: none; |         display: none; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     body.mobile .dropdown-submenu .dropdown-menu { |     body.mobile .global-menu .dropdown-submenu .dropdown-menu { | ||||||
|         display: block; |         display: block; | ||||||
|         font-size: 90%; |         font-size: 90%; | ||||||
|         position: relative; |         position: relative; | ||||||
|   | |||||||
| @@ -31,7 +31,7 @@ export default class DocTypeWidget extends TypeWidget { | |||||||
|         const docName = note.getLabelValue('docName'); |         const docName = note.getLabelValue('docName'); | ||||||
|  |  | ||||||
|         if (docName) { |         if (docName) { | ||||||
|             this.$content.load(`${window.glob.assetPath}/app/doc_notes/${docName}.html`); |             this.$content.load(`${window.glob.appPath}/doc_notes/${docName}.html`); | ||||||
|         } else { |         } else { | ||||||
|             this.$content.empty(); |             this.$content.empty(); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -10,6 +10,7 @@ const utils = require('../services/utils'); | |||||||
| const protectedSessionService = require("../services/protected_session"); | const protectedSessionService = require("../services/protected_session"); | ||||||
| const packageJson = require('../../package.json'); | const packageJson = require('../../package.json'); | ||||||
| const assetPath = require("../services/asset_path"); | const assetPath = require("../services/asset_path"); | ||||||
|  | const appPath = require("../services/app_path"); | ||||||
|  |  | ||||||
| function index(req, res) { | function index(req, res) { | ||||||
|     const options = optionService.getOptionsMap(); |     const options = optionService.getOptionsMap(); | ||||||
| @@ -38,7 +39,8 @@ function index(req, res) { | |||||||
|         isProtectedSessionAvailable: protectedSessionService.isProtectedSessionAvailable(), |         isProtectedSessionAvailable: protectedSessionService.isProtectedSessionAvailable(), | ||||||
|         maxContentWidth: parseInt(options.maxContentWidth), |         maxContentWidth: parseInt(options.maxContentWidth), | ||||||
|         triliumVersion: packageJson.version, |         triliumVersion: packageJson.version, | ||||||
|         assetPath: assetPath |         assetPath: assetPath, | ||||||
|  |         appPath: appPath | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -6,19 +6,22 @@ const myScryptService = require('../services/my_scrypt'); | |||||||
| const log = require('../services/log'); | const log = require('../services/log'); | ||||||
| const passwordService = require("../services/password"); | const passwordService = require("../services/password"); | ||||||
| const assetPath = require("../services/asset_path"); | const assetPath = require("../services/asset_path"); | ||||||
|  | const appPath = require("../services/app_path"); | ||||||
| const ValidationError = require("../errors/validation_error"); | const ValidationError = require("../errors/validation_error"); | ||||||
|  |  | ||||||
| function loginPage(req, res) { | function loginPage(req, res) { | ||||||
|     res.render('login', { |     res.render('login', { | ||||||
|         failedAuth: false, |         failedAuth: false, | ||||||
|         assetPath: assetPath |         assetPath: assetPath, | ||||||
|  |         appPath: appPath | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
| function setPasswordPage(req, res) { | function setPasswordPage(req, res) { | ||||||
|     res.render('set_password', { |     res.render('set_password', { | ||||||
|         error: false, |         error: false, | ||||||
|         assetPath: assetPath |         assetPath: assetPath, | ||||||
|  |         appPath: appPath | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ const sqlInit = require('../services/sql_init'); | |||||||
| const setupService = require('../services/setup'); | const setupService = require('../services/setup'); | ||||||
| const utils = require('../services/utils'); | const utils = require('../services/utils'); | ||||||
| const assetPath = require("../services/asset_path"); | const assetPath = require("../services/asset_path"); | ||||||
|  | const appPath = require("../services/app_path.js"); | ||||||
|  |  | ||||||
| function setupPage(req, res) { | function setupPage(req, res) { | ||||||
|     if (sqlInit.isDbInitialized()) { |     if (sqlInit.isDbInitialized()) { | ||||||
| @@ -31,7 +32,8 @@ function setupPage(req, res) { | |||||||
|  |  | ||||||
|     res.render('setup', { |     res.render('setup', { | ||||||
|         syncInProgress: syncInProgress, |         syncInProgress: syncInProgress, | ||||||
|         assetPath: assetPath |         assetPath: assetPath, | ||||||
|  |         appPath: appPath | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								src/services/app_path.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/services/app_path.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | const assetPath = require("./asset_path"); | ||||||
|  | const env = require("./env"); | ||||||
|  |  | ||||||
|  | module.exports = env.isDev() | ||||||
|  |     ? assetPath + "/app" | ||||||
|  |     : assetPath + "/app-dist"; | ||||||
| @@ -7,6 +7,7 @@ const shacaLoader = require("./shaca/shaca_loader"); | |||||||
| const shareRoot = require("./share_root"); | const shareRoot = require("./share_root"); | ||||||
| const contentRenderer = require("./content_renderer"); | const contentRenderer = require("./content_renderer"); | ||||||
| const assetPath = require("../services/asset_path"); | const assetPath = require("../services/asset_path"); | ||||||
|  | const appPath = require("../services/app_path"); | ||||||
|  |  | ||||||
| function getSharedSubTreeRoot(note) { | function getSharedSubTreeRoot(note) { | ||||||
|     if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) { |     if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) { | ||||||
| @@ -111,7 +112,8 @@ function register(router) { | |||||||
|             content, |             content, | ||||||
|             isEmpty, |             isEmpty, | ||||||
|             subRoot, |             subRoot, | ||||||
|             assetPath |             assetPath, | ||||||
|  |             appPath | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -36,6 +36,7 @@ | |||||||
|         isProtectedSessionAvailable: <%= isProtectedSessionAvailable %>, |         isProtectedSessionAvailable: <%= isProtectedSessionAvailable %>, | ||||||
|         triliumVersion: "<%= triliumVersion %>", |         triliumVersion: "<%= triliumVersion %>", | ||||||
|         assetPath: "<%= assetPath %>", |         assetPath: "<%= assetPath %>", | ||||||
|  |         appPath: "<%= appPath %>", | ||||||
|         TRILIUM_SAFE_MODE: <%= !!process.env.TRILIUM_SAFE_MODE %> |         TRILIUM_SAFE_MODE: <%= !!process.env.TRILIUM_SAFE_MODE %> | ||||||
|     }; |     }; | ||||||
| </script> | </script> | ||||||
| @@ -80,7 +81,7 @@ | |||||||
|     $("body").show(); |     $("body").show(); | ||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <script src="<%= assetPath %>/app/desktop.js" crossorigin type="module"></script> | <script src="<%= appPath %>/desktop.js" crossorigin type="module"></script> | ||||||
|  |  | ||||||
| <link rel="stylesheet" type="text/css" href="<%= assetPath %>/libraries/boxicons/css/boxicons.min.css"> | <link rel="stylesheet" type="text/css" href="<%= assetPath %>/libraries/boxicons/css/boxicons.min.css"> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -115,9 +115,10 @@ | |||||||
|         csrfToken: '<%= csrfToken %>', |         csrfToken: '<%= csrfToken %>', | ||||||
|         isDev: <%= isDev %>, |         isDev: <%= isDev %>, | ||||||
|         appCssNoteIds: <%- JSON.stringify(appCssNoteIds) %>, |         appCssNoteIds: <%- JSON.stringify(appCssNoteIds) %>, | ||||||
|  |         isMainWindow: true, | ||||||
|         isProtectedSessionAvailable: <%= isProtectedSessionAvailable %>, |         isProtectedSessionAvailable: <%= isProtectedSessionAvailable %>, | ||||||
|         assetPath: "<%= assetPath %>", |         assetPath: "<%= assetPath %>", | ||||||
|         isMainWindow: true, |         appPath: "<%= appPath %>", | ||||||
|         TRILIUM_SAFE_MODE: <%= !!process.env.TRILIUM_SAFE_MODE %> |         TRILIUM_SAFE_MODE: <%= !!process.env.TRILIUM_SAFE_MODE %> | ||||||
|     }; |     }; | ||||||
| </script> | </script> | ||||||
| @@ -132,7 +133,7 @@ | |||||||
| <link href="<%= assetPath %>/libraries/bootstrap/css/bootstrap.min.css" rel="stylesheet"> | <link href="<%= assetPath %>/libraries/bootstrap/css/bootstrap.min.css" rel="stylesheet"> | ||||||
| <script src="<%= assetPath %>/libraries/bootstrap/js/bootstrap.bundle.min.js"></script> | <script src="<%= assetPath %>/libraries/bootstrap/js/bootstrap.bundle.min.js"></script> | ||||||
|  |  | ||||||
| <script src="<%= assetPath %>/app/mobile.js" crossorigin type="module"></script> | <script src="<%= appPath %>/mobile.js" crossorigin type="module"></script> | ||||||
|  |  | ||||||
| <link href="api/fonts" rel="stylesheet"> | <link href="api/fonts" rel="stylesheet"> | ||||||
| <link href="<%= assetPath %>/stylesheets/ckeditor-theme.css" rel="stylesheet"> | <link href="<%= assetPath %>/stylesheets/ckeditor-theme.css" rel="stylesheet"> | ||||||
|   | |||||||
| @@ -161,7 +161,7 @@ | |||||||
|  |  | ||||||
| <script src="<%= assetPath %>/libraries/knockout.min.js"></script> | <script src="<%= assetPath %>/libraries/knockout.min.js"></script> | ||||||
|  |  | ||||||
| <script src="<%= assetPath %>/app/setup.js" crossorigin type="module"></script> | <script src="<%= appPath %>/setup.js" crossorigin type="module"></script> | ||||||
| <link href="<%= assetPath %>/stylesheets/theme-light.css" rel="stylesheet"> | <link href="<%= assetPath %>/stylesheets/theme-light.css" rel="stylesheet"> | ||||||
| </body> | </body> | ||||||
| </html> | </html> | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ | |||||||
|     <% } else { %> |     <% } else { %> | ||||||
|     <link rel="shortcut icon" href="../favicon.ico"> |     <link rel="shortcut icon" href="../favicon.ico"> | ||||||
|     <% } %> |     <% } %> | ||||||
|     <script src="../<%= assetPath %>/app/share.js"></script> |     <script src="../<%= appPath %>/share.js"></script> | ||||||
|     <% if (!note.hasLabel("shareOmitDefaultCss")) { %> |     <% if (!note.hasLabel("shareOmitDefaultCss")) { %> | ||||||
|         <link href="../<%= assetPath %>/libraries/normalize.min.css" rel="stylesheet"> |         <link href="../<%= assetPath %>/libraries/normalize.min.css" rel="stylesheet"> | ||||||
|         <link href="../<%= assetPath %>/stylesheets/share.css" rel="stylesheet"> |         <link href="../<%= assetPath %>/stylesheets/share.css" rel="stylesheet"> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user