aktueller Stand

This commit is contained in:
Flummi
2017-07-27 08:56:37 +02:00
parent 19c2d224b1
commit ff392f35ff
8 changed files with 37 additions and 37 deletions

View File

@ -75,4 +75,4 @@ self.write = (kat, key, value, type, cb) => {
});
}
});
};
};

View File

@ -240,4 +240,4 @@ self.genStdTrigger = () => {
out[entry.name] = entry.active?true:false;
});
return out;
};
};

View File

@ -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 });
});
};
};
};

View File

@ -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);
})
});
},

View File

@ -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")
};
};
};