feat(dev): add argument bypassCSP to use in pupperter (#635)

This commit is contained in:
Ricardo Araújo Paes 2021-06-01 23:05:44 -03:00 • committed by GitHub
commit 38976558f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,6 +30,7 @@ const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification
* @param {number} options.takeoverTimeoutMs - How much time to wait before taking over the session
* @param {string} options.userAgent - User agent to use in puppeteer
* @param {string} options.ffmpegPath - Ffmpeg path to use when formating videos to webp while sending stickers
* @param {boolean} options.bypassCSP - Sets bypassing of page's Content-Security-Policy.
*
* @fires Client#qr
* @fires Client#authenticated
@ -82,6 +83,10 @@ class Client extends EventEmitter {
}, this.options.session);
}
if(this.options.bypassCSP) {
await page.setBypassCSP(true);
}
await page.goto(WhatsWebURL, {
waitUntil: 'load',
timeout: 0,