This commit is contained in:
Flummi 2018-05-26 00:00:48 +00:00
parent b8b5265168
commit 4e9a5f54a9

View File

@ -93,18 +93,18 @@ module.exports = (lib) => {
else { else {
res.destroy(); res.destroy();
dat.end(); dat.end();
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' }); return 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) => { .on('error', (err) => {
dat.end(); dat.end();
cb({ success: false, file: tmpdest, msg: err.message }); return cb({ success: false, file: tmpdest, msg: err.message });
}) })
.pipe(dat); .pipe(dat);
} }
catch(ex) { catch(ex) {
dat.end(); dat.end();
cb({ success: false, file: tmpdest, msg: ex.message }); return cb({ success: false, file: tmpdest, msg: ex.message });
} }
} }
}); });
@ -125,7 +125,7 @@ module.exports = (lib) => {
} }
else { else {
dat.end(); dat.end();
cb({ success: false, file: tmpdest, msg: 'f0ck sc-api' }); return cb({ success: false, file: tmpdest, msg: 'f0ck sc-api' });
} }
}); });
} }
@ -155,17 +155,17 @@ module.exports = (lib) => {
} }
else { else {
dat.end(); dat.end();
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' }); return 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 { else {
dat.end(); dat.end();
cb({ success: false, file: tmpdest, msg: '' }); return cb({ success: false, file: tmpdest, msg: '' });
} }
} }
else { else {
dat.end(); dat.end();
cb({ success: false, file: tmpdest, msg: 'nope.' }); return cb({ success: false, file: tmpdest, msg: 'nope.' });
} }
}); });
} }
@ -185,27 +185,27 @@ module.exports = (lib) => {
info.ext = mime.ext; info.ext = mime.ext;
info.mime = mime.mime; info.mime = mime.mime;
if(lib.cfg.main.allowedMimes.hasOwnProperty(mime.mime) || info.type === 'soundcloud') if(lib.cfg.main.allowedMimes.hasOwnProperty(mime.mime) || info.type === 'soundcloud')
cb({ success: true, info: info, size: size, file: './b/' + tmpdest, checksum: cbcs }); return cb({ success: true, info: info, size: size, file: './b/' + tmpdest, checksum: cbcs });
else else
cb({ success: false, file: tmpdest, msg: 'lol, go f0ck yourself ('+mime.mime+')' }); return cb({ success: false, file: tmpdest, msg: 'lol, go f0ck yourself ('+mime.mime+')' });
} }
else else
cb({ success: false, file: tmpdest, msg: 'repost motherf0cker: '+lib.cfg.main.url+'/'+cbcrcs }); return cb({ success: false, file: tmpdest, msg: 'repost motherf0cker: '+lib.cfg.main.url+'/'+cbcrcs });
}); });
}); });
} }
}); });
} }
else { else {
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' }); return 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) => { .on('error', (err) => {
cb({ success: false, file: tmpdest, msg: err }); return cb({ success: false, file: tmpdest, msg: err });
}); });
} }
else else
cb({ success: false, file: tmpdest, msg: 'repost motherf0cker: '+lib.cfg.main.url+'/'+cbcr }); return cb({ success: false, file: tmpdest, msg: 'repost motherf0cker: '+lib.cfg.main.url+'/'+cbcr });
}); });
}; };
}; };