@wu529778790/open-im 1.11.4-beta.12 → 1.11.4-beta.14

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.
@@ -251,18 +251,22 @@ async function extractImages(msg) {
251
251
  return [];
252
252
  const paths = [];
253
253
  for (const item of msg.item_list) {
254
- // 调试:记录所有 item 类型
255
- log.info(`Item type=${item.type}, has image_item=${!!item.image_item}, has media=${!!item.image_item?.media}, has cdn_url=${!!item.image_item?.media?.cdn_url}`);
256
254
  if (item.type !== 2 /* MessageItemType.IMAGE */)
257
255
  continue;
258
- const media = item.image_item?.media;
259
- if (!media?.cdn_url) {
260
- log.warn(`Image item missing cdn_url: ${JSON.stringify(item.image_item).substring(0, 200)}`);
256
+ const imageItem = item.image_item;
257
+ const media = imageItem?.media;
258
+ // iLink API 使用 full_url 而非 cdn_url
259
+ const imageUrl = media?.full_url || media?.cdn_url;
260
+ if (!imageUrl) {
261
+ log.warn('Image item missing full_url/cdn_url');
261
262
  continue;
262
263
  }
264
+ // AES key: aeskey 字段是 hex 格式,media.aes_key 是 base64 格式
265
+ // decryptAes256CbcMedia 需要 hex 格式的 key
266
+ const aesKey = imageItem?.aeskey;
263
267
  try {
264
268
  // Download from CDN
265
- const response = await fetch(media.cdn_url, { signal: AbortSignal.timeout(30_000) });
269
+ const response = await fetch(imageUrl, { signal: AbortSignal.timeout(30_000) });
266
270
  if (!response.ok) {
267
271
  log.warn(`Image download failed: HTTP ${response.status}`);
268
272
  continue;
@@ -270,8 +274,8 @@ async function extractImages(msg) {
270
274
  const buffer = Buffer.from(await response.arrayBuffer());
271
275
  // Decrypt if AES key provided
272
276
  let decrypted;
273
- if (media.aes_key) {
274
- decrypted = decryptAes256CbcMedia(buffer, media.aes_key);
277
+ if (aesKey) {
278
+ decrypted = decryptAes256CbcMedia(buffer, aesKey);
275
279
  }
276
280
  else {
277
281
  decrypted = buffer;
@@ -21,9 +21,12 @@ export interface TextItem {
21
21
  }
22
22
  /** Image content item */
23
23
  export interface ImageItem {
24
+ aeskey?: string;
24
25
  media?: {
25
26
  aes_key?: string;
26
27
  cdn_url?: string;
28
+ full_url?: string;
29
+ encrypt_query_param?: string;
27
30
  };
28
31
  width?: number;
29
32
  height?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wu529778790/open-im",
3
- "version": "1.11.4-beta.12",
3
+ "version": "1.11.4-beta.14",
4
4
  "description": "Your AI coding assistant, in every chat app. Multi-platform IM bridge for Claude Code, Codex, and CodeBuddy.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",