mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-20 12:39:20 +00:00
feat(dev): add argument bypassCSP to use in pupperter (#635)
This commit is contained in:
committed by
GitHub
parent
b895437458
commit
38976558f5
@@ -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 {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.userAgent - User agent to use in puppeteer
|
||||||
* @param {string} options.ffmpegPath - Ffmpeg path to use when formating videos to webp while sending stickers
|
* @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#qr
|
||||||
* @fires Client#authenticated
|
* @fires Client#authenticated
|
||||||
@@ -82,6 +83,10 @@ class Client extends EventEmitter {
|
|||||||
}, this.options.session);
|
}, this.options.session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.options.bypassCSP) {
|
||||||
|
await page.setBypassCSP(true);
|
||||||
|
}
|
||||||
|
|
||||||
await page.goto(WhatsWebURL, {
|
await page.goto(WhatsWebURL, {
|
||||||
waitUntil: 'load',
|
waitUntil: 'load',
|
||||||
timeout: 0,
|
timeout: 0,
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ exports.DefaultOptions = {
|
|||||||
takeoverOnConflict: false,
|
takeoverOnConflict: false,
|
||||||
takeoverTimeoutMs: 0,
|
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',
|
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
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user