From ff392f35ffbe77aa210a3db9f33b19334429adab Mon Sep 17 00:00:00 2001 From: Flummi Date: Thu, 27 Jul 2017 08:56:37 +0200 Subject: [PATCH] aktueller Stand --- bot.js | 4 ++-- s/contact.tpl.html | 3 +-- s/item.tpl.html | 2 +- src/cfg.js | 2 +- src/lib.js | 2 +- src/trigger/parser.js | 6 ++--- src/trigger/stats.js | 4 ++-- src/websrv.js | 51 ++++++++++++++++++++++--------------------- 8 files changed, 37 insertions(+), 37 deletions(-) diff --git a/bot.js b/bot.js index 9d80793..4e8892f 100644 --- a/bot.js +++ b/bot.js @@ -30,7 +30,7 @@ var child = new (forever.Monitor)(__dirname+'/src/main.js', { watch: true, watchIgnoreDotFiles: true, watchIgnorePatterns: [ - '*.log', 'b/*', 't/*', 'node_modules/*' + '*.log', 'b/*', 't/*', 'node_modules/* ./.*' ], watchDirectory: __dirname, outFile: log_bot, @@ -50,4 +50,4 @@ child.on('exit:code', (code) => { putlog('detected bot exited with code ' + code + '\n'); child.restart(); }); -child.start(); \ No newline at end of file +child.start(); diff --git a/s/contact.tpl.html b/s/contact.tpl.html index 08b525d..81759ab 100644 --- a/s/contact.tpl.html +++ b/s/contact.tpl.html @@ -6,8 +6,7 @@
-

This is a side project of w0bm.com

-

Got a problem? We have the answer: admin@w0bm.com

+

Got a problem? We have the answer: admin@f0ck.space

return to main
diff --git a/s/item.tpl.html b/s/item.tpl.html index 1e5a304..5f42851 100644 --- a/s/item.tpl.html +++ b/s/item.tpl.html @@ -7,7 +7,7 @@ - +
f0ck.me
diff --git a/src/cfg.js b/src/cfg.js index 46bf874..024ec0b 100644 --- a/src/cfg.js +++ b/src/cfg.js @@ -75,4 +75,4 @@ self.write = (kat, key, value, type, cb) => { }); } }); -}; \ No newline at end of file +}; diff --git a/src/lib.js b/src/lib.js index b9d0f88..1f3c467 100644 --- a/src/lib.js +++ b/src/lib.js @@ -240,4 +240,4 @@ self.genStdTrigger = () => { out[entry.name] = entry.active?true:false; }); return out; -}; \ No newline at end of file +}; diff --git a/src/trigger/parser.js b/src/trigger/parser.js index b10a36f..c487d2c 100644 --- a/src/trigger/parser.js +++ b/src/trigger/parser.js @@ -13,7 +13,7 @@ module.exports = (lib) => { name: 'parser', call: /https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi, level: 0, - active: 0, + active: 1, func: (e, userlevel) => { if(e.channel.getName() === lib.cfg.main.debugchannel || e.message.match(/(!|-)f0ck/i)) { if(!e.message.match(/(!|-)ignore/)) { @@ -137,7 +137,7 @@ module.exports = (lib) => { }, (err, res, data) => { if(!err) { - var type = res.headers['content-type']; + var type = res.headers['content-type'].split(";")[0]; lib.log('MimeType: '+type); if(lib.cfg.main.allowedMimes.hasOwnProperty(type)) { if( ( data.length <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 60 && data.length <= (lib.cfg.main.maxFileSize * 2) ) ) { @@ -208,4 +208,4 @@ module.exports = (lib) => { cb({ success: false, file: tmpdest, msg: 'repost motherf0cker: '+lib.cfg.main.url+'/'+cbcr }); }); }; -}; \ No newline at end of file +}; diff --git a/src/trigger/stats.js b/src/trigger/stats.js index cb73543..4f38f1a 100644 --- a/src/trigger/stats.js +++ b/src/trigger/stats.js @@ -8,10 +8,10 @@ module.exports = (lib) => { active: 0, func: (e) => { lib.sql.query("select count(`id`) as anzahl from `f0ck`.`items`", (err, rows, fields) => { - var ret = "f0ck gave "+String(rows[0].anzahl); + var ret = "gave "+String(rows[0].anzahl); du('./b/', function (err, size) { ret += " f0cks ("+lib.formatSize(size)+")"; - e.reply(ret); + e.replyAction(ret); }) }); }, diff --git a/src/websrv.js b/src/websrv.js index b0b0eed..bb3df8b 100644 --- a/src/websrv.js +++ b/src/websrv.js @@ -179,30 +179,30 @@ function Websrv(tlib) { || contentType === "audio/mpeg" || contentType === "audio/ogg") && req.headers['range']) { fs.readFile(filePath, "binary", function(err, file) { - if(typeof req.headers.range !== 'undefined') { - var range = req.headers.range; - var parts = range.replace(/bytes=/, "").split("-"); - var partialstart = parts[0]; - var partialend = parts[1]; - var total = file.length; - var start = parseInt(partialstart, 10); - var end = partialend ? parseInt(partialend, 10) : total-1; + if(typeof req.headers.range !== 'undefined') { + var range = req.headers.range; + var parts = range.replace(/bytes=/, "").split("-"); + var partialstart = parts[0]; + var partialend = parts[1]; + var total = file.length; + var start = parseInt(partialstart, 10); + var end = partialend ? parseInt(partialend, 10) : total-1; - res.writeHead(206, { - "Content-Range": "bytes " + start + "-" + end + "/" + (total), - "Accept-Ranges": "bytes", - "Content-Length": (end-start)+1, - "Transfer-Encoding": "chunked", - "Connection": "close" - }); - res.write(file.slice(start, end)+'0', "binary"); - } - else { - res.writeHead(200); - res.write(file, "binary"); - } - res.end(); - }); + res.writeHead(206, { + "Content-Range": "bytes " + start + "-" + end + "/" + (total), + "Accept-Ranges": "bytes", + "Content-Length": (end-start)+1, + "Transfer-Encoding": "chunked", + "Connection": "close" + }); + res.write(file.slice(start, end)+'0', "binary"); + } + else { + res.writeHead(200); + res.write(file, "binary"); + } + res.end(); + }); } else { fs.readFile(filePath, (error, content) => { @@ -218,7 +218,8 @@ function Websrv(tlib) { } } else { - res.writeHead(200, { 'Content-Type': contentType, 'Content-Length': content.length, 'Cache-Control': 'max-age=2592000, public' }); + //res.writeHead(200, { 'Content-Type': contentType, 'Content-Length': content.length, 'Cache-Control': 'max-age=2592000, public' }); + res.writeHead(200); res.end(content, 'utf-8'); } }); @@ -311,4 +312,4 @@ Websrv.prototype.getTpls = () => { "how": fs.readFileSync("./s/how.tpl.html", "utf-8"), "contact": fs.readFileSync("./s/contact.tpl.html", "utf-8") }; -}; \ No newline at end of file +};