@onyx-p/imlib-web 2.2.8 → 2.2.9

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 CHANGED
@@ -21187,7 +21187,7 @@ class MessageCache {
21187
21187
  if (!content) return '';
21188
21188
  try {
21189
21189
  const contentStr = JSON.stringify(content);
21190
- return aes256Encrypt(contentStr, this.encryptKey);
21190
+ return contentStr;
21191
21191
  } catch (error) {
21192
21192
  logger.error('加密消息内容失败', error);
21193
21193
  return '';
@@ -21198,7 +21198,7 @@ class MessageCache {
21198
21198
  return null;
21199
21199
  }
21200
21200
  try {
21201
- const decryptedStr = aes256Decrypt(encryptedHex, this.encryptKey);
21201
+ const decryptedStr = encryptedHex;
21202
21202
  return JSON.parse(decryptedStr);
21203
21203
  } catch (error) {
21204
21204
  logger.error('解密消息内容失败', error);
@@ -21552,28 +21552,7 @@ class MessageCache {
21552
21552
  });
21553
21553
  }
21554
21554
  async upsertMessage(message) {
21555
- if (!this.db) {
21556
- throw new Error('数据库未初始化');
21557
- }
21558
- return new Promise((resolve, reject) => {
21559
- const transaction = this.db.transaction(this.STORE_NAME, 'readwrite');
21560
- const store = transaction.objectStore(this.STORE_NAME);
21561
- const messageToStore = {
21562
- ...message
21563
- };
21564
- if (messageToStore.content) {
21565
- const encryptedContent = this.encryptContent(messageToStore.content);
21566
- messageToStore.content = encryptedContent;
21567
- }
21568
- const request = store.put(messageToStore);
21569
- request.onsuccess = () => {
21570
- resolve();
21571
- };
21572
- request.onerror = event => {
21573
- logger.error('更新/插入消息失败', event);
21574
- reject(new Error('更新/插入消息失败'));
21575
- };
21576
- });
21555
+ this.addMessages([message], message);
21577
21556
  }
21578
21557
  async getMessageById(messageId) {
21579
21558
  if (!this.db) {
package/index.umd.js CHANGED
@@ -21193,7 +21193,7 @@
21193
21193
  if (!content) return '';
21194
21194
  try {
21195
21195
  const contentStr = JSON.stringify(content);
21196
- return aes256Encrypt(contentStr, this.encryptKey);
21196
+ return contentStr;
21197
21197
  } catch (error) {
21198
21198
  logger.error('加密消息内容失败', error);
21199
21199
  return '';
@@ -21204,7 +21204,7 @@
21204
21204
  return null;
21205
21205
  }
21206
21206
  try {
21207
- const decryptedStr = aes256Decrypt(encryptedHex, this.encryptKey);
21207
+ const decryptedStr = encryptedHex;
21208
21208
  return JSON.parse(decryptedStr);
21209
21209
  } catch (error) {
21210
21210
  logger.error('解密消息内容失败', error);
@@ -21558,28 +21558,7 @@
21558
21558
  });
21559
21559
  }
21560
21560
  async upsertMessage(message) {
21561
- if (!this.db) {
21562
- throw new Error('数据库未初始化');
21563
- }
21564
- return new Promise((resolve, reject) => {
21565
- const transaction = this.db.transaction(this.STORE_NAME, 'readwrite');
21566
- const store = transaction.objectStore(this.STORE_NAME);
21567
- const messageToStore = {
21568
- ...message
21569
- };
21570
- if (messageToStore.content) {
21571
- const encryptedContent = this.encryptContent(messageToStore.content);
21572
- messageToStore.content = encryptedContent;
21573
- }
21574
- const request = store.put(messageToStore);
21575
- request.onsuccess = () => {
21576
- resolve();
21577
- };
21578
- request.onerror = event => {
21579
- logger.error('更新/插入消息失败', event);
21580
- reject(new Error('更新/插入消息失败'));
21581
- };
21582
- });
21561
+ this.addMessages([message], message);
21583
21562
  }
21584
21563
  async getMessageById(messageId) {
21585
21564
  if (!this.db) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onyx-p/imlib-web",
3
- "version": "2.2.8",
3
+ "version": "2.2.9",
4
4
  "main": "index.umd.js",
5
5
  "module": "index.esm.js",
6
6
  "types": "types/index.d.ts",