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 missing doc resources for launchers, closes #3455
zadam7c98ade72b31
diff --git a/.gitpod.yml b/.gitpod.ymlindex 8c5fe37ba1..914a89919d 100644--- a/.gitpod.yml+++ b/.gitpod.yml@@ -2,7 +2,7 @@ image:file: .gitpod.dockerfiletasks:- - before: nvm install 16.18.0 && nvm use 16.18.0+ - before: nvm install 16.19.0 && nvm use 16.19.0init: npm installcommand: npm run start-serverdiff --git a/Dockerfile b/Dockerfileindex 4675fa88ae..caca792ab9 100644--- a/Dockerfile+++ b/Dockerfile@@ -1,5 +1,5 @@# !!! 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 directoryWORKDIR /usr/src/app@@ -25,12 +25,8 @@ RUN set -x \&& apk del .build-dependencies \&& npm run webpack \&& 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 -r src/public/app/doc_notes src/public/app-dist/. \&& rm -rf src/public/app# Some setup tools need to be keptdiff --git a/bin/build-server.sh b/bin/build-server.shindex accb11f329..2c42c91053 100755--- a/bin/build-server.sh+++ b/bin/build-server.sh@@ -1,7 +1,7 @@#!/usr/bin/env bashPKG_DIR=dist/trilium-linux-x64-server-NODE_VERSION=16.18.0+NODE_VERSION=16.19.0if [ "$1" != "DONTCOPY" ]thendiff --git a/bin/copy-trilium.sh b/bin/copy-trilium.shindex 77f754d171..fdcb99a40e 100755--- a/bin/copy-trilium.sh+++ b/bin/copy-trilium.sh@@ -5,7 +5,7 @@ if [[ $# -eq 0 ]] ; thenexit 1fi-n exec 16.18.0 npm run webpack+n exec 16.19.0 npm run webpackDIR=$1@@ -27,7 +27,7 @@ cp -r electron.js $DIR/cp webpack-* $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 dependenciesrm -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 -deletecp $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--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/*.ejsdiff --git a/src/public/app/widgets/buttons/global_menu.js b/src/public/app/widgets/buttons/global_menu.jsindex c268216a28..89adaabadc 100644--- a/src/public/app/widgets/buttons/global_menu.js+++ b/src/public/app/widgets/buttons/global_menu.js@@ -80,7 +80,7 @@ const TPL = `display: none;}- body.mobile .dropdown-submenu .dropdown-menu {+ body.mobile .global-menu .dropdown-submenu .dropdown-menu {display: block;font-size: 90%;position: relative;diff --git a/src/public/app/widgets/type_widgets/doc.js b/src/public/app/widgets/type_widgets/doc.jsindex fc775a62f6..234ff21aa3 100644--- a/src/public/app/widgets/type_widgets/doc.js+++ b/src/public/app/widgets/type_widgets/doc.js@@ -31,7 +31,7 @@ export default class DocTypeWidget extends TypeWidget {const docName = note.getLabelValue('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 {this.$content.empty();}diff --git a/src/routes/index.js b/src/routes/index.jsindex 38ccbb4984..7d01e08a5b 100644--- a/src/routes/index.js+++ b/src/routes/index.js@@ -10,6 +10,7 @@ const utils = require('../services/utils');const protectedSessionService = require("../services/protected_session");const packageJson = require('../../package.json');const assetPath = require("../services/asset_path");+const appPath = require("../services/app_path");function index(req, res) {const options = optionService.getOptionsMap();@@ -38,7 +39,8 @@ function index(req, res) {isProtectedSessionAvailable: protectedSessionService.isProtectedSessionAvailable(),maxContentWidth: parseInt(options.maxContentWidth),triliumVersion: packageJson.version,- assetPath: assetPath+ assetPath: assetPath,+ appPath: appPath});}diff --git a/src/routes/login.js b/src/routes/login.jsindex f824931c63..9dc9075e7a 100644--- a/src/routes/login.js+++ b/src/routes/login.js@@ -6,19 +6,22 @@ const myScryptService = require('../services/my_scrypt');const log = require('../services/log');const passwordService = require("../services/password");const assetPath = require("../services/asset_path");+const appPath = require("../services/app_path");const ValidationError = require("../errors/validation_error");function loginPage(req, res) {res.render('login', {failedAuth: false,- assetPath: assetPath+ assetPath: assetPath,+ appPath: appPath});}function setPasswordPage(req, res) {res.render('set_password', {error: false,- assetPath: assetPath+ assetPath: assetPath,+ appPath: appPath});}diff --git a/src/routes/setup.js b/src/routes/setup.jsindex 3e3eab29b6..c3f58077df 100644--- a/src/routes/setup.js+++ b/src/routes/setup.js@@ -4,6 +4,7 @@ const sqlInit = require('../services/sql_init');const setupService = require('../services/setup');const utils = require('../services/utils');const assetPath = require("../services/asset_path");+const appPath = require("../services/app_path.js");function setupPage(req, res) {if (sqlInit.isDbInitialized()) {@@ -31,7 +32,8 @@ function setupPage(req, res) {res.render('setup', {syncInProgress: syncInProgress,- assetPath: assetPath+ assetPath: assetPath,+ appPath: appPath});}diff --git a/src/services/app_path.js b/src/services/app_path.jsnew file mode 100644index 0000000000..09129aadbe--- /dev/null+++ b/src/services/app_path.js@@ -0,0 +1,6 @@+const assetPath = require("./asset_path");+const env = require("./env");++module.exports = env.isDev()+ ? assetPath + "/app"+ : assetPath + "/app-dist";diff --git a/src/share/routes.js b/src/share/routes.jsindex 626ede63c7..6ea82e62a5 100644--- a/src/share/routes.js+++ b/src/share/routes.js@@ -7,6 +7,7 @@ const shacaLoader = require("./shaca/shaca_loader");const shareRoot = require("./share_root");const contentRenderer = require("./content_renderer");const assetPath = require("../services/asset_path");+const appPath = require("../services/app_path");function getSharedSubTreeRoot(note) {if (note.noteId === shareRoot.SHARE_ROOT_NOTE_ID) {@@ -111,7 +112,8 @@ function register(router) {content,isEmpty,subRoot,- assetPath+ assetPath,+ appPath});}diff --git a/src/views/desktop.ejs b/src/views/desktop.ejsindex 6848847229..f1e91b77dc 100644--- a/src/views/desktop.ejs+++ b/src/views/desktop.ejs@@ -36,6 +36,7 @@isProtectedSessionAvailable: <%= isProtectedSessionAvailable %>,triliumVersion: "<%= triliumVersion %>",assetPath: "<%= assetPath %>",+ appPath: "<%= appPath %>",TRILIUM_SAFE_MODE: <%= !!process.env.TRILIUM_SAFE_MODE %>};</script>@@ -80,7 +81,7 @@$("body").show();</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">diff --git a/src/views/mobile.ejs b/src/views/mobile.ejsindex 4edb46a2fe..4ff1fbd576 100644--- a/src/views/mobile.ejs+++ b/src/views/mobile.ejs@@ -115,9 +115,10 @@csrfToken: '<%= csrfToken %>',isDev: <%= isDev %>,appCssNoteIds: <%- JSON.stringify(appCssNoteIds) %>,+ isMainWindow: true,isProtectedSessionAvailable: <%= isProtectedSessionAvailable %>,assetPath: "<%= assetPath %>",- isMainWindow: true,+ appPath: "<%= appPath %>",TRILIUM_SAFE_MODE: <%= !!process.env.TRILIUM_SAFE_MODE %>};</script>@@ -132,7 +133,7 @@<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 %>/app/mobile.js" crossorigin type="module"></script>+<script src="<%= appPath %>/mobile.js" crossorigin type="module"></script><link href="api/fonts" rel="stylesheet"><link href="<%= assetPath %>/stylesheets/ckeditor-theme.css" rel="stylesheet">diff --git a/src/views/setup.ejs b/src/views/setup.ejsindex 6f4578a8c2..185df189fa 100644--- a/src/views/setup.ejs+++ b/src/views/setup.ejs@@ -161,7 +161,7 @@<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"></body></html>diff --git a/src/views/share/page.ejs b/src/views/share/page.ejsindex 1afacd8d17..41e0a5c199 100644--- a/src/views/share/page.ejs+++ b/src/views/share/page.ejs@@ -12,7 +12,7 @@<% } else { %><link rel="shortcut icon" href="../favicon.ico"><% } %>- <script src="../<%= assetPath %>/app/share.js"></script>+ <script src="../<%= appPath %>/share.js"></script><% if (!note.hasLabel("shareOmitDefaultCss")) { %><link href="../<%= assetPath %>/libraries/normalize.min.css" rel="stylesheet"><link href="../<%= assetPath %>/stylesheets/share.css" rel="stylesheet">