@onyx-p/imlib-web 1.7.9 → 1.8.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.
- package/index.esm.js +6 -8
- package/index.umd.js +6 -8
- package/package.json +1 -1
package/index.esm.js
CHANGED
@@ -20364,9 +20364,6 @@ const decodeMessageContent = (dialogMessage, aesKey) => {
|
|
20364
20364
|
if (dialogMessage.msgPostContent?.length) {
|
20365
20365
|
msgPostContent = aes256Decrypt(dialogMessage.msgPostContent, aesKey);
|
20366
20366
|
}
|
20367
|
-
if (dialogMessage.mediaConstructor === 0x60010012 || dialogMessage.mediaConstructor === 0x60020021) {
|
20368
|
-
mediaAttribute = transMsgIdNum64ToString(mediaAttribute);
|
20369
|
-
}
|
20370
20367
|
return parseMediaAttributeJson(dialogMessage.mediaConstructor, mediaAttribute, msgPostContent);
|
20371
20368
|
} catch (error) {
|
20372
20369
|
logger.error('decode message content fail -> uid:', dialogMessage.msgId.toString());
|
@@ -20379,11 +20376,16 @@ const parseMediaAttributeJson = (mediaConstructor, mediaAttribute, msgPostConten
|
|
20379
20376
|
mediaAttributeJson.content = msgPostContent;
|
20380
20377
|
} else {
|
20381
20378
|
if (mediaAttribute?.length) {
|
20382
|
-
|
20379
|
+
const safeJsonString = convertInt64ToString(mediaAttribute);
|
20380
|
+
mediaAttributeJson = JSON.parse(safeJsonString);
|
20383
20381
|
}
|
20384
20382
|
}
|
20385
20383
|
return mediaAttributeJson;
|
20386
20384
|
};
|
20385
|
+
const convertInt64ToString = jsonString => {
|
20386
|
+
const int64Regex = /(?<!")\b(\d{15,})\b(?!")/g;
|
20387
|
+
return jsonString.replace(int64Regex, '"$1"');
|
20388
|
+
};
|
20387
20389
|
const parseChatRecordMsgDetails$1 = (conversationOpt, msgDetails) => {
|
20388
20390
|
let contentList = [];
|
20389
20391
|
msgDetails.forEach(item => {
|
@@ -20415,10 +20417,6 @@ const parseChatRecordMsgDetails$1 = (conversationOpt, msgDetails) => {
|
|
20415
20417
|
});
|
20416
20418
|
return contentList;
|
20417
20419
|
};
|
20418
|
-
const transMsgIdNum64ToString = jsonString => {
|
20419
|
-
const reg = /("msgId")\s*:\s*(\d+)/g;
|
20420
|
-
return jsonString.replace(reg, (r1, r2, r3) => `${r2}:"${r3}"`);
|
20421
|
-
};
|
20422
20420
|
var serverMessageParser = {
|
20423
20421
|
parse,
|
20424
20422
|
parseSingleDialogMessages,
|
package/index.umd.js
CHANGED
@@ -20370,9 +20370,6 @@
|
|
20370
20370
|
if (dialogMessage.msgPostContent?.length) {
|
20371
20371
|
msgPostContent = aes256Decrypt(dialogMessage.msgPostContent, aesKey);
|
20372
20372
|
}
|
20373
|
-
if (dialogMessage.mediaConstructor === 0x60010012 || dialogMessage.mediaConstructor === 0x60020021) {
|
20374
|
-
mediaAttribute = transMsgIdNum64ToString(mediaAttribute);
|
20375
|
-
}
|
20376
20373
|
return parseMediaAttributeJson(dialogMessage.mediaConstructor, mediaAttribute, msgPostContent);
|
20377
20374
|
} catch (error) {
|
20378
20375
|
logger.error('decode message content fail -> uid:', dialogMessage.msgId.toString());
|
@@ -20385,11 +20382,16 @@
|
|
20385
20382
|
mediaAttributeJson.content = msgPostContent;
|
20386
20383
|
} else {
|
20387
20384
|
if (mediaAttribute?.length) {
|
20388
|
-
|
20385
|
+
const safeJsonString = convertInt64ToString(mediaAttribute);
|
20386
|
+
mediaAttributeJson = JSON.parse(safeJsonString);
|
20389
20387
|
}
|
20390
20388
|
}
|
20391
20389
|
return mediaAttributeJson;
|
20392
20390
|
};
|
20391
|
+
const convertInt64ToString = jsonString => {
|
20392
|
+
const int64Regex = /(?<!")\b(\d{15,})\b(?!")/g;
|
20393
|
+
return jsonString.replace(int64Regex, '"$1"');
|
20394
|
+
};
|
20393
20395
|
const parseChatRecordMsgDetails$1 = (conversationOpt, msgDetails) => {
|
20394
20396
|
let contentList = [];
|
20395
20397
|
msgDetails.forEach(item => {
|
@@ -20421,10 +20423,6 @@
|
|
20421
20423
|
});
|
20422
20424
|
return contentList;
|
20423
20425
|
};
|
20424
|
-
const transMsgIdNum64ToString = jsonString => {
|
20425
|
-
const reg = /("msgId")\s*:\s*(\d+)/g;
|
20426
|
-
return jsonString.replace(reg, (r1, r2, r3) => `${r2}:"${r3}"`);
|
20427
|
-
};
|
20428
20426
|
var serverMessageParser = {
|
20429
20427
|
parse,
|
20430
20428
|
parseSingleDialogMessages,
|