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
parent b895437458
commit 38976558f5
2 changed files with 7 additions and 1 deletions

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,

View File

@@ -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
};
/**