added admin auth for uploading to an album

This commit is contained in:
Pitu 2017-01-18 03:00:36 -03:00
parent 84ff2241ba
commit 7e82e4304f

View File

@ -28,6 +28,10 @@ uploadsController.upload = function(req, res, next){
let album = req.headers.album
if(album !== undefined)
if(req.headers.adminAuth !== config.adminToken)
return res.status(401).send('not-authorized')
upload(req, res, function (err) {
if (err) {
console.error(err)
@ -78,7 +82,6 @@ uploadsController.list = function(req, res){
for(let file of files){
file.file = config.basedomain + config.uploads.prefix + file.name
file.ext = file.name.split('.').pop()
file.date = new Date(file.created_at * 1000)
file.date = file.date.getFullYear() + '-' + file.date.getMonth() + '-' + file.date.getDate() + ' ' + (file.date.getHours() < 10 ? '0' : '') + file.date.getHours() + ':' + (file.date.getMinutes() < 10 ? '0' : '') + file.date.getMinutes() + ':' + (file.date.getSeconds() < 10 ? '0' : '') + file.date.getSeconds()
}