diff options
| author | kanadeko <[email protected]> | 2017-01-14 03:01:23 -0300 |
|---|---|---|
| committer | kanadeko <[email protected]> | 2017-01-14 03:01:23 -0300 |
| commit | 07ba404dcbdeebf02def41978a0520065bc99ead (patch) | |
| tree | 5f19487b73e5c11448b79a635c37d6b2d056fb80 /lolisafe.js | |
| parent | Gallery WIP (diff) | |
| download | host.fuwn.me-07ba404dcbdeebf02def41978a0520065bc99ead.tar.xz host.fuwn.me-07ba404dcbdeebf02def41978a0520065bc99ead.zip | |
Frontend WIP
Diffstat (limited to 'lolisafe.js')
| -rw-r--r-- | lolisafe.js | 16 |
1 files changed, 13 insertions, 3 deletions
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 |