@openclaw/nextcloud-talk 2026.2.15 → 2026.2.17
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/channel.ts +1 -1
- package/src/inbound.ts +1 -1
- package/src/monitor.read-body.test.ts +3 -25
- package/src/monitor.ts +6 -6
- package/src/onboarding.ts +3 -2
- package/src/room-info.ts +1 -1
- package/src/send.ts +1 -1
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
type OpenClawConfig,
|
|
11
11
|
type ChannelSetupInput,
|
|
12
12
|
} from "openclaw/plugin-sdk";
|
|
13
|
-
import type { CoreConfig } from "./types.js";
|
|
14
13
|
import {
|
|
15
14
|
listNextcloudTalkAccountIds,
|
|
16
15
|
resolveDefaultNextcloudTalkAccountId,
|
|
@@ -27,6 +26,7 @@ import { nextcloudTalkOnboardingAdapter } from "./onboarding.js";
|
|
|
27
26
|
import { resolveNextcloudTalkGroupToolPolicy } from "./policy.js";
|
|
28
27
|
import { getNextcloudTalkRuntime } from "./runtime.js";
|
|
29
28
|
import { sendMessageNextcloudTalk } from "./send.js";
|
|
29
|
+
import type { CoreConfig } from "./types.js";
|
|
30
30
|
|
|
31
31
|
const meta = {
|
|
32
32
|
id: "nextcloud-talk",
|
package/src/inbound.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
type RuntimeEnv,
|
|
7
7
|
} from "openclaw/plugin-sdk";
|
|
8
8
|
import type { ResolvedNextcloudTalkAccount } from "./accounts.js";
|
|
9
|
-
import type { CoreConfig, GroupPolicy, NextcloudTalkInboundMessage } from "./types.js";
|
|
10
9
|
import {
|
|
11
10
|
normalizeNextcloudTalkAllowlist,
|
|
12
11
|
resolveNextcloudTalkAllowlistMatch,
|
|
@@ -18,6 +17,7 @@ import {
|
|
|
18
17
|
import { resolveNextcloudTalkRoomKind } from "./room-info.js";
|
|
19
18
|
import { getNextcloudTalkRuntime } from "./runtime.js";
|
|
20
19
|
import { sendMessageNextcloudTalk } from "./send.js";
|
|
20
|
+
import type { CoreConfig, GroupPolicy, NextcloudTalkInboundMessage } from "./types.js";
|
|
21
21
|
|
|
22
22
|
const CHANNEL_ID = "nextcloud-talk" as const;
|
|
23
23
|
|
|
@@ -1,38 +1,16 @@
|
|
|
1
|
-
import type { IncomingMessage } from "node:http";
|
|
2
|
-
import { EventEmitter } from "node:events";
|
|
3
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { createMockIncomingRequest } from "../../../test/helpers/mock-incoming-request.js";
|
|
4
3
|
import { readNextcloudTalkWebhookBody } from "./monitor.js";
|
|
5
4
|
|
|
6
|
-
function createMockRequest(chunks: string[]): IncomingMessage {
|
|
7
|
-
const req = new EventEmitter() as IncomingMessage & { destroyed?: boolean; destroy: () => void };
|
|
8
|
-
req.destroyed = false;
|
|
9
|
-
req.headers = {};
|
|
10
|
-
req.destroy = () => {
|
|
11
|
-
req.destroyed = true;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
void Promise.resolve().then(() => {
|
|
15
|
-
for (const chunk of chunks) {
|
|
16
|
-
req.emit("data", Buffer.from(chunk, "utf-8"));
|
|
17
|
-
if (req.destroyed) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
req.emit("end");
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
return req;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
5
|
describe("readNextcloudTalkWebhookBody", () => {
|
|
28
6
|
it("reads valid body within max bytes", async () => {
|
|
29
|
-
const req =
|
|
7
|
+
const req = createMockIncomingRequest(['{"type":"Create"}']);
|
|
30
8
|
const body = await readNextcloudTalkWebhookBody(req, 1024);
|
|
31
9
|
expect(body).toBe('{"type":"Create"}');
|
|
32
10
|
});
|
|
33
11
|
|
|
34
12
|
it("rejects when payload exceeds max bytes", async () => {
|
|
35
|
-
const req =
|
|
13
|
+
const req = createMockIncomingRequest(["x".repeat(300)]);
|
|
36
14
|
await expect(readNextcloudTalkWebhookBody(req, 128)).rejects.toThrow("PayloadTooLarge");
|
|
37
15
|
});
|
|
38
16
|
});
|
package/src/monitor.ts
CHANGED
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
readRequestBodyWithLimit,
|
|
6
6
|
requestBodyErrorToText,
|
|
7
7
|
} from "openclaw/plugin-sdk";
|
|
8
|
+
import { resolveNextcloudTalkAccount } from "./accounts.js";
|
|
9
|
+
import { handleNextcloudTalkInbound } from "./inbound.js";
|
|
10
|
+
import { getNextcloudTalkRuntime } from "./runtime.js";
|
|
11
|
+
import { extractNextcloudTalkHeaders, verifyNextcloudTalkSignature } from "./signature.js";
|
|
8
12
|
import type {
|
|
9
13
|
CoreConfig,
|
|
10
14
|
NextcloudTalkInboundMessage,
|
|
11
15
|
NextcloudTalkWebhookPayload,
|
|
12
16
|
NextcloudTalkWebhookServerOptions,
|
|
13
17
|
} from "./types.js";
|
|
14
|
-
import { resolveNextcloudTalkAccount } from "./accounts.js";
|
|
15
|
-
import { handleNextcloudTalkInbound } from "./inbound.js";
|
|
16
|
-
import { getNextcloudTalkRuntime } from "./runtime.js";
|
|
17
|
-
import { extractNextcloudTalkHeaders, verifyNextcloudTalkSignature } from "./signature.js";
|
|
18
18
|
|
|
19
19
|
const DEFAULT_WEBHOOK_PORT = 8788;
|
|
20
20
|
const DEFAULT_WEBHOOK_HOST = "0.0.0.0";
|
|
@@ -213,8 +213,8 @@ export async function monitorNextcloudTalkProvider(
|
|
|
213
213
|
accountId: opts.accountId,
|
|
214
214
|
});
|
|
215
215
|
const runtime: RuntimeEnv = opts.runtime ?? {
|
|
216
|
-
log: (
|
|
217
|
-
error: (
|
|
216
|
+
log: (...args: unknown[]) => core.logging.getChildLogger().info(args.map(String).join(" ")),
|
|
217
|
+
error: (...args: unknown[]) => core.logging.getChildLogger().error(args.map(String).join(" ")),
|
|
218
218
|
exit: () => {
|
|
219
219
|
throw new Error("Runtime exit not available");
|
|
220
220
|
},
|
package/src/onboarding.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addWildcardAllowFrom,
|
|
3
3
|
formatDocsLink,
|
|
4
|
+
mergeAllowFromEntries,
|
|
4
5
|
promptAccountId,
|
|
5
6
|
DEFAULT_ACCOUNT_ID,
|
|
6
7
|
normalizeAccountId,
|
|
@@ -9,12 +10,12 @@ import {
|
|
|
9
10
|
type OpenClawConfig,
|
|
10
11
|
type WizardPrompter,
|
|
11
12
|
} from "openclaw/plugin-sdk";
|
|
12
|
-
import type { CoreConfig, DmPolicy } from "./types.js";
|
|
13
13
|
import {
|
|
14
14
|
listNextcloudTalkAccountIds,
|
|
15
15
|
resolveDefaultNextcloudTalkAccountId,
|
|
16
16
|
resolveNextcloudTalkAccount,
|
|
17
17
|
} from "./accounts.js";
|
|
18
|
+
import type { CoreConfig, DmPolicy } from "./types.js";
|
|
18
19
|
|
|
19
20
|
const channel = "nextcloud-talk" as const;
|
|
20
21
|
|
|
@@ -99,7 +100,7 @@ async function promptNextcloudTalkAllowFrom(params: {
|
|
|
99
100
|
...existingAllowFrom.map((item) => String(item).trim().toLowerCase()).filter(Boolean),
|
|
100
101
|
...resolvedIds,
|
|
101
102
|
];
|
|
102
|
-
const unique =
|
|
103
|
+
const unique = mergeAllowFromEntries(undefined, merged);
|
|
103
104
|
|
|
104
105
|
if (accountId === DEFAULT_ACCOUNT_ID) {
|
|
105
106
|
return {
|
package/src/room-info.ts
CHANGED
package/src/send.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { CoreConfig, NextcloudTalkSendResult } from "./types.js";
|
|
2
1
|
import { resolveNextcloudTalkAccount } from "./accounts.js";
|
|
3
2
|
import { getNextcloudTalkRuntime } from "./runtime.js";
|
|
4
3
|
import { generateNextcloudTalkSignature } from "./signature.js";
|
|
4
|
+
import type { CoreConfig, NextcloudTalkSendResult } from "./types.js";
|
|
5
5
|
|
|
6
6
|
type NextcloudTalkSendOpts = {
|
|
7
7
|
baseUrl?: string;
|