ip-whitelist
This commit is contained in:
parent
5ab7713f97
commit
06c9ab5411
19
src/main.js
19
src/main.js
|
@ -165,7 +165,7 @@ var loadUser = (cb) => {
|
|||
}).on('error', () => {
|
||||
cb(false);
|
||||
});;
|
||||
}
|
||||
};
|
||||
|
||||
var dl = (url, dest, cb) => {
|
||||
var request = (url.match(/^https/)?https:http).get(url, (response) => { // type:1=post,type:2=stfu
|
||||
|
@ -231,6 +231,7 @@ var getCheckSum = (file, cbcs) => {
|
|||
|
||||
// Webserver
|
||||
http.createServer((req, res) => {
|
||||
if(cfg.wlip.hasOwnProperty(req.connection.remoteAddress)) {
|
||||
var filePath = '.' + req.url;
|
||||
var url = req.url.split("/")[1];
|
||||
if(filePath == './')
|
||||
|
@ -404,6 +405,11 @@ http.createServer((req, res) => {
|
|||
res.writeHead(404);
|
||||
res.end('404 - f0ck you', 'utf-8');
|
||||
}
|
||||
}
|
||||
else {
|
||||
res.writeHead(403);
|
||||
res.end('403 - forbidden');
|
||||
}
|
||||
}).listen(cfg.webserver.port);
|
||||
|
||||
var getTpls = () => {
|
||||
|
@ -415,12 +421,6 @@ var getTpls = () => {
|
|||
"scripts": fs.readFileSync("./s/scripts.tpl.html", "utf-8")
|
||||
};
|
||||
};
|
||||
getTpls();
|
||||
|
||||
// Thumbnailbackgroundworker
|
||||
|
||||
setInterval(()=>{generateThumbs();}, 60000); // 1 minute
|
||||
setTimeout(()=>{generateThumbs();}, 5000); // 5 seconds (start)
|
||||
|
||||
var generateThumbs = () => {
|
||||
var outdir = './t/';
|
||||
|
@ -441,4 +441,7 @@ var generateThumbs = () => {
|
|||
});
|
||||
};
|
||||
|
||||
loadUser((cb)=>{});
|
||||
loadUser((cb)=>{
|
||||
console.log((cb)?"Admins wurden geladen":"Admins konnten nicht geladen werden");
|
||||
});
|
||||
getTpls();
|
Loading…
Reference in New Issue
Block a user