diff options
Diffstat (limited to 'controllers/albumsController.js')
| -rw-r--r-- | controllers/albumsController.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/controllers/albumsController.js b/controllers/albumsController.js index 038d605..3a51e15 100644 --- a/controllers/albumsController.js +++ b/controllers/albumsController.js @@ -2,6 +2,7 @@ const config = require('../config.js') const db = require('knex')(config.database) const randomstring = require('randomstring') const utils = require('./utilsController.js') +const path = require('path') let albumsController = {} @@ -57,7 +58,6 @@ albumsController.list = function(req, res, next) { } albumsController.create = function(req, res, next) { - let token = req.headers.token if (token === undefined) return res.status(401).json({ success: false, description: 'No token provided' }) @@ -153,7 +153,12 @@ albumsController.get = function(req, res, next) { for (let file of files) { file.file = basedomain + '/' + file.name - utils.generateThumbs(file) + + let ext = path.extname(file.name).toLowerCase() + if (utils.extensions.includes(ext)) { + file.thumb = basedomain + '/thumbs/' + file.name.slice(0, -ext.length) + '.png' + utils.generateThumbs(file) + } } return res.json({ |