diff --git a/server.js b/server.js index eacad88..84623b3 100755 --- a/server.js +++ b/server.js @@ -141,7 +141,7 @@ router.get('/serve/by-id/:id', async (req, res, next) => { return res.download(fpath) } - res.sendFile(fpath) + res.redirect('/file/track' + fpath.substring(values.directory.length)) }) router.use((err, req, res, next) => { @@ -150,6 +150,7 @@ router.use((err, req, res, next) => { }) app.use('/api', router) +app.use('/file/track', express.static(path.resolve(values.directory))) app.use('/', express.static(path.join(__dirname, 'public'))) app.listen(port, '127.0.0.1', function () {