mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-14 08:26:22 +00:00
IP whitelisting
This commit is contained in:
parent
a246fc8365
commit
d25193bb31
@ -4,8 +4,9 @@ const db = require('knex')(config.database)
|
|||||||
let galleryController = {}
|
let galleryController = {}
|
||||||
|
|
||||||
galleryController.list = function(req, res, next){
|
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.privacy.public)
|
||||||
|
if(!config.privacy.IPs.includes(req.ip)) return res.status(401).send('Not Authorized!')
|
||||||
|
|
||||||
db.table('gallery').select('id', 'name').then((data) => {
|
db.table('gallery').select('id', 'name').then((data) => {
|
||||||
res.json({ data })
|
res.json({ data })
|
||||||
@ -13,8 +14,9 @@ galleryController.list = function(req, res, next){
|
|||||||
}
|
}
|
||||||
|
|
||||||
galleryController.test = 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.privacy.public)
|
||||||
|
if(!config.privacy.IPs.includes(req.ip)) return res.status(401).send('Not Authorized!')
|
||||||
|
|
||||||
let testdata = [
|
let testdata = [
|
||||||
{name: 'Test 1'},
|
{name: 'Test 1'},
|
||||||
|
@ -4,7 +4,10 @@ const uploadController = require('../controllers/uploadController')
|
|||||||
const galleryController = require('../controllers/galleryController')
|
const galleryController = require('../controllers/galleryController')
|
||||||
|
|
||||||
routes.get ('/info', (req, res, next) => {
|
routes.get ('/info', (req, res, next) => {
|
||||||
res.json({
|
if(!config.privacy.public)
|
||||||
|
if(!config.privacy.IPs.includes(req.ip)) return res.status(401).send('Not Authorized!')
|
||||||
|
|
||||||
|
return res.json({
|
||||||
maxFileSize: config.uploads.maxsize.slice(0, -2),
|
maxFileSize: config.uploads.maxsize.slice(0, -2),
|
||||||
urlPrefix: config.uploads.prefix
|
urlPrefix: config.uploads.prefix
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user