From b15d7d6e2960f15ff0c39eafd3efdf4c147feb38 Mon Sep 17 00:00:00 2001 From: samdd Date: Thu, 11 Jan 2018 23:38:02 +0000 Subject: [PATCH] :bug: Path fixes --- src/main.js | 6 +++--- src/main.ts | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main.js b/src/main.js index d6a8d70f..ff345610 100644 --- a/src/main.js +++ b/src/main.js @@ -1701,7 +1701,7 @@ MongoClient.connect(config.mongodb, function (err, client) { app.use('/projects/*', function (req, res) { if (req.originalUrl.includes('/vs/')) { var vs = req.originalUrl.split('/vs/'); - vs = 'interface/vs/' + path.normalize(vs[vs.length - 1]); + vs = '../interface/vs/' + path.normalize(vs[vs.length - 1]); if (fs.existsSync(vs)) { res.sendFile(path.join(__dirname, vs)); } @@ -1710,11 +1710,11 @@ MongoClient.connect(config.mongodb, function (err, client) { } } else { - res.sendFile(path.join(__dirname, 'interface/index.html')); + res.sendFile(path.join(__dirname, '../interface/index.html')); } }); app.use('/config', function (req, res) { - res.sendFile(path.join(__dirname, 'interface/index.html')); + res.sendFile(path.join(__dirname, '../interface/index.html')); }); app.use(express.static(path.join(__dirname, 'interface'))); } diff --git a/src/main.ts b/src/main.ts index 96f9f872..14e22f9a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -51,8 +51,6 @@ MongoClient.connect(config.mongodb, (err, client) => { let Inject = new injectHandler(server, db) let inject = global.inject = Inject.state - - io.on('connection', socket => { let globalToken let state = { @@ -1672,18 +1670,18 @@ MongoClient.connect(config.mongodb, (err, client) => { app.use('/projects/*', (req, res) => { if (req.originalUrl.includes('/vs/')) { let vs = req.originalUrl.split('/vs/') - vs = 'interface/vs/' + path.normalize(vs[vs.length - 1]) + vs = '../interface/vs/' + path.normalize(vs[vs.length - 1]) if (fs.existsSync(vs)) { res.sendFile(path.join(__dirname, vs)) } else { res.status(404).send('Not found') } } else { - res.sendFile(path.join(__dirname, 'interface/index.html')) + res.sendFile(path.join(__dirname, '../interface/index.html')) } }) app.use('/config', (req, res) => { - res.sendFile(path.join(__dirname, 'interface/index.html')) + res.sendFile(path.join(__dirname, '../interface/index.html')) }) app.use(express.static(path.join(__dirname, 'interface'))) }