@zetagoaurum-socket/wasocket 2.1.9 → 2.2.1

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.
@@ -794,7 +794,25 @@ const makeMessagesRecvSocket = (config) => {
794
794
  placeholderResendCache.del(node.attrs.id);
795
795
  }
796
796
  }
797
- const { fullMessage: msg, category, author, decrypt } = (0, Utils_1.decryptMessageNode)(node, authState.creds.me.id, authState.creds.me.lid || '', signalRepository, logger);
797
+ let msg;
798
+ let category;
799
+ let author;
800
+ let decrypt;
801
+
802
+ try {
803
+ const decryptionResult = (0, Utils_1.decryptMessageNode)(node, authState.creds.me.id, authState.creds.me.lid || '', signalRepository, logger);
804
+ msg = decryptionResult.fullMessage;
805
+ category = decryptionResult.category;
806
+ author = decryptionResult.author;
807
+ decrypt = decryptionResult.decrypt;
808
+ } catch (error) {
809
+ if (error.message.includes('Bad MAC')) {
810
+ logger.error({ key: node.attrs.key, error: error.stack }, 'Bad MAC error, triggering retry');
811
+ await sendRetryRequest(node, true); // Force include keys to reset session
812
+ return;
813
+ }
814
+ throw error;
815
+ }
798
816
 
799
817
  // Auto Safe Contact
800
818
  ContactManager.checkAndSave(author || msg.key.remoteJid, { user: authState.creds.me });
@@ -49,7 +49,8 @@ const getUrlInfo = async (text, opts = {
49
49
  return false;
50
50
  }
51
51
  },
52
- headers: opts.fetchOpts
52
+ },
53
+ // headers: opts.fetchOpts // [FIX] Do not pass fetchOpts as headers, this causes 400 Bad Request
53
54
  });
54
55
  if (info && 'title' in info && info.title) {
55
56
  const [image] = info.images;
@@ -86,7 +87,9 @@ const getUrlInfo = async (text, opts = {
86
87
  }
87
88
  catch (error) {
88
89
  if (!error.message.includes('receive a valid')) {
89
- throw error;
90
+ // [FIX] Log error but do not crash/throw for link preview failures
91
+ (_a = opts.logger) === null || _a === void 0 ? void 0 : _a.debug({ err: error.stack, url: text }, 'error in fetching link preview');
92
+ // throw error; // Safe to ignore link preview errors
90
93
  }
91
94
  }
92
95
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zetagoaurum-socket/wasocket",
3
- "version": "2.1.9",
3
+ "version": "2.2.1",
4
4
  "description": "WhatsApp API Modification ZetaGo",
5
5
  "keywords": [
6
6
  "whatsapp",