From fc54751d467c214c33178b04c128a13148c54ccb 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 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/webServerPaths.js b/libs/webServerPaths.js index 8e5b29e..56ef9f6 100644 --- a/libs/webServerPaths.js +++ b/libs/webServerPaths.js @@ -73,21 +73,21 @@ 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')) } - app.use(s.checkCorrectPathEnding(config.webPaths.home)+'libs',express.static(s.mainDirectory + '/web/libs')) - app.use(s.checkCorrectPathEnding(config.webPaths.admin)+'libs',express.static(s.mainDirectory + '/web/libs')) - app.use(s.checkCorrectPathEnding(config.webPaths.super)+'libs',express.static(s.mainDirectory + '/web/libs')) + app.use(s.checkCorrectPathEnding(config.webPaths.home)+'libs',express.static(s.packageDirectory + '/web/libs')) + app.use(s.checkCorrectPathEnding(config.webPaths.admin)+'libs',express.static(s.packageDirectory + '/web/libs')) + app.use(s.checkCorrectPathEnding(config.webPaths.super)+'libs',express.static(s.packageDirectory + '/web/libs')) app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: true})); app.use(function (req,res,next){ 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 @@ -328,7 +328,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; @@ -1771,6 +1771,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