@ascegu/teamily 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ascegu/teamily",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "OpenClaw Teamily channel plugin - Team instant messaging server integration",
5
5
  "keywords": [
6
6
  "channel",
package/src/monitor.ts CHANGED
@@ -50,6 +50,26 @@ if (typeof globalThis.FileReader === "undefined") {
50
50
  };
51
51
  }
52
52
 
53
+ // Minimal valid 1x1 white JPEG. Used as a placeholder video snapshot —
54
+ // the SDK requires a non-empty snapshot file for upload; an empty File hangs.
55
+ // prettier-ignore
56
+ const MINIMAL_JPEG = new Uint8Array([
57
+ 0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01,
58
+ 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0xff, 0xdb, 0x00, 0x43,
59
+ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
60
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
61
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
62
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
63
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
64
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xff, 0xc0, 0x00, 0x0b, 0x08, 0x00,
65
+ 0x01, 0x00, 0x01, 0x01, 0x01, 0x11, 0x00, 0xff, 0xc4, 0x00, 0x14, 0x00,
66
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xc4, 0x00, 0x14, 0x10, 0x01, 0x00,
68
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
69
+ 0x00, 0x00, 0x00, 0xff, 0xda, 0x00, 0x08, 0x01, 0x01, 0x00, 0x00, 0x3f,
70
+ 0x00, 0x7b, 0x40, 0x00, 0x00, 0x01, 0xff, 0xd9,
71
+ ]);
72
+
53
73
  // Lazy-loaded SDK to avoid top-level dynamic import issues
54
74
  let sdkModule: SdkModule | null = null;
55
75
  async function loadSDK() {
@@ -280,21 +300,26 @@ export class TeamilyMonitor {
280
300
  ): Promise<string> {
281
301
  const sdk = this.requireSdk();
282
302
  const videoFile = new File([new Uint8Array(buffer)], fileName, { type: contentType });
283
- // snapshotFile is required by the SDK type but we have no thumbnail; use an empty file.
284
- const snapshotFile = new File([], "snapshot.jpg", { type: "image/jpeg" });
303
+ // snapshotFile is required by the SDK; an empty file causes the upload to hang.
304
+ // Use a minimal valid 1x1 JPEG so the SDK upload succeeds.
305
+ const snapshotFile = new File([new Uint8Array(MINIMAL_JPEG)], "snapshot.jpg", {
306
+ type: "image/jpeg",
307
+ });
308
+ // SDK expects a bare extension ("mp4"), not a MIME type ("video/mp4").
309
+ const videoExt = fileName.split(".").pop()?.toLowerCase() || "mp4";
285
310
  const created = await sdk.createVideoMessageByFile({
286
311
  videoPath: "",
287
312
  duration: 0,
288
- videoType: contentType,
313
+ videoType: videoExt,
289
314
  snapshotPath: "",
290
315
  videoUUID: crypto.randomUUID(),
291
316
  videoUrl: "",
292
317
  videoSize: buffer.length,
293
318
  snapshotUUID: crypto.randomUUID(),
294
- snapshotSize: 0,
319
+ snapshotSize: MINIMAL_JPEG.length,
295
320
  snapshotUrl: "",
296
- snapshotWidth: 0,
297
- snapshotHeight: 0,
321
+ snapshotWidth: 1,
322
+ snapshotHeight: 1,
298
323
  videoFile,
299
324
  snapshotFile,
300
325
  });
package/src/upload.ts CHANGED
@@ -14,12 +14,44 @@ export function detectMediaCategory(filePath: string): MediaCategory {
14
14
  if ([".mp3", ".m4a", ".wav", ".ogg"].includes(ext)) return "audio";
15
15
  if (
16
16
  [
17
- ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx",
18
- ".zip", ".rar", ".7z", ".tar", ".gz", ".tgz",
19
- ".txt", ".csv", ".json", ".xml", ".yaml", ".yml",
20
- ".log", ".md", ".html", ".css", ".js", ".ts",
21
- ".py", ".go", ".rs", ".java", ".c", ".cpp", ".h",
22
- ".sh", ".bat", ".sql", ".toml", ".ini", ".cfg",
17
+ ".pdf",
18
+ ".doc",
19
+ ".docx",
20
+ ".xls",
21
+ ".xlsx",
22
+ ".ppt",
23
+ ".pptx",
24
+ ".zip",
25
+ ".rar",
26
+ ".7z",
27
+ ".tar",
28
+ ".gz",
29
+ ".tgz",
30
+ ".txt",
31
+ ".csv",
32
+ ".json",
33
+ ".xml",
34
+ ".yaml",
35
+ ".yml",
36
+ ".log",
37
+ ".md",
38
+ ".html",
39
+ ".css",
40
+ ".js",
41
+ ".ts",
42
+ ".py",
43
+ ".go",
44
+ ".rs",
45
+ ".java",
46
+ ".c",
47
+ ".cpp",
48
+ ".h",
49
+ ".sh",
50
+ ".bat",
51
+ ".sql",
52
+ ".toml",
53
+ ".ini",
54
+ ".cfg",
23
55
  ].includes(ext)
24
56
  )
25
57
  return "file";