This commit is contained in:
Flummi 2016-11-02 17:49:40 +01:00
parent 3969b0a092
commit 068d6b17e4
2 changed files with 10 additions and 10 deletions

2
bot.js
View File

@ -26,7 +26,7 @@ var child = new (forever.Monitor)(__dirname+'/src/main.js', {
silent: false,
cwd: __dirname,
args: [],
spinSleepTime: 2000,
spinSleepTime: 5000,
watch: true,
watchIgnoreDotFiles: true,
watchIgnorePatterns: [

View File

@ -84,7 +84,7 @@ module.exports = (lib) => {
.on('response', (res) => {
if(res.headers['content-length'] > cfg.maxFileSize) {
res.destroy();
dat.close();
dat.end();
cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(res.headers['content-length'])+'), max '+lib.formatSize(cfg.maxFileSize)+' allowed' });
}
else {
@ -98,13 +98,13 @@ module.exports = (lib) => {
}
})
.on('error', (err) => {
dat.close();
cb({ success: false, file: tmpdest, msg: ex });
dat.end();
cb({ success: false, file: tmpdest, msg: err.message });
})
.pipe(dat);
}
catch(ex) {
dat.close();
dat.end();
cb({ success: false, file: tmpdest, msg: ex.message });
}
}
@ -125,7 +125,7 @@ module.exports = (lib) => {
};
}
else {
dat.close();
dat.end();
cb({ success: false, file: tmpdest, msg: 'f0ck sc-api' });
}
});
@ -156,17 +156,17 @@ module.exports = (lib) => {
};
}
else {
dat.close();
dat.end();
cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(data.length)+'), max '+lib.formatSize(cfg.maxFileSize)+' allowed' });
}
}
else {
dat.close();
dat.end();
cb({ success: false, file: tmpdest, msg: '' });
}
}
else {
dat.close();
dat.end();
cb({ success: false, file: tmpdest, msg: err });
}
});
@ -175,7 +175,7 @@ module.exports = (lib) => {
dat
.on('finish', () => {
var size = dat.bytesWritten;
dat.close();
dat.end();
if(size > cfg.maxFileSize)
cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(size)+'), max '+lib.formatSize(cfg.maxFileSize)+' allowed' });
else {