chore(v1.34.7): bump version and generate docs
This commit is contained in:
parent
211205363c
commit
f935b50011
77 changed files with 5207 additions and 2669 deletions
49
docs/util_Util.js.html
generated
49
docs/util_Util.js.html
generated
|
|
@ -4,7 +4,7 @@
|
|||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.11">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.34.6 » Source: util/Util.js</title>
|
||||
<title>whatsapp-web.js 1.34.7 » Source: util/Util.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>34.<wbr>6</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>34.<wbr>7</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
@ -44,15 +44,20 @@ const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
|
|||
*/
|
||||
class Util {
|
||||
constructor() {
|
||||
throw new Error(`The ${this.constructor.name} class may not be instantiated.`);
|
||||
throw new Error(
|
||||
`The ${this.constructor.name} class may not be instantiated.`,
|
||||
);
|
||||
}
|
||||
|
||||
static generateHash(length) {
|
||||
var result = '';
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var characters =
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var charactersLength = characters.length;
|
||||
for (var i = 0; i &lt; length; i++) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
result += characters.charAt(
|
||||
Math.floor(Math.random() * charactersLength),
|
||||
);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -80,7 +85,7 @@ class Util {
|
|||
/**
|
||||
* Formats a image to webp
|
||||
* @param {MessageMedia} media
|
||||
*
|
||||
*
|
||||
* @returns {Promise&lt;MessageMedia>} media in webp format
|
||||
*/
|
||||
static async formatImageToWebpSticker(media, pupPage) {
|
||||
|
|
@ -99,7 +104,7 @@ class Util {
|
|||
/**
|
||||
* Formats a video to webp
|
||||
* @param {MessageMedia} media
|
||||
*
|
||||
*
|
||||
* @returns {Promise&lt;MessageMedia>} media in webp format
|
||||
*/
|
||||
static async formatVideoToWebpSticker(media) {
|
||||
|
|
@ -110,13 +115,13 @@ class Util {
|
|||
|
||||
const tempFile = path.join(
|
||||
tmpdir(),
|
||||
`${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`
|
||||
`${Crypto.randomBytes(6).readUIntLE(0, 6).toString(36)}.webp`,
|
||||
);
|
||||
|
||||
const stream = new (require('stream').Readable)();
|
||||
const buffer = Buffer.from(
|
||||
media.data.replace(`data:${media.mimetype};base64,`, ''),
|
||||
'base64'
|
||||
'base64',
|
||||
);
|
||||
stream.push(buffer);
|
||||
stream.push(null);
|
||||
|
|
@ -131,7 +136,7 @@ class Util {
|
|||
'libwebp',
|
||||
'-vf',
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
'scale=\'iw*min(300/iw\,300/ih)\':\'ih*min(300/iw\,300/ih)\',format=rgba,pad=300:300:\'(300-iw)/2\':\'(300-ih)/2\':\'#00000000\',setsar=1,fps=10',
|
||||
"scale='iw*min(300/iw\,300/ih)':'ih*min(300/iw\,300/ih)',format=rgba,pad=300:300:'(300-iw)/2':'(300-ih)/2':'#00000000',setsar=1,fps=10",
|
||||
'-loop',
|
||||
'0',
|
||||
'-ss',
|
||||
|
|
@ -163,8 +168,8 @@ class Util {
|
|||
/**
|
||||
* Sticker metadata.
|
||||
* @typedef {Object} StickerMetadata
|
||||
* @property {string} [name]
|
||||
* @property {string} [author]
|
||||
* @property {string} [name]
|
||||
* @property {string} [author]
|
||||
* @property {string[]} [categories]
|
||||
*/
|
||||
|
||||
|
|
@ -172,7 +177,7 @@ class Util {
|
|||
* Formats a media to webp
|
||||
* @param {MessageMedia} media
|
||||
* @param {StickerMetadata} metadata
|
||||
*
|
||||
*
|
||||
* @returns {Promise&lt;MessageMedia>} media in webp format
|
||||
*/
|
||||
static async formatToWebpSticker(media, metadata, pupPage) {
|
||||
|
|
@ -182,8 +187,7 @@ class Util {
|
|||
webpMedia = await this.formatImageToWebpSticker(media, pupPage);
|
||||
else if (media.mimetype.includes('video'))
|
||||
webpMedia = await this.formatVideoToWebpSticker(media);
|
||||
else
|
||||
throw new Error('Invalid media format');
|
||||
else throw new Error('Invalid media format');
|
||||
|
||||
if (metadata.name || metadata.author) {
|
||||
const img = new webp.Image();
|
||||
|
|
@ -192,8 +196,17 @@ class Util {
|
|||
const packname = metadata.name;
|
||||
const author = metadata.author;
|
||||
const categories = metadata.categories || [''];
|
||||
const json = { 'sticker-pack-id': stickerPackId, 'sticker-pack-name': packname, 'sticker-pack-publisher': author, 'emojis': categories };
|
||||
let exifAttr = Buffer.from([0x49, 0x49, 0x2A, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00]);
|
||||
const json = {
|
||||
'sticker-pack-id': stickerPackId,
|
||||
'sticker-pack-name': packname,
|
||||
'sticker-pack-publisher': author,
|
||||
emojis: categories,
|
||||
};
|
||||
let exifAttr = Buffer.from([
|
||||
0x49, 0x49, 0x2a, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00,
|
||||
0x41, 0x57, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00,
|
||||
0x00, 0x00,
|
||||
]);
|
||||
let jsonBuffer = Buffer.from(JSON.stringify(json), 'utf8');
|
||||
let exif = Buffer.concat([exifAttr, jsonBuffer]);
|
||||
exif.writeUIntLE(jsonBuffer.length, 14, 4);
|
||||
|
|
@ -225,7 +238,7 @@ module.exports = Util;
|
|||
<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 January 30, 2026.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.11 on April 24, 2026.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
|||
Loading…
Reference in a new issue