config/packages/dream2nix/overrides/nodejs/shinobi/0006-use-packageDirectory-for-web-server-paths.patch
Max e055e489be packages/shinobi: init
flake.lock: Update

Flake lock file updates:

• Added input 'shinobi':
    'gitlab:Shinobi-Systems/Shinobi/a2faa40ab0e9952ff6a7fcf682534171614180c1' (2021-11-30)
2022-03-17 20:56:05 +01:00

61 lines
2.9 KiB
Diff

From fc54751d467c214c33178b04c128a13148c54ccb Mon Sep 17 00:00:00 2001
From: Max <max@privatevoid.net>
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