modified: src/main.js

This commit is contained in:
Flummi 2016-08-21 12:43:13 +02:00
parent c7d8783906
commit 611a7e4d61

View File

@ -101,7 +101,7 @@ bot.on('message', (e) => {
}
else if(orig.match(/^\.user/)) { // (debug) get userinfos
var tmp = getUser(e.user.getNick(), e.network);
setTimeout(()=>{ e.reply(tmp); }, 1500);
setTimeout(()=>{ e.reply(tmp); }, 500);
}
else if(orig.match(/^\!reload tpl$/)) {
getTpls();
@ -217,15 +217,13 @@ var dl = (url, dest, cb) => {
file.close();
probe(dest+"."+cfg.allowedMimes[response.headers['content-type']], (err, probeData) => {
if(probeData.streams[0].height !== undefined || probeData.streams[0].width !== undefined) {
if(probeData.streams[0].height <= cfg.minRes || probeData.streams[0].width <= cfg.minRes) {
cb({'status':false, 'msg':'f0ck! your file is too small ('+probeData.streams[0].width+' x '+probeData.streams[0].height+'), min '+cfg.minRes+' x '+cfg.minRes+' required', 'type':1});
}
if(probeData.streams[0].height <= cfg.minRes || probeData.streams[0].width <= cfg.minRes)
cb({'status':false, 'msg':'f0ck! your shitpost is too small ('+probeData.streams[0].width+' x '+probeData.streams[0].height+'), min '+cfg.minRes+' x '+cfg.minRes+' required', 'type':1});
else
cb({'status':true, 'msg':'downloaded '+dest, 'type':1, 'infos':{'mime':response.headers['content-type'], 'size':response.headers['content-length'], 'ext':cfg.allowedMimes[response.headers['content-type']]}});
}
else {
else
cb({'status':true, 'msg':'downloaded '+dest, 'type':1, 'infos':{'mime':response.headers['content-type'], 'size':response.headers['content-length'], 'ext':cfg.allowedMimes[response.headers['content-type']]}});
}
});
});
file.on('error', (err) => {
@ -271,8 +269,7 @@ var getCheckSum = (file, cbcs) => {
sha256sum.update(d);
});
s.on('end', () => {
var generated_hash = sha256sum.digest('hex');
cbcs(generated_hash);
cbcs(sha256sum.digest('hex'));
});
};
@ -473,27 +470,6 @@ var getTpls = () => {
};
};
/*var generateThumbs = () => {
var outdir = './t/';
var thumbnail = '';
sql.query("select * from `f0ck`.`items`", (err, rows, fields) => {
rows.forEach((e,i,a) => {
thumbnail = outdir+e.id+'.png';
if(!fs.existsSync(thumbnail)) {
exec('ffmpegthumbnailer -i'+e.dest+' -o'+thumbnail+' -a', (error) => {
if(error) {
log("failed thumbnail for "+e.id+" ("+e.mime+")");
fs.unlink(thumbnail); //
fs.copySync('./s/mp3.png', thumbnail); // copy standardthumbnail
}
else
log("generated thumbnail for "+e.id+" ("+e.mime+")");
});
}
});
});
};*/
var generateThumbs = () => {
var outdir = './t/';
sql.query("select * from `f0ck`.`items`", (err, rows, fields) => {