diff --git a/lib/webPanel.js b/lib/webPanel.js index b41d58d..a19e742 100644 --- a/lib/webPanel.js +++ b/lib/webPanel.js @@ -133,6 +133,50 @@ }; + /** + + * This function scans through any webPanel request. + * if the request contains the 'path' query parameter then it will pass it + * through a check that ensures the following: + - it contains logs + - it contains 20xx + - it is accessing a .json file + * if it passess the checks it sends the request to the next webPanel function + * otherwise it returns a json error message + + + + */ + + webPanel.use(function(req, res, next){ + + var path = req.query.path + + if(path!=null){ + + if(path.indexOf("logs")!=-1 && path.indexOf("20")!=-1 && path.indexOf(".json")!=-1) { + + next(); + + } else { + + var response = {}; + response.error = true; + res.json(response); + + + } + + } else { + + next(); + } + + + + + }); + /** * /api