@openclaw/bluebubbles 2026.2.14 → 2026.2.15
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 +1 -1
- package/src/attachments.ts +6 -19
- package/src/chat.ts +6 -19
- package/src/multipart.ts +32 -0
- package/src/probe.ts +2 -3
package/package.json
CHANGED
package/src/attachments.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
|
|
2
2
|
import crypto from "node:crypto";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { resolveBlueBubblesAccount } from "./accounts.js";
|
|
5
|
+
import { postMultipartFormData } from "./multipart.js";
|
|
5
6
|
import { getCachedBlueBubblesPrivateApiStatus } from "./probe.js";
|
|
6
7
|
import { extractBlueBubblesMessageId, resolveBlueBubblesSendTarget } from "./send-helpers.js";
|
|
7
8
|
import { resolveChatGuidForTarget } from "./send.js";
|
|
@@ -219,26 +220,12 @@ export async function sendBlueBubblesAttachment(params: {
|
|
|
219
220
|
// Close the multipart body
|
|
220
221
|
parts.push(encoder.encode(`--${boundary}--\r\n`));
|
|
221
222
|
|
|
222
|
-
|
|
223
|
-
const totalLength = parts.reduce((acc, part) => acc + part.length, 0);
|
|
224
|
-
const body = new Uint8Array(totalLength);
|
|
225
|
-
let offset = 0;
|
|
226
|
-
for (const part of parts) {
|
|
227
|
-
body.set(part, offset);
|
|
228
|
-
offset += part.length;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
const res = await blueBubblesFetchWithTimeout(
|
|
223
|
+
const res = await postMultipartFormData({
|
|
232
224
|
url,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
},
|
|
238
|
-
body,
|
|
239
|
-
},
|
|
240
|
-
opts.timeoutMs ?? 60_000, // longer timeout for file uploads
|
|
241
|
-
);
|
|
225
|
+
boundary,
|
|
226
|
+
parts,
|
|
227
|
+
timeoutMs: opts.timeoutMs ?? 60_000, // longer timeout for file uploads
|
|
228
|
+
});
|
|
242
229
|
|
|
243
230
|
if (!res.ok) {
|
|
244
231
|
const errorText = await res.text();
|
package/src/chat.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
|
|
2
2
|
import crypto from "node:crypto";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { resolveBlueBubblesAccount } from "./accounts.js";
|
|
5
|
+
import { postMultipartFormData } from "./multipart.js";
|
|
5
6
|
import { getCachedBlueBubblesPrivateApiStatus } from "./probe.js";
|
|
6
7
|
import { blueBubblesFetchWithTimeout, buildBlueBubblesApiUrl } from "./types.js";
|
|
7
8
|
|
|
@@ -376,26 +377,12 @@ export async function setGroupIconBlueBubbles(
|
|
|
376
377
|
// Close multipart body
|
|
377
378
|
parts.push(encoder.encode(`--${boundary}--\r\n`));
|
|
378
379
|
|
|
379
|
-
|
|
380
|
-
const totalLength = parts.reduce((acc, part) => acc + part.length, 0);
|
|
381
|
-
const body = new Uint8Array(totalLength);
|
|
382
|
-
let offset = 0;
|
|
383
|
-
for (const part of parts) {
|
|
384
|
-
body.set(part, offset);
|
|
385
|
-
offset += part.length;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
const res = await blueBubblesFetchWithTimeout(
|
|
380
|
+
const res = await postMultipartFormData({
|
|
389
381
|
url,
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
},
|
|
395
|
-
body,
|
|
396
|
-
},
|
|
397
|
-
opts.timeoutMs ?? 60_000, // longer timeout for file uploads
|
|
398
|
-
);
|
|
382
|
+
boundary,
|
|
383
|
+
parts,
|
|
384
|
+
timeoutMs: opts.timeoutMs ?? 60_000, // longer timeout for file uploads
|
|
385
|
+
});
|
|
399
386
|
|
|
400
387
|
if (!res.ok) {
|
|
401
388
|
const errorText = await res.text().catch(() => "");
|
package/src/multipart.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { blueBubblesFetchWithTimeout } from "./types.js";
|
|
2
|
+
|
|
3
|
+
export function concatUint8Arrays(parts: Uint8Array[]): Uint8Array {
|
|
4
|
+
const totalLength = parts.reduce((acc, part) => acc + part.length, 0);
|
|
5
|
+
const body = new Uint8Array(totalLength);
|
|
6
|
+
let offset = 0;
|
|
7
|
+
for (const part of parts) {
|
|
8
|
+
body.set(part, offset);
|
|
9
|
+
offset += part.length;
|
|
10
|
+
}
|
|
11
|
+
return body;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function postMultipartFormData(params: {
|
|
15
|
+
url: string;
|
|
16
|
+
boundary: string;
|
|
17
|
+
parts: Uint8Array[];
|
|
18
|
+
timeoutMs: number;
|
|
19
|
+
}): Promise<Response> {
|
|
20
|
+
const body = Buffer.from(concatUint8Arrays(params.parts));
|
|
21
|
+
return await blueBubblesFetchWithTimeout(
|
|
22
|
+
params.url,
|
|
23
|
+
{
|
|
24
|
+
method: "POST",
|
|
25
|
+
headers: {
|
|
26
|
+
"Content-Type": `multipart/form-data; boundary=${params.boundary}`,
|
|
27
|
+
},
|
|
28
|
+
body,
|
|
29
|
+
},
|
|
30
|
+
params.timeoutMs,
|
|
31
|
+
);
|
|
32
|
+
}
|
package/src/probe.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import type { BaseProbeResult } from "openclaw/plugin-sdk";
|
|
1
2
|
import { buildBlueBubblesApiUrl, blueBubblesFetchWithTimeout } from "./types.js";
|
|
2
3
|
|
|
3
|
-
export type BlueBubblesProbe = {
|
|
4
|
-
ok: boolean;
|
|
4
|
+
export type BlueBubblesProbe = BaseProbeResult & {
|
|
5
5
|
status?: number | null;
|
|
6
|
-
error?: string | null;
|
|
7
6
|
};
|
|
8
7
|
|
|
9
8
|
export type BlueBubblesServerInfo = {
|