mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 07:01:31 +08:00 
			
		
		
		
	fix missing doc resources for launchers, closes #3455
This commit is contained in:
		
							parent
							
								
									c6485f8e03
								
							
						
					
					
						commit
						7c98ade72b
					
				@ -2,7 +2,7 @@ image:
 | 
			
		||||
  file: .gitpod.dockerfile
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
      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 !!!
 | 
			
		||||
FROM node:16.18.0-alpine
 | 
			
		||||
FROM node:16.19.0-alpine
 | 
			
		||||
 | 
			
		||||
# Create app directory
 | 
			
		||||
WORKDIR /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 kept
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
PKG_DIR=dist/trilium-linux-x64-server
 | 
			
		||||
NODE_VERSION=16.18.0
 | 
			
		||||
NODE_VERSION=16.19.0
 | 
			
		||||
 | 
			
		||||
if [ "$1" != "DONTCOPY" ]
 | 
			
		||||
then
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,7 @@ if [[ $# -eq 0 ]] ; then
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
n exec 16.18.0 npm run webpack
 | 
			
		||||
n exec 16.19.0 npm run webpack
 | 
			
		||||
 | 
			
		||||
DIR=$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 dependencies
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    body.mobile .dropdown-submenu .dropdown-menu {
 | 
			
		||||
    body.mobile .global-menu .dropdown-submenu .dropdown-menu {
 | 
			
		||||
        display: block;
 | 
			
		||||
        font-size: 90%;
 | 
			
		||||
        position: relative;
 | 
			
		||||
 | 
			
		||||
@ -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();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										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 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
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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">
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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">
 | 
			
		||||
 | 
			
		||||
@ -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>
 | 
			
		||||
 | 
			
		||||
@ -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">
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user