Commit Graph

67 Commits

Author SHA1 Message Date
Claude 48b63565b6 fix: revert ?? '' and defensive null checks across Socket files
PRs 124-129 replaced TypeScript non-null assertions (!) with optional
chaining (?.) and empty string defaults (?? ''). While defensive
programming is usually good, in Signal protocol and WhatsApp binary
node handling code these changes caused:

- Malformed JIDs with empty user components (e.g. @s.whatsapp.net)
- Silent device enumeration failures (messages skip recipients)
- Wrong own-device detection (message routing errors)
- Broken prekey count handling (prekey uploads silently skipped)
- Wrong retry count tracking in Signal protocol

These empty-string defaults are dangerous because Signal session
lookups fail for malformed JIDs, causing "SessionError: No sessions".

Reverted to original Baileys pattern using non-null assertions (!)
which match the upstream reference (infinitezap/Teste_InfiniteAPI).

Files fixed: messages-send.ts, messages-recv.ts, socket.ts, chats.ts,
groups.ts, communities.ts, business.ts

https://claude.ai/code/session_01XaA7GwNaB6azTHFYQ8WEpB
2026-02-09 10:10:56 +00:00
Claude 6e394bd540 fix(types): resolve all TypeScript compilation errors from non-null assertion removal
Fixes:
- chats.ts: revert encodeResult/initial to ! (guaranteed by callback assignment)
- groups.ts: fix operator precedence with ?? (wrap +attrs in parens), fix groupId type
- messages-recv.ts: extract messageKey.id to local const with fallback
- socket.ts: revert onClose! (guaranteed by synchronous callback assignment)
- event-buffer.ts: add 'notify' fallback for MessageUpsertType
- messages.ts: add filePath const after null guard, fix contextInfo type assertion
- noise-handler.ts: restore array index ! (guaranteed by length check)

Build now compiles with zero new errors.

https://claude.ai/code/session_01E2cfX1N3sJgCJBTvzGazSG
2026-02-09 01:02:13 +00:00
Claude 7e88ddb858 fix(types): remove non-null assertions across 14 files
Files fixed:
- messages-recv.ts: 58 assertions → null guards, meId extraction, optional chaining
- process-message.ts: 38 assertions → remoteJid/participant guards, proto field checks
- chat-utils.ts: 31 assertions → proto field validation with Boom errors
- messages-send.ts: 20 assertions → meId extraction, participant guards
- chats.ts: 15 assertions → me guard, firstChild guard, jid guards
- messages.ts: 14 assertions → originalFilePath guard, key guards
- groups.ts: 12 assertions → attrs fallbacks with ??
- validate-connection.ts: 9 assertions → grouped proto field validation
- generics.ts: 1 assertion → versionLine guard
- history.ts: 2 assertions → key guards
- libsignal.ts: 1 assertion → deviceId guard
- sender-key-message.ts: 3 assertions → proto guards
- UsyncBotProfileProtocol.ts: 2 assertions → attrs guards
- example.ts: 3 assertions → optional chaining

https://claude.ai/code/session_01E2cfX1N3sJgCJBTvzGazSG
2026-02-09 00:05:13 +00:00
Claude 8fd10c8b9b fix(types): remove non-null assertions in groups.ts, noise-handler.ts, messages-recv.ts (partial)
- groups.ts: Replace ! assertions with ?? fallbacks for group attrs
- noise-handler.ts: Add proper validation for serverHello fields before use,
  remove all ! assertions (9 total), throw Boom errors for missing fields
- messages-recv.ts: Fix contradictory messageKey?.id! pattern (partial, more coming)

