muh
This commit is contained in:
parent
805c7605c8
commit
7c87736cb3
12
src/lib.js
12
src/lib.js
@ -88,13 +88,13 @@ Lib.prototype.loadUser = (cb) => {
|
||||
});
|
||||
}
|
||||
Lib.prototype.checkRepost = (url, cbcr) => {
|
||||
sql.query("select count(*) as count from `f0ck`.`items` where `src` = ?", url, (err, rows, fields) => {
|
||||
cbcr((rows[0].count == 0)?true:false);
|
||||
sql.query("select count(id) as count, id from `f0ck`.`items` where `src` = ?", url, (err, rows, fields) => {
|
||||
cbcr((rows[0].count == 0)?true:rows[0].id);
|
||||
});
|
||||
};
|
||||
Lib.prototype.checkRepostCheckSum = (cs, cbcrcs) => {
|
||||
sql.query("select count(*) as count from `f0ck`.`items` where `checksum` = ?", cs, (err, rows, fields) => {
|
||||
cbcrcs((rows[0].count == 0)?true:false);
|
||||
sql.query("select count(id) as count, id from `f0ck`.`items` where `checksum` = ?", cs, (err, rows, fields) => {
|
||||
cbcrcs((rows[0].count == 0)?true:rows[0].id);
|
||||
});
|
||||
};
|
||||
Lib.prototype.formatSize = (size) => {
|
||||
@ -117,7 +117,7 @@ Lib.prototype.dl = (url, dest, cb) => {
|
||||
if(cfg.allowedMimes.hasOwnProperty(response.headers['content-type'])) {
|
||||
if(response.headers['content-length'] <= cfg.maxFileSize) {
|
||||
Lib.prototype.checkRepost(url, (cbcr) => {
|
||||
if(cbcr) {
|
||||
if(cbcr === true) {
|
||||
var file = fs.createWriteStream(dest+"."+cfg.allowedMimes[response.headers['content-type']]);
|
||||
response.pipe(file);
|
||||
file.on('finish', () => {
|
||||
@ -145,7 +145,7 @@ Lib.prototype.dl = (url, dest, cb) => {
|
||||
});
|
||||
}
|
||||
else
|
||||
cb({'status':false, 'msg':'repost motherf0cker', 'type':1});
|
||||
cb({'status':false, 'msg':'repost motherf0cker: https://f0ck.me/'+cbrc, 'type':1});
|
||||
});
|
||||
}
|
||||
else
|
||||
|
@ -20,7 +20,7 @@ module.exports = (bot, trigger, lib) => {
|
||||
lib.getUser(e, (cbgu) => {
|
||||
lib.getCheckSum("./b/"+tmpdest+"."+cb.infos.ext, (cbcs) => {
|
||||
lib.checkRepostCheckSum(cbcs, (cbcrcs) => {
|
||||
if(cbcrcs) {
|
||||
if(cbcrcs === true) {
|
||||
lib.sql.query("insert into `f0ck`.`items` (`src`,`dest`,`mime`,`size`,`checksum`,`username`,`userchannel`,`usernetwork`,`stamp`,`active`) values (?,?,?,?,?,?,?,?,?,?)", [
|
||||
entry,
|
||||
"./b/"+tmpdest+"."+cb.infos.ext,
|
||||
@ -41,7 +41,7 @@ module.exports = (bot, trigger, lib) => {
|
||||
}
|
||||
else {
|
||||
fs.unlink("./b/"+tmpdest+"."+cb.infos.ext); // delete repost
|
||||
e.reply("repost motherf0cker");
|
||||
e.reply("repost motherf0cker: https://f0ck.me/"+cbcrcs);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -48,7 +48,7 @@ module.exports = (bot, trigger, lib) => {
|
||||
lib.getUser(e, (cbgu) => {
|
||||
lib.getCheckSum("./b/"+tmpdest+".webm", (cbcs) => {
|
||||
lib.checkRepostCheckSum(cbcs, (cbcrcs) => {
|
||||
if(cbcrcs) {
|
||||
if(cbcrcs === true) {
|
||||
lib.sql.query("insert into `f0ck`.`items` (`src`,`dest`,`mime`,`size`,`checksum`,`username`,`userchannel`,`usernetwork`,`stamp`,`active`) values (?,?,?,?,?,?,?,?,?,?)", [
|
||||
entry,
|
||||
"./b/"+tmpdest+".webm",
|
||||
@ -69,7 +69,7 @@ module.exports = (bot, trigger, lib) => {
|
||||
}
|
||||
else {
|
||||
fs.unlink("./b/"+tmpdest+".webm"); // delete repost
|
||||
e.reply("repost motherf0cker");
|
||||
e.reply("repost motherf0cker: https://f0ck.me/"+cbcrcs);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user