aboutsummaryrefslogtreecommitdiff
path: root/controllers/albumsController.js
diff options
context:
space:
mode:
authorPitu <[email protected]>2017-03-18 01:36:50 -0300
committerPitu <[email protected]>2017-03-18 01:36:50 -0300
commit026e0a3ef04efd97fda225391d6a72b7567f755d (patch)
treef2ca18f829dee604c4ae7672909f6d293bfcaaea /controllers/albumsController.js
parentAdded ShareX config instructions (diff)
downloadhost.fuwn.me-026e0a3ef04efd97fda225391d6a72b7567f755d.tar.xz
host.fuwn.me-026e0a3ef04efd97fda225391d6a72b7567f755d.zip
Derps were made, and now fixed
Diffstat (limited to 'controllers/albumsController.js')
-rw-r--r--controllers/albumsController.js9
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({