chore: mark version v1.21.0

This commit is contained in:
Pedro S Lopez 2023-05-29 02:46:45 -04:00
commit 01d23e8dff
67 changed files with 919 additions and 182 deletions

View file

@ -4,7 +4,7 @@
<head>
<meta name="generator" content="JSDoc 3.6.11">
<meta charset="utf-8">
<title>whatsapp-web.js 1.20.0 &raquo; Source: Client.js</title>
<title>whatsapp-web.js 1.21.0 &raquo; 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 } &#x3D; require(&#x27;./ut
const { ExposeStore, LoadUtils } &#x3D; require(&#x27;./util/Injected&#x27;);
const ChatFactory &#x3D; require(&#x27;./factories/ChatFactory&#x27;);
const ContactFactory &#x3D; require(&#x27;./factories/ContactFactory&#x27;);
const WebCacheFactory &#x3D; require(&#x27;./webCache/WebCacheFactory&#x27;);
const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification, Label, Call, Buttons, List, Reaction, Chat } &#x3D; require(&#x27;./structures&#x27;);
const LegacySessionAuth &#x3D; require(&#x27;./authStrategies/LegacySessionAuth&#x27;);
const NoAuth &#x3D; require(&#x27;./authStrategies/NoAuth&#x27;);
@ -50,6 +51,8 @@ const NoAuth &#x3D; require(&#x27;./authStrategies/NoAuth&#x27;);
* @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 &#x3D; page;
await this.authStrategy.afterBrowserInitialized();
await this.initWebVersionCache();
await page.goto(WhatsWebURL, {
waitUntil: &#x27;load&#x27;,
@ -669,6 +673,35 @@ class Client extends EventEmitter {
});
}
async initWebVersionCache() {
const { type: webCacheType, ...webCacheOptions } &#x3D; this.options.webVersionCache;
const webCache &#x3D; WebCacheFactory.createWebCache(webCacheType, webCacheOptions);
const requestedVersion &#x3D; this.options.webVersion;
const versionContent &#x3D; await webCache.resolve(requestedVersion);
if(versionContent) {
await this.pupPage.setRequestInterception(true);
this.pupPage.on(&#x27;request&#x27;, async (req) &#x3D;&gt; {
if(req.url() &#x3D;&#x3D;&#x3D; WhatsWebURL) {
req.respond({
status: 200,
contentType: &#x27;text/html&#x27;,
body: versionContent
});
} else {
req.continue();
}
});
} else {
this.pupPage.on(&#x27;response&#x27;, async (res) &#x3D;&gt; {
if(res.ok() &amp;amp;&amp;amp; res.url() &#x3D;&#x3D;&#x3D; WhatsWebURL) {
await webCache.persist(await res.text());
}
});
}
}
/**
* Closes the client
*/
@ -1323,7 +1356,7 @@ module.exports &#x3D; 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>