https://claude.ai/code/session_01E2cfX1N3sJgCJBTvzGazSG
2026-02-08 23:41:19 +00:00
Rajeh Taher acc5111792 group events: fix serialization issue 2025-10-07 20:17:07 +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 9a8f19461c messages-send: Don't send group skdistMsg to hosted id 2025-10-06 00:46:06 +03:00
Rajeh Taher c5b0001b61 *group: parse @lids properly when processing group notifications
*This commit is breaking, it changes the format of participants in group-participants.update.
2025-10-05 23:56:14 +03:00
Rajeh Taher 334977f983 general: revert #1665 2025-10-03 18:14:30 +03:00
suhwr f0cc173aa3 Correct group participant phoneNumber attribute name (#1775) 2025-09-14 17:06:17 +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
João Lucas de Oliveira Lopes 4d4339dae6 feat(WAProto): Optimize protobuf generation for 80%+ bundle size reduction (#1665)
* chore: remove comments and veirfy from generated proto files (improve size)

* refactor: replace fromObject with create for proto message instantiation and flag no beautiful

* chore: lint issues
2025-09-07 14:08:11 +03:00
Rajeh Taher 8dc852ee89 proto: fix proto generation, tsc: fix node imports of compiled code 2025-07-19 23:16:35 +03:00
suhwr 97dfccf9fe Fix group size metadata (#1600)
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2025-07-19 00:28:01 +03:00
Rajeh Taher 787aed88b8 project: Move to ESM Modules 2025-07-17 13:54:17 +03:00
DevAstro 44c5e16c05 add owner country code attribute (#1565)
name says it all
2025-07-05 23:59:24 +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
devlikeapro b8464d3665 Add lid to Contact - contact sync, history sync, group participants (#1472) 2025-06-18 08:08:09 -03:00
Nurutomo 99bbafeae5 feat: extra metadata on groupMetadata (#1374) 2025-06-10 08:25:08 -03:00
canove ae0de94307 chore: fix format 2025-05-28 22:44:21 -03:00
canove feecb6d8ee Merge branch 'master' of https://github.com/WhiskeySockets/Baileys into fix-eslint-prettier-editorconfig-rules 2025-05-14 07:40:05 -03:00
Skid d5f34f46c3 more consistent addressingMode 2025-05-11 13:27:49 -06:00
canove fa706d0b50 chore: format everything 2025-05-06 12:10:19 -03:00
w3nder dfe8bb3283 refactor(messageId): update all remaining usages to v2 format consistently 2025-04-30 00:59:19 -03:00
canove 53d6e3a8d5 fix: send message to LID addressing_mode groups 2025-04-23 10:17:30 -03:00
Rajeh Taher 7c9f2ebd46 feat(feature/group-invite-v4): initial/final commit (#958) 2024-08-14 12:10:37 +03:00
Rajeh Taher 0cc888e87b fix(master): generate new message id 2024-06-12 23:12:59 +03:00
Rajeh Taher ce325d1182 fix(master): linting warnings 2024-05-10 16:33:59 +03:00
Antônio Roberto Júnior e52570bbd7 add linkedParent in groupMetadata (#734)
* Update GroupMetadata.ts

* Update groups.ts
2024-04-28 14:02:49 +03:00
Bob c41be3ac4f feat: If need approval to join the group in groupMetadata (#533)
* If need approval to join the group

* If need approval to join the group

* Update groups.ts

* Update groups.ts

* fix lint

* Update groups.ts

* Update groups.ts

---------

Co-authored-by: Bob <115008575+FortisEtMagnus@users.noreply.github.com>
Co-authored-by: Bob <115008575+bobpetrov@users.noreply.github.com>
2024-01-19 18:31:35 +02:00
Wender Teixeira 504fe942ee Update size calculation in extractGroupMetadata function (#581) 2024-01-19 18:31:01 +02:00
Bob 408c0070ba feat: Set in group settings memberAddMode and joinApprovalMode (#534)
* feat: Set in group settings memberAddMode and joinApprovalMode

* fix lint

* fix lint

* fix conflict

---------

Co-authored-by: Bob <115008575+FortisEtMagnus@users.noreply.github.com>
Co-authored-by: Bob <115008575+bobpetrov@users.noreply.github.com>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
2024-01-19 17:59:42 +02:00
Rajeh Taher cbffb2941c fix: Fix linting 2023-12-18 16:43:28 +02:00
piLovr 3962311108 Update groups.ts 2023-08-31 10:29:55 +02:00
piLovr 3061ede206 Update groups.ts 2023-08-31 10:13:00 +02:00
piLovr 5d697b9890 Update groups.ts 2023-08-31 09:46:01 +02:00
Neguin 1ef0ab01aa fix: added invite property (#218)
If the user does not allow to be added directly, it will be possible to get the invite code and create an invitation message for the user to join the group
2023-07-08 18:07:05 -03:00
aqulzz 7dc1cd6476 feat: approve, reject, list request join (#117) 2023-06-12 09:34:50 -03:00
SamuelScheit 07562c2204 feat: fetch groups if ib:dirty 2023-05-14 17:45:20 +02:00
Adhiraj Singh fe1d0649b5 feat: add signal repository + tests 2023-03-18 12:25:47 +05:30
Adhiraj Singh 6c3958bb16 fix: desc for groups 2022-10-09 12:21:44 +05:30
Adhiraj Singh 8d6e00eab6 fix: handle when buffered tasks fail 2022-08-18 10:15:27 +05:30
Adhiraj Singh 2549d10be9 feat: update proto
The new proto extract has a bunch of breaking changes, so if you were using the raw proto in your code somewhere -- then you may have to update your code to make it work with the new proto

!BREAKING_CHANGE
2022-08-01 10:43:04 +05:30
Adhiraj Singh 40a1e268aa feat: add "strictNullChecks" 2022-07-09 10:20:07 +05:30
Adhiraj Singh 5cc58d4aed feat: add bulk "process" capability to BaileysBufferableEventEmitter 2022-07-04 11:34:41 +05:30
Adhiraj Singh 7421f55daa feat: implement event buffer for offline msgs
!BREAKING_CHANGE

1. this allows all offline notifications to be combined into a batch -- to reduce the number of events being sent out
2. to enable the above, the "message.reaction" event has been made an array. Also removes the need for the "operation" field
3. have also now started processing all events under a single queue to prevent state sync problems
2022-06-27 13:38:29 +05:30
Aditya Singh a1082e85ed Fixed groupParticipantsUpdate request format (#1763) 2022-06-22 10:44:59 +05:30
Lucas Maia 51e5572f82 Update group.js (#1758)
Set status 200 as string, to standardize responses.
2022-06-20 15:44:24 +05:30
Adhiraj Singh cacc1ce130 feat: implement "groupAcceptInviteV4" add participant msg 2022-06-19 15:33:28 +05:30
LeonardoBein 227cab2f95 feat: Returns an object with information about the invite code's group (#1562)
* feat: Returns an object with information about the invite code's group

* refactor: more information in metadata group
2022-06-13 20:34:01 +05:30