From c700ec6a01cfc99a639484e9045fc4492466c6ee Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 15 Mar 2022 18:48:34 +0100 Subject: [PATCH 6/9] use packageDirectory for web server paths --- libs/webServerPaths.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/webServerPaths.js b/libs/webServerPaths.js index fba78ba..b72aff6 100644 --- a/libs/webServerPaths.js +++ b/libs/webServerPaths.js @@ -77,7 +77,7 @@ module.exports = function(s,config,lang,app,io){ ////Pages app.enable('trust proxy'); if(config.webPaths.home !== '/'){ - app.use('/libs',express.static(s.mainDirectory + '/web/libs')) + app.use('/libs',express.static(s.packageDirectory + '/web/libs')) } [ [config.webPaths.home,'libs','/web/libs'], @@ -87,7 +87,7 @@ module.exports = function(s,config,lang,app,io){ [config.webPaths.admin,'assets','/web/assets'], [config.webPaths.super,'assets','/web/assets'], ].forEach((piece) => { - app.use(s.checkCorrectPathEnding(piece[0])+piece[1],express.static(s.mainDirectory + piece[2])) + app.use(s.checkCorrectPathEnding(piece[0])+piece[1],express.static(s.packageDirectory + piece[2])) }) app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: true})); @@ -95,10 +95,10 @@ module.exports = function(s,config,lang,app,io){ res.header("Access-Control-Allow-Origin",'*'); next() }) - app.set('views', s.mainDirectory + '/web'); + app.set('views', s.packageDirectory + '/web'); app.set('view engine','ejs'); //add template handler - if(config.renderPaths.handler!==undefined){require(s.mainDirectory+'/web/'+config.renderPaths.handler+'.js').addHandlers(s,app,io,config)} + if(config.renderPaths.handler!==undefined){require(s.packageDirectory+'/web/'+config.renderPaths.handler+'.js').addHandlers(s,app,io,config)} /** * API : Logout @@ -339,7 +339,7 @@ module.exports = function(s,config,lang,app,io){ define: s.getDefinitonFile(userInfo.details.lang), addStorage: s.dir.addStorage, fs: fs, - __dirname: s.mainDirectory, + __dirname: s.packageDirectory, customAutoLoad: s.customAutoLoadTree }) break; @@ -1850,6 +1850,6 @@ module.exports = function(s,config,lang,app,io){ res.on('finish',function(){ res.end() }) - fs.createReadStream(s.mainDirectory + '/web/pages/robots.txt').pipe(res) + fs.createReadStream(s.packageDirectory + '/web/pages/robots.txt').pipe(res) }) } -- 2.35.1