maxfilesize * 2 fuer Admins
This commit is contained in:
parent
e250cc7a48
commit
668de1ffbb
|
@ -20,7 +20,7 @@ module.exports = (lib) => {
|
|||
var tmp = e.message.match(/https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi); // get links
|
||||
tmp.forEach((entry,i,a) => {
|
||||
if(!entry.match(/f0ck\.me/i) && !entry.match(/\.onion/i)) {
|
||||
getLink(entry, ((e.message.match(/(!|-)force/i) && userlevel >= 100)?true:false), (e.message.match(/(!|-)audio/i)?true:false), (cb) => {
|
||||
getLink(entry, ((e.message.match(/(!|-)force/i) && userlevel >= 100)?true:false), userlevel, (cb) => {
|
||||
if(cb.success === true) {
|
||||
fs.move(cb.file, cb.file + '.' + cb.info.ext, (err) => {
|
||||
if(!err) {
|
||||
|
@ -64,7 +64,7 @@ module.exports = (lib) => {
|
|||
desc: 'muh'
|
||||
});
|
||||
|
||||
var getLink = (url, force, m4a, cb) => {
|
||||
var getLink = (url, force, userlevel, cb) => {
|
||||
var yt = /https?:\/\/(www\.)?youtu(\.be\/|be\.com\/)((.+\/)?(watch(\?v=|.+&v=))?(v=)?)([\w_-]{11})(&.+)?/gi;
|
||||
var sc = /https?:\/\/(www\.)?(soundcloud\.com|snd\.sc)(\/\S*)(\/\S*)/gi;
|
||||
lib.checkRepost(url, (cbcr) => {
|
||||
|
@ -78,21 +78,15 @@ module.exports = (lib) => {
|
|||
var title = inf.title;
|
||||
var iurl = inf.iurl;
|
||||
try {
|
||||
//var dlformat = (m4a?'audioonly':'webm');
|
||||
var dlformat;
|
||||
if(m4a)
|
||||
dlformat = { format: '171' };
|
||||
else
|
||||
dlformat = { filter: (format) => { return format.container === 'webm'; } };
|
||||
|
||||
dlformat = { filter: (format) => { return format.container === 'webm'; } };
|
||||
ytdl.downloadFromInfo(inf, dlformat)
|
||||
.on('response', (res) => {
|
||||
if( ( res.headers['content-length'] <= lib.cfg.main.maxFileSize ) || force ) {
|
||||
if( ( res.headers['content-length'] <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 70 && res.headers['content-length'] >= (lib.cfg.main.maxFileSize * 2) ) ) {
|
||||
info = {
|
||||
type: 'youtube',
|
||||
title: title,
|
||||
mime: (m4a?'audio/mpeg':'video/webm'),
|
||||
ext: (m4a?'mp3':'webm'),
|
||||
mime: video/webm',
|
||||
ext: 'webm',
|
||||
thumb: iurl
|
||||
};
|
||||
}
|
||||
|
@ -147,7 +141,7 @@ module.exports = (lib) => {
|
|||
lib.log('MimeType: '+type);
|
||||
var length = res.headers['content-length'];
|
||||
if(lib.cfg.main.allowedMimes.hasOwnProperty(type)) {
|
||||
if( ( data.length <= lib.cfg.main.maxFileSize ) || force ) {
|
||||
if( ( data.length <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 70 && res.headers['content-length'] >= (lib.cfg.main.maxFileSize * 2) ) ) {
|
||||
var s = new Readable
|
||||
s.push(data);
|
||||
s.push(null);
|
||||
|
@ -181,7 +175,7 @@ module.exports = (lib) => {
|
|||
.on('finish', () => {
|
||||
var size = dat.bytesWritten;
|
||||
dat.end();
|
||||
if( ( size <= lib.cfg.main.maxFileSize ) || force ) {
|
||||
if( ( size <= lib.cfg.main.maxFileSize ) || force || ( userlevel >= 70 && res.headers['content-length'] >= (lib.cfg.main.maxFileSize * 2) ) ) {
|
||||
fs.stat('./b/' + tmpdest, (err, stat) => {
|
||||
if(!err && stat.isFile() && stat.size > 300) {
|
||||
lib.log('Datei '+tmpdest+' existiert');
|
||||
|
|
Loading…
Reference in New Issue
Block a user