var express = require('express'); var router = express.Router(); var ntr = require("../neutral-functions.js"); var fs = require("fs") var path = require("path") router.get("/", function(req,res,next) { var check = ntr.checkToken(req, res) if(check.name != false) { if(req.headers.filerequest != null && check.permLevel >= 3) { if(fs.existsSync(req.headers.filerequest)) { res.download(req.headers.filerequest, (error) => { if(error) { res.send({"result":"ERROR"}) } }) } else { res.send({"result":"ERROR"}) } } else { res.redirect("/") } } else { res.render('login', {error: ""}); } }) module.exports = router;