chore: mark version v1.21.0
This commit is contained in:
parent
3dd4463478
commit
01d23e8dff
67 changed files with 919 additions and 182 deletions
|
|
@ -4,7 +4,7 @@
|
|||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.11">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.20.0 » Source: Client.js</title>
|
||||
<title>whatsapp-web.js 1.21.0 » Source: Client.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>20.<wbr>0</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>21.<wbr>0</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
@ -41,6 +41,7 @@ const { WhatsWebURL, DefaultOptions, Events, WAState } = require('./ut
|
|||
const { ExposeStore, LoadUtils } = require('./util/Injected');
|
||||
const ChatFactory = require('./factories/ChatFactory');
|
||||
const ContactFactory = require('./factories/ContactFactory');
|
||||
const WebCacheFactory = require('./webCache/WebCacheFactory');
|
||||
const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List, Reaction, Chat } = require('./structures');
|
||||
const LegacySessionAuth = require('./authStrategies/LegacySessionAuth');
|
||||
const NoAuth = require('./authStrategies/NoAuth');
|
||||
|
|
@ -50,6 +51,8 @@ const NoAuth = require('./authStrategies/NoAuth');
|
|||
* @extends {EventEmitter}
|
||||
* @param {object} options - Client options
|
||||
* @param {AuthStrategy} options.authStrategy - Determines how to save and restore sessions. Will use LegacySessionAuth if options.session is set. Otherwise, NoAuth will be used.
|
||||
* @param {string} options.webVersion - The version of WhatsApp Web to use. Use options.webVersionCache to configure how the version is retrieved.
|
||||
* @param {object} options.webVersionCache - Determines how to retrieve the WhatsApp Web version. Defaults to a local cache (LocalWebCache) that falls back to latest if the requested version is not found.
|
||||
* @param {number} options.authTimeoutMs - Timeout for authentication selector in puppeteer
|
||||
* @param {object} options.puppeteer - Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/
|
||||
* @param {number} options.qrMaxRetries - How many times should the qrcode be refreshed before giving up
|
||||
|
|
@ -146,6 +149,7 @@ class Client extends EventEmitter {
|
|||
this.pupPage = page;
|
||||
|
||||
await this.authStrategy.afterBrowserInitialized();
|
||||
await this.initWebVersionCache();
|
||||
|
||||
await page.goto(WhatsWebURL, {
|
||||
waitUntil: 'load',
|
||||
|
|
@ -669,6 +673,35 @@ class Client extends EventEmitter {
|
|||
});
|
||||
}
|
||||
|
||||
async initWebVersionCache() {
|
||||
const { type: webCacheType, ...webCacheOptions } = this.options.webVersionCache;
|
||||
const webCache = WebCacheFactory.createWebCache(webCacheType, webCacheOptions);
|
||||
|
||||
const requestedVersion = this.options.webVersion;
|
||||
const versionContent = await webCache.resolve(requestedVersion);
|
||||
|
||||
if(versionContent) {
|
||||
await this.pupPage.setRequestInterception(true);
|
||||
this.pupPage.on('request', async (req) => {
|
||||
if(req.url() === WhatsWebURL) {
|
||||
req.respond({
|
||||
status: 200,
|
||||
contentType: 'text/html',
|
||||
body: versionContent
|
||||
});
|
||||
} else {
|
||||
req.continue();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.pupPage.on('response', async (res) => {
|
||||
if(res.ok() &amp;&amp; res.url() === WhatsWebURL) {
|
||||
await webCache.persist(await res.text());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the client
|
||||
*/
|
||||
|
|
@ -1323,7 +1356,7 @@ module.exports = Client;
|
|||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.11 on May 19, 2023.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.11 on May 29, 2023.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
|||
Loading…
Reference in a new issue