Claude
0ff68f0c3d
fix(messages): revert hosted JID changes + implement PR #2270 performance optimization
...
This commit addresses two critical issues identified in post-implementation review:
## Issue 1: Hosted JIDs in Interactive Messages (REVERTED) ⚠️
**Problem**: Previous changes included hosted JIDs (@hosted, @hosted.lid) in bot node
injection logic for interactive messages, which could interfere with carousel, list,
and button delivery to hosted accounts.
**Changes**:
- Reverted `isAnyPnUser/isAnyLidUser` to `isPnUser/isLidUser` in messages-send.ts:172
- Reverted bot node logic for interactive messages (lines 1249-1251)
- Added explicit comment: "Only for regular JIDs, NOT hosted JIDs"
**Impact**:
- ✅ Zero interference with interactive messages (buttons, lists, carousels)
- ✅ Maintains original behavior for hosted JIDs
- ✅ Bot node only injected for regular PN/LID JIDs
## Issue 2: Performance - Implement PR #2270 🚀
**Problem**: Unnecessary stack trace capture in hot code paths causing:
- ~1.0% CPU overhead in `serializeJSStackFrame`
- ~0.6% CPU overhead in `promiseTimeout`
- ~2.5 MB memory allocation for source maps
**Changes in src/Utils/generics.ts**:
- Removed `const stack = new Error().stack` from `delayCancellable()` (line 131)
- Removed `const stack = new Error().stack` from `promiseTimeout()` (line 161)
- Removed stack data from Boom error constructors
- Added comments explaining Boom's native stack capture
**Rationale** (from Baileys PR #2270 ):
> Boom creates native Error instances and calls Error.captureStackTrace().
> The .stack property is preserved automatically without manual capture.
> Reference: https://hapi.dev/module/boom/api/?v=10.0.1
**Performance Gains**:
- `serializeJSStackFrame`: ~1.0% → 0% CPU (eliminated)
- `promiseTimeout`: ~0.6% → 0.02% CPU (30x faster)
- Memory: ~2.5 MB source map allocations freed
**Testing**:
- ✅ All generics tests passing
- ✅ Boom error handling preserved
- ✅ Stack traces still available via Boom's native Error
Related:
- Addresses concerns from implementation review
- Implements Baileys PR #2270 performance optimization
- Maintains compatibility with interactive messages
https://claude.ai/code/session_0149ZKk2ygmKCJTGu39Mr8oH
2026-02-02 19:43:17 +00:00
Claude
c4da46321f
feat: add identity change handler for improved connection stability
...
Cherry-pick from upstream PR #2264 (commit 5cbad317 ) with enhancements:
## Changes
### New Files
- `src/Utils/identity-change-handler.ts`: Centralized identity change handling
- Enterprise-grade JSDoc documentation
- Clear result types for all 9 possible outcomes
- Debouncing to prevent duplicate session refreshes
- Companion device filtering
- Offline notification handling
- `src/__tests__/Socket/identity-change-handling.test.ts`: Comprehensive tests
- Core functionality tests
- Debounce behavior tests
- Error handling tests
- Edge case coverage
### Modified Files
- `src/Socket/messages-recv.ts`: Updated error handling
- MISSING_KEYS_ERROR now returns NACK with ParsingError
- Maintains CTWA recovery logic intact
- Preserves all Prometheus metrics integration
- `src/Utils/generics.ts`: Added `isStringNullOrEmpty()` helper
- `src/Utils/index.ts`: Added identity-change-handler export
## Benefits
- Fixes "Online" status shown when actually disconnected (#2132 )
- Better session management after contact identity changes
- Clear separation of concerns with dedicated handler module
Co-authored-by: João Lucas de Oliveira Lopes <55464917+jlucaso1@users.noreply.github.com >
2026-01-22 18:34:19 +00:00
Claude
8ef129bd3d
fix: add import assertion for JSON imports in ESM
...
Adds 'with { type: "json" }' to JSON imports to fix Node.js ESM runtime error:
ERR_IMPORT_ATTRIBUTE_MISSING
2026-01-21 17:46:54 +00:00
Claude
8a134d2420
refactor: centralize WhatsApp version to single source of truth
...
Instead of maintaining the version number in 3 separate files
(baileys-version.json, index.ts, generics.ts), this change makes
baileys-version.json the single source of truth. Other files now
import the version from this JSON file.
This follows the DRY principle and reduces:
- Risk of version inconsistency across files
- Maintenance burden (only 1 file to update)
- PR diff size (3 files → 1 file for version updates)
- Merge conflict probability
Addresses inefficiency found in Baileys PR #2269 .
2026-01-21 16:17:14 +00:00
github-actions[bot]
4bdcedf96b
chore: update WhatsApp Web version ( #2269 )
...
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-01-20 12:35:35 +02:00
vini
40f128d88a
feat(events): decrypt event responses ( #2056 )
2025-11-19 15:17:21 +02:00
Rajeh Taher
48b0cb4bc2
chore: update wa web ver
2025-10-12 19:50:04 +03:00
Gustavo Quadri
60c688b85d
Fix fetchLatestWaWebVersion to bypass WhatsApp anti-bot detection with minimal headers ( #1883 )
...
* fix: fetchLatestWaWebVersion to curl
* fix: lint
* fix: fetchLatestWaWebVersion to bypass WhatsApp anti-bot detection with minimal headers
---------
Co-authored-by: João Lucas <jlucaso@hotmail.com >
2025-10-07 20:06:45 +03:00
Rajeh Taher
334977f983
general: revert #1665
2025-10-03 18:14:30 +03:00
João Lucas de Oliveira Lopes
fb12f6d9d3
refactor: replace axios with fetch API and update related types ( #1666 )
2025-09-28 05:52:43 +03:00
João Lucas de Oliveira Lopes
3b46d43beb
fix: harden Protobuf Deserialization and Refactor Utilities ( #1820 )
...
* refactor: reorganize browser utility functions and improve buffer handling
* fix: harden protobuf deserialization and clean up code
* refactor: simplify data handling in GroupCipher and SenderKey classes
* fix: Ensure consistent Buffer hydration and remove redundant code
* refactor: update decodeAndHydrate calls to use proto types for improved type safety
2025-09-26 04:45:30 +03:00
Rajeh Taher
42c980778e
send, usync: fix lid Usync (including onWhatsApp), and send phash
2025-09-14 21:35:13 +03:00
Rajeh Taher
a2e7e070fc
general: remove console logs, linting
2025-09-08 23:11:32 +03:00
Rajeh Taher
b0c3486ab0
generics: update the fetch function to work, keep old for backwards comp
2025-09-08 23:01:02 +03:00
Rajeh Taher
20693a59d0
lid, wip: Support LIDs in Baileys ( #1747 )
...
* lid-mapping: get missing lid from usync
* lid-mapping, jid-utils: change to isPnUser and store multiple mappings
* process-message: parse protocolMsg mapping, and store from new msgs
* types: lid-mapping event, addressing enum, alt, contact, group types
* validate, decode: use lid for identity, better logic
* lid: final commit
* linting
* linting
* linting
* linting
* misc: fix testing and also remove version json
* lint: IDE fucking up lint
* lid-mapping: fix build error on NPM
* message-retry: fix proto import
2025-09-08 10:03:28 +03:00
Gustavo Quadri
478b08bf79
Fix: prevent zero padding in writeRandomPadMax16 causing message delivery failures ( #1706 )
2025-08-26 06:11:58 -03:00
João Lucas de Oliveira Lopes
8d2cdbcf98
Fix regression import attribute ( #1642 )
...
* Revert "Replace deprecated assert with import attributes syntax (#1619 )"
This reverts commit f61221f73a .
* fix: update import syntax for bailey's version JSON
2025-07-29 10:20:02 -03:00
steflsd
f61221f73a
Replace deprecated assert with import attributes syntax ( #1619 )
...
* replace assert with
* assert with
* more ts way for version
* fix: remove JSON import assert syntax for Node.js compatibility
- Replace JSON imports with generated .js imports
- Fixes compatibility between Node.js versions (assert vs with syntax)
- Maintains same functionality while avoiding syntax issues
2025-07-27 00:59:54 +03:00
Rajeh Taher
8dc852ee89
proto: fix proto generation, tsc: fix node imports of compiled code
2025-07-19 23:16:35 +03:00
Rajeh Taher
787aed88b8
project: Move to ESM Modules
2025-07-17 13:54:17 +03:00
João Lucas de Oliveira Lopes
8391c02e0b
[READY FOR MERGE] Implement newsletter ( #1532 )
...
* feat: implement basic newsletter functionality with socket integration and event handling
* feat: enhance media handling for newsletters with raw media upload support
* feat: working updatePicture, removePicure, adminCount, mute, Unmute
* fix: fetchMessages
* chore: cleanup
* fix: update newsletter metadata path and query ID for consistency. newsletterMetadata works now
* chore: enhance newsletter metadata parsing and error handling
* fix: correct DELETE QueryId value in Newsletter.ts
* chore: split mex stuffs to own file
* chore: remove as any
2025-06-30 23:22:09 -03:00
canove
eb6c6c8ba9
Merge branch 'master' of https://github.com/WhiskeySockets/Baileys into fix-eslint-prettier-editorconfig-rules
2025-05-28 22:42:28 -03:00
vinikjkkj
fe3dbc81a5
fix pairing code not working
2025-05-15 13:27:15 -03:00
canove
fa706d0b50
chore: format everything
2025-05-06 12:10:19 -03:00
Rajeh Taher
64d09c70b4
store: remove built-in store
2025-03-10 17:35:46 +02:00
Rajeh Taher
1c2af09b03
socket,config: deprecate printQRInTerminal option
...
This was done to reduce dependencies
2025-03-10 15:08:50 +02:00
João Lucas de Oliveira Lopes
8083754621
refactor: turn hkdf functions to async and remove extra deps ( #1272 )
...
* refactor: remove futoin-hkdf dependency and update hkdf implementation
* refactor: use crypto subtle and update functions to async
---------
Co-authored-by: Rajeh Taher <rajeh@reforward.dev >
2025-03-01 18:31:48 +02:00
contato.mateusfr@gmail.com
21f8431e61
Dependency Inversion for Logger ( #1153 )
...
* feat: interface "ILogger" created
feat: interface "ILogger" used instead of pino logger
feat: "PinoLoggerAdapter" created to implement "ILogger" interface
* feat: PinoLoggerAdapter removed
feat: ILogger mapping the features we're using from pino
* fix: sort imports
---------
Co-authored-by: Mateus Franchini de Freitas <contato.mateusfr@outlook.com >
Co-authored-by: Mateus Franchini de Freitas <mfranchini@domtec.com.br >
Co-authored-by: Rajeh Taher <rajeh@reforward.dev >
2025-03-01 18:30:51 +02:00
Wender Teixeira
36690fc462
fix: update fetchLatestWaWebVersion to retrieve client revision from new endpoint ( #1234 )
2025-03-01 18:17:34 +02:00
contato.mateusfr@gmail.com
cfbfcd8e14
fix: sending SERVER_ACK to messages.update ( #1101 )
...
Co-authored-by: Mateus Franchini de Freitas <mfranchini@domtec.com.br >
2025-03-01 18:17:29 +02:00
Rajeh Taher
18ac07df8e
lint: 0 warnings left
2024-10-14 05:15:10 +03:00
vini
ed00a57c84
remove duplicated call reject event / add terminate tag ( #1031 )
...
* initial commit
* add terminate tag
* lint
* lint 2
* Update src/Socket/messages-recv.ts
* chore: linting
---------
Co-authored-by: Rajeh Taher <rajeh@reforward.dev >
2024-09-22 14:34:29 +03:00
LightningNeko
fdf9d48162
fix: invalid children for header "companion_platform_id": 49 (number) ( #897 )
2024-07-03 10:28:15 +03:00
Bob
13be112b18
Feat: others browsers in requestPairingCode() ( #879 )
...
* update
* l
* string
* added Safari
* Update getPlatformId
* Update getPlatformId (fix)
2024-06-30 06:10:50 +03:00
Bob
61afe1cdc1
Fix linting generateMessageIDV2 ( #871 )
...
* Update messages-send.ts
* Update generics.ts
2024-06-16 15:33:01 +03:00
Rajeh Taher
0cc888e87b
fix(master): generate new message id
2024-06-12 23:12:59 +03:00
Rajeh Taher
e91f9e05c5
fix(master): prevent detection
2024-06-12 15:08:30 +03:00
Ashary Vermaysha
3fc5d4b803
feat: add option for Windows browser ( #303 )
2024-01-19 18:00:18 +02:00
Alessandro Autiero
c506182035
Finished requestPairingCode
2023-07-16 20:14:17 +02:00
Alessandro Autiero
f498e1e56c
Added requestPairingCode method and handler
...
Fixed typo (trimUndefineds)
Added bytesToCrockford
Replaced advSecretKey with advKeyPair
Added pairingCode prop
Fixed formatting
Added pairing code example
2023-07-16 18:44:17 +02:00
Codeboss
2c76713565
feat: Add waveforms to voice messages ( #180 )
...
Co-authored-by: Edgard <edgardmessias@gmail.com >
2023-07-13 21:08:11 -03:00
SamuelScheit
6ecc5a8757
fix: socket options
2023-05-12 18:02:41 +02:00
Samuel Rodrigues Almeida Costa
89c1d6e1e1
Update fetchLatestBaileysVersion
...
It was pointing to the old repository
2023-04-30 12:30:30 +02:00
Adhiraj Singh
fe1d0649b5
feat: add signal repository + tests
2023-03-18 12:25:47 +05:30
Adhiraj Singh
bda2bb4717
feat: allow meId in getKeyAuthor
2023-03-02 18:46:07 +05:30
Adhiraj Singh
cd42881201
feat: allow messageSecret as param to poll create
2023-03-02 17:42:34 +05:30
Adhiraj Singh
34f8f60d31
chore: lint
2023-02-21 11:49:59 +05:30
Adhiraj Singh
b2c1cfbf9c
fix: timeout send call
2023-02-01 14:33:14 +05:30
Adhiraj Singh
c24ffc1bed
feat: better mapping for WS errors
2023-01-17 22:01:51 +05:30
Adhiraj Singh
d0330d1863
refactor!: cleaner message history sync
...
This is a breaking change,
1. three events (chats.set, contacts.set, messages.set) are now just one `messaging-history.set` event
2. no need to debounce for app state sync
3. added a new "conditional" chat update to allow for correct app state sync despite not having the chat available on hand
2022-09-29 16:32:57 +05:30