modified: src/main.js
This commit is contained in:
parent
6b5089f19b
commit
ac505387c6
25
src/main.js
25
src/main.js
|
@ -131,4 +131,27 @@ var checkRepost = (url, cbcr) => {
|
|||
var formatSize = (size) => {
|
||||
var i = Math.floor(Math.log(size) / Math.log(1024));
|
||||
return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Webserver
|
||||
var handleRequest = (request, response) => {
|
||||
var tmpres = "";
|
||||
if(request.url == "/") {
|
||||
sql.query("select * from `f0ck`.`items`", (err, rows, fields) => {
|
||||
rows.forEach((e,i,a) => {
|
||||
tmpres += e.src+"\n";
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
tmpres = "404";
|
||||
}
|
||||
setTimeout(()=>{response.end(tmpres);},1000);
|
||||
};
|
||||
|
||||
var server = http.createServer(handleRequest);
|
||||
server.listen(cfg.webserver.port, () => {
|
||||
console.log("Server listening on: http://localhost:%s", cfg.webserver.port);
|
||||
});
|
Loading…
Reference in New Issue
Block a user