This commit is contained in:
Flummi 2017-03-15 11:56:54 +01:00
parent 8630395dfb
commit 4571f95c54

View File

@ -81,7 +81,7 @@ module.exports = (lib) => {
dlformat = { filter: (format) => { return format.container === 'webm'; } };
ytdl.downloadFromInfo(inf, dlformat)
.on('response', (res) => {
if( ( res.headers['content-length'] <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 70 && res.headers['content-length'] <= (lib.cfg.main.maxFileSize * 2) ) ) {
if( ( res.headers['content-length'] <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 60 && res.headers['content-length'] <= (lib.cfg.main.maxFileSize * 2) ) ) {
info = {
type: 'youtube',
title: title,
@ -93,7 +93,7 @@ module.exports = (lib) => {
else {
res.destroy();
dat.end();
cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(res.headers['content-length'])+'), max '+lib.formatSize( ( userlevel >= 70?(lib.cfg.main.maxFileSize*2):lib.cfg.main.maxFileSize ) )+' allowed' });
cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(res.headers['content-length'])+'), max '+lib.formatSize( ( userlevel >= 60?(lib.cfg.main.maxFileSize*2):lib.cfg.main.maxFileSize ) )+' allowed' });
}
})
.on('error', (err) => {
@ -140,7 +140,7 @@ module.exports = (lib) => {
var type = res.headers['content-type'];
lib.log('MimeType: '+type);
if(lib.cfg.main.allowedMimes.hasOwnProperty(type)) {
if( ( data.length <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 70 && data.length <= (lib.cfg.main.maxFileSize * 2) ) ) {
if( ( data.length <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 60 && data.length <= (lib.cfg.main.maxFileSize * 2) ) ) {
var s = new Readable;
s.push(data);
s.push(null);
@ -155,7 +155,7 @@ module.exports = (lib) => {
}
else {
dat.end();
cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(data.length)+'), max '+lib.formatSize( ( userlevel >= 70?(lib.cfg.main.maxFileSize*2):lib.cfg.main.maxFileSize ) )+' allowed' });
cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(data.length)+'), max '+lib.formatSize( ( userlevel >= 60?(lib.cfg.main.maxFileSize*2):lib.cfg.main.maxFileSize ) )+' allowed' });
}
}
else {
@ -174,7 +174,7 @@ module.exports = (lib) => {
.on('finish', () => {
var size = dat.bytesWritten;
dat.end();
if( ( size <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 70 && size <= (lib.cfg.main.maxFileSize * 2) ) ) {
if( ( size <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 60 && size <= (lib.cfg.main.maxFileSize * 2) ) ) {
fs.stat('./b/' + tmpdest, (err, stat) => {
if(!err && stat.isFile() && stat.size > 300) {
lib.log('Datei '+tmpdest+' existiert');
@ -197,7 +197,7 @@ module.exports = (lib) => {
});
}
else {
cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(size)+'), max '+lib.formatSize( ( userlevel >= 70?(lib.cfg.main.maxFileSize*2):lib.cfg.main.maxFileSize ) )+' allowed' });
cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(size)+'), max '+lib.formatSize( ( userlevel >= 60?(lib.cfg.main.maxFileSize*2):lib.cfg.main.maxFileSize ) )+' allowed' });
}
})
.on('error', (err) => {