whatsapp-pi 1.0.26 → 1.0.28

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
@@ -108,19 +108,6 @@ specs/ # Feature specifications
108
108
  tests/ # Unit and integration tests
109
109
  ```
110
110
 
111
- ## Documentation
112
-
113
- See `specs/` directory for detailed feature documentation:
114
- - `001-whatsapp-tui-integration/` - TUI menu system
115
- - `002-manual-whatsapp-connection/` - Connection management
116
- - `003-whatsapp-messaging-refactor/` - Reliable messaging
117
- - `004-blocked-numbers-management/` - Block list feature
118
- - `005-verbose-mode-support/` - Logging and tracing
119
- - `006-auto-connect-flag/` - Automatic connection support
120
- - `007-image-recognition/` - Vision analysis integration
121
- - `008-document-message-support/` - Document handling and storage
122
- - `009-localize-system-messages/` - US English localization
123
-
124
111
  ## Development
125
112
 
126
113
  Run tests:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whatsapp-pi",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "type": "module",
5
5
  "description": "WhatsApp integration extension for Pi",
6
6
  "main": "whatsapp-pi.ts",
@@ -84,6 +84,7 @@ export class WhatsAppService {
84
84
  creds: state.creds,
85
85
  keys: makeCacheableSignalKeyStore(state.keys, logger),
86
86
  },
87
+ syncFullHistory: false,
87
88
  logger,
88
89
  });
89
90
 
@@ -107,17 +108,25 @@ export class WhatsAppService {
107
108
  const shouldReconnect = statusCode !== DisconnectReason.loggedOut;
108
109
  const shouldTreatAsLoggedOut =
109
110
  errorMessage.includes('bad-request') ||
111
+ errorMessage.includes('Bad MAC') ||
110
112
  statusCode === 400 ||
111
113
  statusCode === 401 ||
112
114
  statusCode === DisconnectReason.loggedOut ||
113
115
  statusCode === DisconnectReason.badSession;
114
-
116
+
115
117
  console.error(`Connection closed [${statusCode}]. Reconnecting: ${shouldReconnect}`);
116
-
118
+
117
119
  if (shouldTreatAsLoggedOut) {
118
120
  console.error(`Session invalid or logged out [${statusCode}] - preserving auth state and requiring re-auth`);
121
+ if (errorMessage.includes('Bad MAC')) {
122
+ console.error('[WhatsApp-Pi] Bad MAC error detected. Your session keys are corrupted.');
123
+ console.error('[WhatsApp-Pi] Run /whatsapp-logout to clear auth state, then reconnect with /whatsapp-connect');
124
+ this.onStatusUpdate?.('| WhatsApp: Session Error (Bad MAC)');
125
+ }
119
126
  this.sessionManager.setStatus('logged-out');
120
- this.onStatusUpdate?.('| WhatsApp: Logged out');
127
+ if (!errorMessage.includes('Bad MAC')) {
128
+ this.onStatusUpdate?.('| WhatsApp: Logged out');
129
+ }
121
130
  return;
122
131
  }
123
132
 
@@ -17,16 +17,13 @@ export class MenuHandler {
17
17
  const registered = await this.sessionManager.isRegistered();
18
18
  const options: string[] = [];
19
19
 
20
- options.push('Recents');
21
-
22
20
  if (status === 'connected') {
21
+ options.push('Recents');
23
22
  options.push('Allowed Numbers');
24
23
  options.push('Blocked Numbers');
25
24
  options.push('Disconnect WhatsApp');
26
25
  } else {
27
- options.push('Connect / Reconnect WhatsApp');
28
- options.push('Allowed Numbers');
29
- options.push('Blocked Numbers');
26
+ options.push('Connect WhatsApp');
30
27
  }
31
28
 
32
29
  if (registered) {
@@ -38,7 +35,7 @@ export class MenuHandler {
38
35
  const choice = await ctx.ui.select(`WhatsApp (Status: ${status})`, options);
39
36
 
40
37
  switch (choice) {
41
- case 'Connect / Reconnect WhatsApp':
38
+ case 'Connect WhatsApp':
42
39
  if (status === 'connected') {
43
40
  ctx.ui.notify('WhatsApp is already connected', 'info');
44
41
  break;