fix: qr loading

This commit is contained in:
2023-02-28 20:29:49 -06:00
parent 8147b3dedb
commit d99ab88836
5 changed files with 786 additions and 91 deletions

1
app.js
View File

@@ -6,6 +6,7 @@ global.provider = process.env.PROVIDER || 'wwebjs';
const fs = require('fs');
global.siguientePaso = [{"numero":"1", "va":"XXX"}]; //MOD by CHV - Agregamos para pasar el VAMOSA a "index.js"
global.pasoAnterior = [];
global.socketioStatus = ""
global.vars = []
// const mysqlConnection = require('./config/mysql')
if( provider == 'baileys' ){ const { initBot } = require(`./provider/baileys`) }

735
package-lock.json generated
View File

@@ -100,6 +100,19 @@
"node": ">=6.0.0"
}
},
"node_modules/@babel/runtime": {
"version": "7.21.0",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz",
"integrity": "sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==",
"optional": true,
"peer": true,
"dependencies": {
"regenerator-runtime": "^0.13.11"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@fast-csv/format": {
"version": "4.3.5",
"resolved": "https://registry.npmjs.org/@fast-csv/format/-/format-4.3.5.tgz",
@@ -209,6 +222,570 @@
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
"integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="
},
"node_modules/@jimp/bmp": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.16.13.tgz",
"integrity": "sha512-9edAxu7N2FX7vzkdl5Jo1BbACfycUtBQX+XBMcHA2bk62P8R0otgkHg798frgAk/WxQIzwxqOH6wMiCwrlAzdQ==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13",
"bmp-js": "^0.1.0"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/core": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.16.13.tgz",
"integrity": "sha512-qXpA1tzTnlkTku9yqtuRtS/wVntvE6f3m3GNxdTdtmc+O+Wcg9Xo2ABPMh7Nc0AHbMKzwvwgB2JnjZmlmJEObg==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13",
"any-base": "^1.1.0",
"buffer": "^5.2.0",
"exif-parser": "^0.1.12",
"file-type": "^16.5.4",
"load-bmfont": "^1.3.1",
"mkdirp": "^0.5.1",
"phin": "^2.9.1",
"pixelmatch": "^4.0.2",
"tinycolor2": "^1.4.1"
}
},
"node_modules/@jimp/core/node_modules/file-type": {
"version": "16.5.4",
"resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz",
"integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==",
"optional": true,
"peer": true,
"dependencies": {
"readable-web-to-node-stream": "^3.0.0",
"strtok3": "^6.2.4",
"token-types": "^4.1.1"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sindresorhus/file-type?sponsor=1"
}
},
"node_modules/@jimp/core/node_modules/mkdirp": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
"integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
"optional": true,
"peer": true,
"dependencies": {
"minimist": "^1.2.6"
},
"bin": {
"mkdirp": "bin/cmd.js"
}
},
"node_modules/@jimp/core/node_modules/peek-readable": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.1.0.tgz",
"integrity": "sha512-ZI3LnwUv5nOGbQzD9c2iDG6toheuXSZP5esSHBjopsXH4dg19soufvpUGA3uohi5anFtGb2lhAVdHzH6R/Evvg==",
"optional": true,
"peer": true,
"engines": {
"node": ">=8"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/Borewit"
}
},
"node_modules/@jimp/core/node_modules/strtok3": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.3.0.tgz",
"integrity": "sha512-fZtbhtvI9I48xDSywd/somNqgUHl2L2cstmXCCif0itOf96jeW18MBSyrLuNicYQVkvpOxkZtkzujiTJ9LW5Jw==",
"optional": true,
"peer": true,
"dependencies": {
"@tokenizer/token": "^0.3.0",
"peek-readable": "^4.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/Borewit"
}
},
"node_modules/@jimp/core/node_modules/token-types": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/token-types/-/token-types-4.2.1.tgz",
"integrity": "sha512-6udB24Q737UD/SDsKAHI9FCRP7Bqc9D/MQUV02ORQg5iskjtLJlZJNdN4kKtcdtwCeWIwIHDGaUsTsCCAa8sFQ==",
"optional": true,
"peer": true,
"dependencies": {
"@tokenizer/token": "^0.3.0",
"ieee754": "^1.2.1"
},
"engines": {
"node": ">=10"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/Borewit"
}
},
"node_modules/@jimp/custom": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.16.13.tgz",
"integrity": "sha512-LTATglVUPGkPf15zX1wTMlZ0+AU7cGEGF6ekVF1crA8eHUWsGjrYTB+Ht4E3HTrCok8weQG+K01rJndCp/l4XA==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/core": "^0.16.13"
}
},
"node_modules/@jimp/gif": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.16.13.tgz",
"integrity": "sha512-yFAMZGv3o+YcjXilMWWwS/bv1iSqykFahFMSO169uVMtfQVfa90kt4/kDwrXNR6Q9i6VHpFiGZMlF2UnHClBvg==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13",
"gifwrap": "^0.9.2",
"omggif": "^1.0.9"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/jpeg": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.16.13.tgz",
"integrity": "sha512-BJHlDxzTlCqP2ThqP8J0eDrbBfod7npWCbJAcfkKqdQuFk0zBPaZ6KKaQKyKxmWJ87Z6ohANZoMKEbtvrwz1AA==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13",
"jpeg-js": "^0.4.2"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-blit": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.16.13.tgz",
"integrity": "sha512-8Z1k96ZFxlhK2bgrY1JNWNwvaBeI/bciLM0yDOni2+aZwfIIiC7Y6PeWHTAvjHNjphz+XCt01WQmOYWCn0ML6g==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-blur": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.16.13.tgz",
"integrity": "sha512-PvLrfa8vkej3qinlebyhLpksJgCF5aiysDMSVhOZqwH5nQLLtDE9WYbnsofGw4r0VVpyw3H/ANCIzYTyCtP9Cg==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-circle": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.16.13.tgz",
"integrity": "sha512-RNave7EFgZrb5V5EpdvJGAEHMnDAJuwv05hKscNfIYxf0kR3KhViBTDy+MoTnMlIvaKFULfwIgaZWzyhuINMzA==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-color": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.16.13.tgz",
"integrity": "sha512-xW+9BtEvoIkkH/Wde9ql4nAFbYLkVINhpgAE7VcBUsuuB34WUbcBl/taOuUYQrPEFQJ4jfXiAJZ2H/rvKjCVnQ==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13",
"tinycolor2": "^1.4.1"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-contain": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.16.13.tgz",
"integrity": "sha512-QayTXw4tXMwU6q6acNTQrTTFTXpNRBe+MgTGMDU0lk+23PjlFCO/9sacflelG8lsp7vNHhAxFeHptDMAksEYzg==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
"@jimp/plugin-blit": ">=0.3.5",
"@jimp/plugin-resize": ">=0.3.5",
"@jimp/plugin-scale": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-cover": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.16.13.tgz",
"integrity": "sha512-BSsP71GTNaqWRcvkbWuIVH+zK7b3TSNebbhDkFK0fVaUTzHuKMS/mgY4hDZIEVt7Rf5FjadAYtsujHN9w0iSYA==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
"@jimp/plugin-crop": ">=0.3.5",
"@jimp/plugin-resize": ">=0.3.5",
"@jimp/plugin-scale": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-crop": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.16.13.tgz",
"integrity": "sha512-WEl2tPVYwzYL8OKme6Go2xqiWgKsgxlMwyHabdAU4tXaRwOCnOI7v4021gCcBb9zn/oWwguHuKHmK30Fw2Z/PA==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-displace": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.16.13.tgz",
"integrity": "sha512-qt9WKq8vWrcjySa9DyQ0x/RBMHQeiVjdVSY1SJsMjssPUf0pS74qorcuAkGi89biN3YoGUgPkpqECnAWnYwgGA==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-dither": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.16.13.tgz",
"integrity": "sha512-5/N3yJggbWQTlGZHQYJPmQXEwR52qaXjEzkp1yRBbtdaekXE3BG/suo0fqeoV/csf8ooI78sJzYmIrxNoWVtgQ==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-fisheye": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.16.13.tgz",
"integrity": "sha512-2rZmTdFbT/cF9lEZIkXCYO0TsT114Q27AX5IAo0Sju6jVQbvIk1dFUTnwLDadTo8wkJlFzGqMQ24Cs8cHWOliA==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-flip": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.16.13.tgz",
"integrity": "sha512-EmcgAA74FTc5u7Z+hUO/sRjWwfPPLuOQP5O64x5g4j0T12Bd29IgsYZxoutZo/rb3579+JNa/3wsSEmyVv1EpA==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
"@jimp/plugin-rotate": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-gaussian": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.16.13.tgz",
"integrity": "sha512-A1XKfGQD0iDdIiKqFYi8nZMv4dDVYdxbrmgR7y/CzUHhSYdcmoljLIIsZZM3Iks/Wa353W3vtvkWLuDbQbch1w==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-invert": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.16.13.tgz",
"integrity": "sha512-xFMrIn7czEZbdbMzZWuaZFnlLGJDVJ82y5vlsKsXRTG2kcxRsMPXvZRWHV57nSs1YFsNqXSbrC8B98n0E32njQ==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-mask": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.16.13.tgz",
"integrity": "sha512-wLRYKVBXql2GAYgt6FkTnCfE+q5NomM7Dlh0oIPGAoMBWDyTx0eYutRK6PlUrRK2yMHuroAJCglICTbxqGzowQ==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-normalize": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.16.13.tgz",
"integrity": "sha512-3tfad0n9soRna4IfW9NzQdQ2Z3ijkmo21DREHbE6CGcMIxOSvfRdSvf1qQPApxjTSo8LTU4MCi/fidx/NZ0GqQ==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-print": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.16.13.tgz",
"integrity": "sha512-0m6i3p01PGRkGAK9r53hDYrkyMq+tlhLOIbsSTmZyh6HLshUKlTB7eXskF5OpVd5ZUHoltlNc6R+ggvKIzxRFw==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13",
"load-bmfont": "^1.4.0"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
"@jimp/plugin-blit": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-resize": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.16.13.tgz",
"integrity": "sha512-qoqtN8LDknm3fJm9nuPygJv30O3vGhSBD2TxrsCnhtOsxKAqVPJtFVdGd/qVuZ8nqQANQmTlfqTiK9mVWQ7MiQ==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-rotate": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.16.13.tgz",
"integrity": "sha512-Ev+Jjmj1nHYw897z9C3R9dYsPv7S2/nxdgfFb/h8hOwK0Ovd1k/+yYS46A0uj/JCKK0pQk8wOslYBkPwdnLorw==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
"@jimp/plugin-blit": ">=0.3.5",
"@jimp/plugin-crop": ">=0.3.5",
"@jimp/plugin-resize": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-scale": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.16.13.tgz",
"integrity": "sha512-05POQaEJVucjTiSGMoH68ZiELc7QqpIpuQlZ2JBbhCV+WCbPFUBcGSmE7w4Jd0E2GvCho/NoMODLwgcVGQA97A==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
"@jimp/plugin-resize": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-shadow": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.16.13.tgz",
"integrity": "sha512-nmu5VSZ9hsB1JchTKhnnCY+paRBnwzSyK5fhkhtQHHoFD5ArBQ/5wU8y6tCr7k/GQhhGq1OrixsECeMjPoc8Zw==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
"@jimp/plugin-blur": ">=0.3.5",
"@jimp/plugin-resize": ">=0.3.5"
}
},
"node_modules/@jimp/plugin-threshold": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.16.13.tgz",
"integrity": "sha512-+3zArBH0OE3Rhjm4HyAokMsZlIq5gpQec33CncyoSwxtRBM2WAhUVmCUKuBo+Lr/2/4ISoY4BWpHKhMLDix6cA==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5",
"@jimp/plugin-color": ">=0.8.0",
"@jimp/plugin-resize": ">=0.8.0"
}
},
"node_modules/@jimp/plugins": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.16.13.tgz",
"integrity": "sha512-CJLdqODEhEVs4MgWCxpWL5l95sCBlkuSLz65cxEm56X5akIsn4LOlwnKoSEZioYcZUBvHhCheH67AyPTudfnQQ==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/plugin-blit": "^0.16.13",
"@jimp/plugin-blur": "^0.16.13",
"@jimp/plugin-circle": "^0.16.13",
"@jimp/plugin-color": "^0.16.13",
"@jimp/plugin-contain": "^0.16.13",
"@jimp/plugin-cover": "^0.16.13",
"@jimp/plugin-crop": "^0.16.13",
"@jimp/plugin-displace": "^0.16.13",
"@jimp/plugin-dither": "^0.16.13",
"@jimp/plugin-fisheye": "^0.16.13",
"@jimp/plugin-flip": "^0.16.13",
"@jimp/plugin-gaussian": "^0.16.13",
"@jimp/plugin-invert": "^0.16.13",
"@jimp/plugin-mask": "^0.16.13",
"@jimp/plugin-normalize": "^0.16.13",
"@jimp/plugin-print": "^0.16.13",
"@jimp/plugin-resize": "^0.16.13",
"@jimp/plugin-rotate": "^0.16.13",
"@jimp/plugin-scale": "^0.16.13",
"@jimp/plugin-shadow": "^0.16.13",
"@jimp/plugin-threshold": "^0.16.13",
"timm": "^1.6.1"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/png": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.16.13.tgz",
"integrity": "sha512-8cGqINvbWJf1G0Her9zbq9I80roEX0A+U45xFby3tDWfzn+Zz8XKDF1Nv9VUwVx0N3zpcG1RPs9hfheG4Cq2kg==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/utils": "^0.16.13",
"pngjs": "^3.3.3"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/tiff": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.16.13.tgz",
"integrity": "sha512-oJY8d9u95SwW00VPHuCNxPap6Q1+E/xM5QThb9Hu+P6EGuu6lIeLaNBMmFZyblwFbwrH+WBOZlvIzDhi4Dm/6Q==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"utif": "^2.0.1"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/types": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.16.13.tgz",
"integrity": "sha512-mC0yVNUobFDjoYLg4hoUwzMKgNlxynzwt3cDXzumGvRJ7Kb8qQGOWJQjQFo5OxmGExqzPphkirdbBF88RVLBCg==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"@jimp/bmp": "^0.16.13",
"@jimp/gif": "^0.16.13",
"@jimp/jpeg": "^0.16.13",
"@jimp/png": "^0.16.13",
"@jimp/tiff": "^0.16.13",
"timm": "^1.6.1"
},
"peerDependencies": {
"@jimp/custom": ">=0.3.5"
}
},
"node_modules/@jimp/utils": {
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.16.13.tgz",
"integrity": "sha512-VyCpkZzFTHXtKgVO35iKN0sYR10psGpV6SkcSeV4oF7eSYlR8Bl6aQLCzVeFjvESF7mxTmIiI3/XrMobVrtxDA==",
"optional": true,
"peer": true,
"dependencies": {
"@babel/runtime": "^7.7.2",
"regenerator-runtime": "^0.13.3"
}
},
"node_modules/@jsdoc/salty": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/@jsdoc/salty/-/salty-0.2.3.tgz",
@@ -874,6 +1451,13 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/any-base": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz",
"integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==",
"optional": true,
"peer": true
},
"node_modules/anymatch": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
@@ -1180,9 +1764,11 @@
"integrity": "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA=="
},
"node_modules/bmp-js": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.0.1.tgz",
"integrity": "sha512-OS74Rlt0Aynu2mTPmY9RZOUOXlqWecFIILFXr70vv16/xCZnFxvri9IKkF1IGxQ8r9dOE62qGNpKxXx8Lko8bg=="
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz",
"integrity": "sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==",
"optional": true,
"peer": true
},
"node_modules/bodec": {
"version": "0.1.0",
@@ -1476,6 +2062,46 @@
"node": ">= 6"
}
},
"node_modules/combine-image/node_modules/bmp-js": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.0.1.tgz",
"integrity": "sha512-OS74Rlt0Aynu2mTPmY9RZOUOXlqWecFIILFXr70vv16/xCZnFxvri9IKkF1IGxQ8r9dOE62qGNpKxXx8Lko8bg=="
},
"node_modules/combine-image/node_modules/file-type": {
"version": "3.9.0",
"resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz",
"integrity": "sha512-RLoqTXE8/vPmMuTI88DAzhMYC99I8BWv7zYP4A1puo5HIjEJ5EX48ighy4ZyKMG9EDXxBgW6e++cn7d1xuFghA==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/combine-image/node_modules/jimp": {
"version": "0.2.27",
"resolved": "https://registry.npmjs.org/jimp/-/jimp-0.2.27.tgz",
"integrity": "sha512-KP08kEe5pDY+AFg00vuqKP0zgUmeQXJXpzQ+w9+0pQA27GCF9RoWzOpf3AONHgf5h8raMrXaF18y4ug9Rw2xEw==",
"dependencies": {
"bignumber.js": "^2.1.0",
"bmp-js": "0.0.1",
"es6-promise": "^3.0.2",
"exif-parser": "^0.1.9",
"file-type": "^3.1.0",
"jpeg-js": "^0.2.0",
"load-bmfont": "^1.2.3",
"mime": "^1.3.4",
"pixelmatch": "^4.0.0",
"pngjs": "^3.0.0",
"read-chunk": "^1.0.1",
"request": "^2.65.0",
"stream-to-buffer": "^0.1.0",
"tinycolor2": "^1.1.2",
"url-regex": "^3.0.0"
}
},
"node_modules/combine-image/node_modules/jpeg-js": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.2.0.tgz",
"integrity": "sha512-Ni9PffhJtYtdD7VwxH6V2MnievekGfUefosGCHadog0/jAevRu6HPjYeMHbUemn0IPE8d4wGa8UsOGsX+iKy2g=="
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@@ -2619,6 +3245,17 @@
"assert-plus": "^1.0.0"
}
},
"node_modules/gifwrap": {
"version": "0.9.4",
"resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.9.4.tgz",
"integrity": "sha512-MDMwbhASQuVeD4JKd1fKgNgCRL3fGqMM4WaqpNhWO0JiMOAjbQdumbs4BbBZEy9/M00EHEjKN3HieVhCUlwjeQ==",
"optional": true,
"peer": true,
"dependencies": {
"image-q": "^4.0.0",
"omggif": "^1.0.10"
}
},
"node_modules/git-node-fs": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/git-node-fs/-/git-node-fs-1.0.0.tgz",
@@ -3176,6 +3813,23 @@
}
]
},
"node_modules/image-q": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/image-q/-/image-q-4.0.0.tgz",
"integrity": "sha512-PfJGVgIfKQJuq3s0tTDOKtztksibuUEbJQIYT3by6wctQo+Rdlh7ef4evJ5NCdxY4CfMbvFkocEwbl4BF8RlJw==",
"optional": true,
"peer": true,
"dependencies": {
"@types/node": "16.9.1"
}
},
"node_modules/image-q/node_modules/@types/node": {
"version": "16.9.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz",
"integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==",
"optional": true,
"peer": true
},
"node_modules/immediate": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
@@ -3335,39 +3989,25 @@
"integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g=="
},
"node_modules/jimp": {
"version": "0.2.27",
"resolved": "https://registry.npmjs.org/jimp/-/jimp-0.2.27.tgz",
"integrity": "sha512-KP08kEe5pDY+AFg00vuqKP0zgUmeQXJXpzQ+w9+0pQA27GCF9RoWzOpf3AONHgf5h8raMrXaF18y4ug9Rw2xEw==",
"version": "0.16.13",
"resolved": "https://registry.npmjs.org/jimp/-/jimp-0.16.13.tgz",
"integrity": "sha512-Bxz8q7V4rnCky9A0ktTNGA9SkNFVWRHodddI/DaAWZJzF7sVUlFYKQ60y9JGqrKpi48ECA/TnfMzzc5C70VByA==",
"optional": true,
"peer": true,
"dependencies": {
"bignumber.js": "^2.1.0",
"bmp-js": "0.0.1",
"es6-promise": "^3.0.2",
"exif-parser": "^0.1.9",
"file-type": "^3.1.0",
"jpeg-js": "^0.2.0",
"load-bmfont": "^1.2.3",
"mime": "^1.3.4",
"pixelmatch": "^4.0.0",
"pngjs": "^3.0.0",
"read-chunk": "^1.0.1",
"request": "^2.65.0",
"stream-to-buffer": "^0.1.0",
"tinycolor2": "^1.1.2",
"url-regex": "^3.0.0"
}
},
"node_modules/jimp/node_modules/file-type": {
"version": "3.9.0",
"resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz",
"integrity": "sha512-RLoqTXE8/vPmMuTI88DAzhMYC99I8BWv7zYP4A1puo5HIjEJ5EX48ighy4ZyKMG9EDXxBgW6e++cn7d1xuFghA==",
"engines": {
"node": ">=0.10.0"
"@babel/runtime": "^7.7.2",
"@jimp/custom": "^0.16.13",
"@jimp/plugins": "^0.16.13",
"@jimp/types": "^0.16.13",
"regenerator-runtime": "^0.13.3"
}
},
"node_modules/jpeg-js": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.2.0.tgz",
"integrity": "sha512-Ni9PffhJtYtdD7VwxH6V2MnievekGfUefosGCHadog0/jAevRu6HPjYeMHbUemn0IPE8d4wGa8UsOGsX+iKy2g=="
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz",
"integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==",
"optional": true,
"peer": true
},
"node_modules/js-git": {
"version": "0.7.8",
@@ -4276,6 +4916,13 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/omggif": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz",
"integrity": "sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw==",
"optional": true,
"peer": true
},
"node_modules/on-exit-leak-free": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-0.2.0.tgz",
@@ -5242,6 +5889,13 @@
"node": ">= 12.13.0"
}
},
"node_modules/regenerator-runtime": {
"version": "0.13.11",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==",
"optional": true,
"peer": true
},
"node_modules/request": {
"version": "2.88.2",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
@@ -6014,6 +6668,13 @@
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg=="
},
"node_modules/timm": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz",
"integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw==",
"optional": true,
"peer": true
},
"node_modules/tinycolor2": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz",
@@ -6278,6 +6939,16 @@
"resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz",
"integrity": "sha512-XdVKMF4SJ0nP/O7XIPB0JwAEuT9lDIYnNsK8yGVe43y0AWoKeJNdv3ZNWh7ksJ6KqQFjOO6ox/VEitLnaVNufw=="
},
"node_modules/utif": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz",
"integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==",
"optional": true,
"peer": true,
"dependencies": {
"pako": "^1.0.5"
}
},
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",

