From 07ba404dcbdeebf02def41978a0520065bc99ead Mon Sep 17 00:00:00 2001 From: kanadeko Date: Sat, 14 Jan 2017 03:01:23 -0300 Subject: Frontend WIP --- lolisafe.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'lolisafe.js') diff --git a/lolisafe.js b/lolisafe.js index f99df78..c7c0589 100644 --- a/lolisafe.js +++ b/lolisafe.js @@ -9,9 +9,21 @@ fs.existsSync('./' + config.uploads.folder) || fs.mkdirSync('./' + config.upload fs.existsSync('./' + config.logsFolder) || fs.mkdirSync('./' + config.logsFolder) fs.existsSync('db') || fs.writeFile('db', '') +safe.enable('trust proxy') + safe.use('/', express.static('./uploads')) +safe.use('/', express.static('./public')) safe.use('/api' , routes) -safe.use('/panel', express.static('./dashboard')) + +safe.use(function (req, res, next) { + res.status(404).sendFile('404.html', { + root: './public/error/', + }) +}) + +safe.use(function (err, req, res, next) { + res.status(500).end() +}) // Create the tables we need to store galleries and files db.schema.createTableIfNotExists('gallery', function (table) { @@ -26,6 +38,4 @@ db.schema.createTableIfNotExists('files', function (table) { table.integer('galleryid') }).then(() => {}) -safe.enable('trust proxy') - safe.listen(config.port, () => console.log(`loli-safe started on port ${config.port}`)) \ No newline at end of file -- cgit v1.2.3