damn
This commit is contained in:
parent
aa3dc93eeb
commit
7398dba271
@ -20,7 +20,7 @@ module.exports = (lib, userlevel) => {
|
|||||||
var tmp = e.message.match(/https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi); // get links
|
var tmp = e.message.match(/https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi); // get links
|
||||||
tmp.forEach((entry,i,a) => {
|
tmp.forEach((entry,i,a) => {
|
||||||
if(!entry.match(/f0ck\.me/i) && !entry.match(/\.onion/i)) {
|
if(!entry.match(/f0ck\.me/i) && !entry.match(/\.onion/i)) {
|
||||||
getLink(entry, (e.message.match(/(!|-)force/i)?true:false), (cb) => {
|
getLink(entry, ((e.message.match(/(!|-)force/i) && userlevel >= 100)?true:false), (cb) => {
|
||||||
if(cb.success === true) {
|
if(cb.success === true) {
|
||||||
fs.move(cb.file, cb.file + '.' + cb.info.ext, (err) => {
|
fs.move(cb.file, cb.file + '.' + cb.info.ext, (err) => {
|
||||||
if(!err) {
|
if(!err) {
|
||||||
@ -72,7 +72,6 @@ module.exports = (lib, userlevel) => {
|
|||||||
if(cbcr === true) {
|
if(cbcr === true) {
|
||||||
var dat = fs.createWriteStream('./b/' + tmpdest);
|
var dat = fs.createWriteStream('./b/' + tmpdest);
|
||||||
var info;
|
var info;
|
||||||
|
|
||||||
if(url.match(yt)) { // ytdl
|
if(url.match(yt)) { // ytdl
|
||||||
ytdl.getInfo(url, (err, inf) => {
|
ytdl.getInfo(url, (err, inf) => {
|
||||||
if(!err) {
|
if(!err) {
|
||||||
@ -81,7 +80,7 @@ module.exports = (lib, userlevel) => {
|
|||||||
try {
|
try {
|
||||||
ytdl.downloadFromInfo(inf, { filter: (format) => { return format.container === 'webm'; } })
|
ytdl.downloadFromInfo(inf, { filter: (format) => { return format.container === 'webm'; } })
|
||||||
.on('response', (res) => {
|
.on('response', (res) => {
|
||||||
if( ( res.headers['content-length'] <= lib.cfg.main.maxFileSize ) || ( userlevel >= 100 && force ) ) {
|
if( ( res.headers['content-length'] <= lib.cfg.main.maxFileSize ) || force ) {
|
||||||
info = {
|
info = {
|
||||||
type: 'youtube',
|
type: 'youtube',
|
||||||
title: title,
|
title: title,
|
||||||
@ -141,7 +140,7 @@ module.exports = (lib, userlevel) => {
|
|||||||
lib.log('MimeType: '+type);
|
lib.log('MimeType: '+type);
|
||||||
var length = res.headers['content-length'];
|
var length = res.headers['content-length'];
|
||||||
if(lib.cfg.main.allowedMimes.hasOwnProperty(type)) {
|
if(lib.cfg.main.allowedMimes.hasOwnProperty(type)) {
|
||||||
if( ( data.length <= lib.cfg.main.maxFileSize ) || ( userlevel >= 100 && force ) ) {
|
if( ( data.length <= lib.cfg.main.maxFileSize ) || force ) {
|
||||||
var s = new Readable
|
var s = new Readable
|
||||||
s.push(data);
|
s.push(data);
|
||||||
s.push(null);
|
s.push(null);
|
||||||
|
Loading…
Reference in New Issue
Block a user