View File

@@ -61,6 +61,7 @@ initBot = async () => {
// Socket IO
io.on('connection', async function (socket) {
console.log("Connecting ...")
socket.emit('ioStatus', socketioStatus);
socks = socket
await socket.emit('message', 'Connecting...');
@@ -73,10 +74,12 @@ initBot = async () => {
try {
client.on('message', () => {
console.log(waReady)
socketioStatus = "wa_msg"; socket.emit('ioStatus', socketioStatus);
socket.emit('incomming', 'Message In')
waReady = true
})
client.on('qr', qr => generateImage(qr, async () => {
socketioStatus = "wa_qr"; socket.emit('ioStatus', socketioStatus);
qrcode.generate(qr, { small: true });
console.log(`Ver QR http://localhost:${port}/bot.qr.png`)
await socket.emit('qr', `http://localhost:${port}/bot.qr.png`);
@@ -84,12 +87,14 @@ initBot = async () => {
}))
client.on('ready', async () => {
socketioStatus = "wa_ready"
await socket.emit('ready', 'Whatsapp is ready!');
await socket.emit('message', 'Whatsapp is ready!');
waReady = true
});
client.on('authenticated', async () => {
socketioStatus = "wa_autenticated"; socket.emit('ioStatus', socketioStatus);
await socket.emit('authenticated', 'Whatsapp is authenticated!');
await socket.emit('message', 'Whatsapp is authenticated!');
// console.log('AUTHENTICATED');
@@ -101,6 +106,7 @@ initBot = async () => {
});
client.on('disconnected', async (reason) => {
socketioStatus = "wa_disconnected"; socket.emit('ioStatus', socketioStatus);
await socket.emit('message', 'Whatsapp is disconnected!');
waReady = false
// client.destroy();

View File

@@ -55,26 +55,27 @@
<div id="app">
<div style="text-align:center;">
<h1>Whatsapp API</h1>
<br>
<div id="qrDiv" style=""display:none;>
<img src="bot.qr.png" alt="QR Code" id="qrcode" style="width:300px">
<div id="countdown" style="margin-top:-25px"></div>
</div>
<br><br>
<div id="divQRPage" style="display:none;"></div>
<div id="countdown" style="margin-top:-25px"></div>
<div id="postman" style="display:flex;justify-content:center;">
<table>
<table>
<tr>
<td>Número:</td><td><input type="text" id="number" value="5215554192439"></td>
<td>Número:</td>
<td><input type="text" id="number" value="5215554192439"></td>
</tr>
<tr>
<td>Mensaje:</td><td><input type="text" id="message" value="test1"></td>
<td>Mensaje:</td>
<td><input type="text" id="message" value="test1"></td>
</tr>
<tr>
<td> </td><td align="center"><input type="button" id="btnMessage" value="Enviar Mensaje"></td>
<td> </td>
<td align="center"><input type="button" id="btnMessage" value="Enviar Mensaje"></td>
</tr>
</table>
</div>
</div>
<input type="button" id="chkConn" value="ChkConn">
<!-- <input type="button" id="chkConn" value="QR"> -->
<br>
<h3>Logs:</h3>
<ul class="logs"></ul>
@@ -86,49 +87,59 @@
let downloadTimer;
let IntervaloABorrar
let waReady = false
$(document).ready(function () {
if(waReady == false) { $("#btnMessage").attr("disabled", true)}
let IOSTATUS = "NONE"
$(document).ready( function(){
if (waReady == false && IOSTATUS == "wa_ready") { $("#btnMessage").attr("disabled", true) }
var socket = io();
socket.on('ioStatus', function ( msg ){
IOSTATUS = msg;
console.log("IOSTATUS="+msg);
console.log("XXXXXXXXXXXXX " + IOSTATUS)
if (IOSTATUS == 'wa_ready') { $("#postman").show(); $("#divQRPage").hide() }
else if (IOSTATUS == 'wa_qr') { $("#divQRPage").show(); loadQR(); $("#postman").hide(); console.log("mostramos QRPage") }
else { $("#divQRPage").hide(); $("#postman").hide(); }
})
socket.on('message', function (msg) {
$('.logs').prepend($('<li>').text(msg));
console.log("|"+msg+"|");
if(msg == 'Connecting...') { $('#qrDiv').hide(); $('#postman').show(); waReady = false, $("#btnMessage").attr("disabled", true) }
if(msg == 'Whatsapp is ready!'){ $("#btnMessage").attr("disabled", false) }
});
console.log("|" + msg + "|");
if (msg == 'Connecting...' && IOSTATUS == "wa_ready") { $('#divQRPage').hide(); $('#postman').show(); waReady = false, $("#btnMessage").attr("disabled", true) }
if (msg == 'Whatsapp is ready!') { $("#btnMessage").attr("disabled", false) }
})
socket.on('qr', function (src) {
var extra = Date.now();
console.log(extra)
$('#qrcode').attr('src', src+'?'+extra);
loadQR()
// $('#qrcode').attr('src', src + '?' + extra);
$('#postman').hide();
$('#qrDiv').show();
$('#divQRPage').show();
waReady = false;
$("#btnMessage").attr("disabled", true)
startImer()
});
})
socket.on('ready', function (data) {
$('#qrDiv').hide();
$("#divQRPage").hide()
$('#postman').show();
clearInterval(IntervaloABorrar);
});
})
socket.on('authenticated', function (data) {
$('#qrDiv').hide();
$('#divQRPage').hide();
$('#postman').show();
});
})
socket.on("connect_error", (err) => {
$('.logs').prepend($('<li>').text("¡Error de conexión!"));
waReady = false
$("#btnMessage").attr("disabled", true)
waReady = false
$("#btnMessage").attr("disabled", true)
console.log(`connect_error due to ${err.message}`);
});
socket.on('incomming', function(){
if(waReady == false){
})
socket.on('incomming', function () {
if (waReady == false) {
$('.logs').prepend($('<li>').text('Whatsapp is ready!'));
console.log("incomming")
$("#btnMessage").attr("disabled", false)
waReady = true
}
})
socket.on('connOk', function(){
socket.on('connOk', function () {
console.log("connOk")
if (waReady == false) {
$('.logs').prepend($('<li>').text('Whatsapp is ready!'));
@@ -138,10 +149,11 @@
}
})
$("#chkConn").on('click', async function () {
console.log("check Conn");
socket.emit('checkConn', 'check conn');
// console.log("check Conn");
// socket.emit('checkConn', 'check conn');
loadQR()
})
function revisaConexion(){
function revisaConexion() {
var checkConnection = setInterval(function () {
if (waReady == false) {
socket.emit('checkConn', 'check conn');
@@ -153,34 +165,38 @@
}, 2000);
}
revisaConexion();
});
function startImer(){
clearInterval(IntervaloABorrar);
var timeleft = 60;
console.log(typeof downloadTimer)
var downloadTimer = setInterval(function () {
if (timeleft <= 0) {
function loadQR(){
$('#divQRPage').load("qr.html");
console.log("Load QR page!")
}
function startImer() {
clearInterval(IntervaloABorrar);
var timeleft = 60;
console.log(typeof downloadTimer)
var downloadTimer = setInterval(function () {
if (timeleft <= 0) {
IntervaloABorrar = downloadTimer
clearInterval(IntervaloABorrar);
document.getElementById("countdown").innerHTML = "Finished";
// startImer();
} else {
document.getElementById("countdown").innerHTML = timeleft + " seconds remaining";
}
console.log(typeof downloadTimer + "|" + downloadTimer)
IntervaloABorrar = downloadTimer
clearInterval(IntervaloABorrar);
document.getElementById("countdown").innerHTML = "Finished";
// startImer();
} else {
document.getElementById("countdown").innerHTML = timeleft + " seconds remaining";
}
console.log(typeof downloadTimer + "|" + downloadTimer)
IntervaloABorrar = downloadTimer
timeleft -= 1;
}, 1000);
}
$('#btnMessage').on('click', function(){
console.log("msg clicked")
$.post("http://localhost:3005/send-message/", { "number": $("#number").val(), "message": $("#message").val() })
.done(function (data) {
console.log(data.status);
if(data.status == true){alert("¡Mensaje enviado!")}
});
}
)
timeleft -= 1;
}, 1000);
}
$('#btnMessage').on('click', function () {
console.log("msg clicked")
$.post("http://localhost:3005/send-message/", { "number": $("#number").val(), "message": $("#message").val() })
.done(function (data) {
console.log(data.status);
if (data.status == true) { alert("¡Mensaje enviado!") }
});
})
});
</script>
</body>

1
public/qr.html Normal file
View File

@@ -0,0 +1 @@
<img src="bot.qr.png" alt="QR Code" id="qrcode" style="width:300px">