diff options
Diffstat (limited to 'controllers/galleryController.js')
| -rw-r--r-- | controllers/galleryController.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/controllers/galleryController.js b/controllers/galleryController.js index a74dde5..39826dd 100644 --- a/controllers/galleryController.js +++ b/controllers/galleryController.js @@ -5,8 +5,9 @@ let galleryController = {} galleryController.list = function(req, res, next){ - if(!config.privacy.public) - if(!config.privacy.IPs.includes(req.ip)) return res.status(401).send('not-authorized') + if(config.TOKEN !== '') + if(req.headers.auth !== config.TOKEN) + return res.status(401).send('not-authorized') db.table('gallery').select('id', 'name').then((data) => { res.json({ data }) @@ -15,8 +16,9 @@ galleryController.list = function(req, res, next){ galleryController.test = function(req, res, next){ - if(!config.privacy.public) - if(!config.privacy.IPs.includes(req.ip)) return res.status(401).send('not-authorized') + if(config.TOKEN !== '') + if(req.headers.auth !== config.TOKEN) + return res.status(401).send('not-authorized') let testdata = [ {name: 'Test 1'}, |