diff --git a/src/Client.js b/src/Client.js index 580af22..3116953 100644 --- a/src/Client.js +++ b/src/Client.js @@ -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, diff --git a/src/util/Constants.js b/src/util/Constants.js index 3fb851b..1e32dc0 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -14,7 +14,8 @@ exports.DefaultOptions = { takeoverOnConflict: false, takeoverTimeoutMs: 0, userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36', - ffmpegPath: 'ffmpeg' + ffmpegPath: 'ffmpeg', + bypassCSP: false }; /**