mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-19 01:31:34 +00:00
added admin auth for uploading to an album
This commit is contained in:
parent
84ff2241ba
commit
7e82e4304f
@ -28,6 +28,10 @@ uploadsController.upload = function(req, res, next){
|
|||||||
|
|
||||||
let album = req.headers.album
|
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) {
|
upload(req, res, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
@ -78,7 +82,6 @@ uploadsController.list = function(req, res){
|
|||||||
for(let file of files){
|
for(let file of files){
|
||||||
file.file = config.basedomain + config.uploads.prefix + file.name
|
file.file = config.basedomain + config.uploads.prefix + file.name
|
||||||
file.ext = file.name.split('.').pop()
|
file.ext = file.name.split('.').pop()
|
||||||
|
|
||||||
file.date = new Date(file.created_at * 1000)
|
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()
|
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()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user