aunubaileys 1.0.42 → 1.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -64,6 +64,10 @@ Everything else is pure upstream. When upstream moves, we rebase the patch layer
64
64
 
65
65
 
66
66
 
67
+ ### 🆕 What's new in 1.0.43 / Baru di 1.0.43
68
+
69
+ - 🎬 **Video thumbnails now invoke FFmpeg via `spawn` with an argument array** instead of a shell-executed command string (`exec`). `extractVideoThumb` builds the invocation as data rather than shell text, so a file path can no longer smuggle shell commands into it; the function signature and behaviour are unchanged (file output, same caller in `generateThumbnail`). The pattern follows @itsliaaa/baileys; their pipe-to-buffer redesign was **not** adopted because it would change this function's public behaviour.
70
+
67
71
  ### 🆕 What's new in 1.0.42 / Baru di 1.0.42
68
72
 
69
73
  - 🧑‍💻 **Full rich responses: highlighted code blocks + tables** — completing the simple `aiRich` branch that has existed since the 1.0.2–1.0.4 era. Send `{ code, language }`, `{ table, title }`, `{ links }`, or prebuilt `{ richResponse }` submessages and the message routes to the new rich response builder (`lib/Utils/rich-message-utils.js`, exported: `tokenizeCode`, `prepareRichResponseMessage`, `toUnified`): code is tokenized per language (keyword tables for 12 languages + a lexer) into highlight blocks, tables become header + body rows, and the `unifiedResponse` rendering payload is assembled automatically. Two adaptations from the source (@itsliaaa/baileys), recorded plainly: **(1)** the source's donation-link fallbacks are removed — a link without a `url` is skipped and no third-party label/URL is ever injected; **(2)** the 6.7.24 proto has **no** `botForwardedMessage` field and no `BotMetadata.verificationMetadata`/`botResponseId`, so on this base the rich response is sent as the Message's own `richResponseMessage` field (the same shape as the existing `aiRich` branch) and the v7 bot-proof apparatus is not fabricated; the enums follow this proto's nested layout.
@@ -1,6 +1,6 @@
1
1
  import { Boom } from '@hapi/boom';
2
2
  import axios, {} from 'axios';
3
- import { exec } from 'child_process';
3
+ import { spawn } from 'child_process';
4
4
  import * as Crypto from 'crypto';
5
5
  import { once } from 'events';
6
6
  import { createReadStream, createWriteStream, promises as fs, WriteStream } from 'fs';
@@ -85,13 +85,26 @@ export async function getMediaKeys(buffer, mediaType) {
85
85
  }
86
86
  /** Extracts video thumb using FFMPEG */
87
87
  const extractVideoThumb = async (path, destPath, time, size) => new Promise((resolve, reject) => {
88
- const cmd = `ffmpeg -ss ${time} -i ${path} -y -vf scale=${size.width}:-1 -vframes 1 -f image2 ${destPath}`;
89
- exec(cmd, err => {
90
- if (err) {
91
- reject(err);
88
+ // AunuBaileys: spawn dengan array argumen, tanpa shell (dari @itsliaaa/baileys) —
89
+ // path/waktu/ukuran tidak lagi diinterpolasi ke string perintah shell
90
+ const ffmpeg = spawn('ffmpeg', [
91
+ '-ss', String(time),
92
+ '-i', path,
93
+ '-y',
94
+ '-vf', `scale=${size.width}:-1`,
95
+ '-vframes', '1',
96
+ '-f', 'image2',
97
+ destPath
98
+ ], { stdio: ['ignore', 'ignore', 'pipe'] });
99
+ const stderrChunks = [];
100
+ ffmpeg.stderr.on('data', (chunk) => stderrChunks.push(chunk));
101
+ ffmpeg.on('error', reject);
102
+ ffmpeg.on('close', (code) => {
103
+ if (code === 0) {
104
+ resolve();
92
105
  }
93
106
  else {
94
- resolve();
107
+ reject(new Error(`ffmpeg exited with code ${code}: ${Buffer.concat(stderrChunks).toString('utf8').trim()}`));
95
108
  }
96
109
  });
97
110
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aunubaileys",
3
3
  "type": "module",
4
- "version": "1.0.42",
4
+ "version": "1.0.43",
5
5
  "description": "AunuBaileys \u2014 a WhatsApp Web API for bots that never sleep. Full upstream power with the beloved in-memory store restored and pairing that just works. Forged by AunuCore.",
6
6
  "keywords": [
7
7
  "whatsapp",