aboutsummaryrefslogtreecommitdiff
path: root/controllers/uploadController.js
diff options
context:
space:
mode:
Diffstat (limited to 'controllers/uploadController.js')
-rw-r--r--controllers/uploadController.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/controllers/uploadController.js b/controllers/uploadController.js
index 6b962c3..499bdb7 100644
--- a/controllers/uploadController.js
+++ b/controllers/uploadController.js
@@ -24,13 +24,13 @@ uploadsController.upload = function(req, res, next){
if(config.private === true)
if(req.headers.auth !== config.clientToken)
- return res.status(401).send('not-authorized')
+ return res.status(401).json({ success: false, description: 'not-authorized'})
- let album = req.headers.album
+ let album = req.body.album
if(album !== undefined)
if(req.headers.adminauth !== config.adminToken)
- return res.status(401).send('not-authorized')
+ return res.status(401).json({ success: false, description: 'not-authorized'})
upload(req, res, function (err) {
if (err) {
@@ -81,14 +81,14 @@ uploadsController.upload = function(req, res, next){
uploadsController.list = function(req, res){
if(req.headers.auth !== config.adminToken)
- return res.status(401).send('not-authorized')
+ return res.status(401).json({ success: false, description: 'not-authorized'})
db.table('files')
.where(function(){
- if(req.headers.albumid === undefined)
+ if(req.params.id === undefined)
this.where('id', '<>', '')
else
- this.where('albumid', req.headers.albumid)
+ this.where('albumid', req.params.id)
})
.then((files) => {
db.table('albums').then((albums) => {
@@ -114,7 +114,10 @@ uploadsController.list = function(req, res){
}
- return res.json(files)
+ return res.json({
+ success: true,
+ files
+ })
})
})