diff --git a/extensions/synology-chat/src/channel.test.ts b/extensions/synology-chat/src/channel.test.ts index 89a960132..f4a422e4c 100644 --- a/extensions/synology-chat/src/channel.test.ts +++ b/extensions/synology-chat/src/channel.test.ts @@ -268,18 +268,10 @@ describe("createSynologyChatPlugin", () => { const plugin = createSynologyChatPlugin(); await expect( plugin.outbound.sendText({ - account: { - accountId: "default", - enabled: true, - token: "t", - incomingUrl: "", - nasHost: "h", - webhookPath: "/w", - dmPolicy: "open", - allowedUserIds: [], - rateLimitPerMinute: 30, - botName: "Bot", - allowInsecureSsl: true, + cfg: { + channels: { + "synology-chat": { enabled: true, token: "t", incomingUrl: "" }, + }, }, text: "hello", to: "user1", @@ -290,18 +282,15 @@ describe("createSynologyChatPlugin", () => { it("sendText returns OutboundDeliveryResult on success", async () => { const plugin = createSynologyChatPlugin(); const result = await plugin.outbound.sendText({ - account: { - accountId: "default", - enabled: true, - token: "t", - incomingUrl: "https://nas/incoming", - nasHost: "h", - webhookPath: "/w", - dmPolicy: "open", - allowedUserIds: [], - rateLimitPerMinute: 30, - botName: "Bot", - allowInsecureSsl: true, + cfg: { + channels: { + "synology-chat": { + enabled: true, + token: "t", + incomingUrl: "https://nas/incoming", + allowInsecureSsl: true, + }, + }, }, text: "hello", to: "user1", @@ -315,18 +304,10 @@ describe("createSynologyChatPlugin", () => { const plugin = createSynologyChatPlugin(); await expect( plugin.outbound.sendMedia({ - account: { - accountId: "default", - enabled: true, - token: "t", - incomingUrl: "", - nasHost: "h", - webhookPath: "/w", - dmPolicy: "open", - allowedUserIds: [], - rateLimitPerMinute: 30, - botName: "Bot", - allowInsecureSsl: true, + cfg: { + channels: { + "synology-chat": { enabled: true, token: "t", incomingUrl: "" }, + }, }, mediaUrl: "https://example.com/img.png", to: "user1", diff --git a/extensions/synology-chat/src/channel.ts b/extensions/synology-chat/src/channel.ts index ca7a3e31b..1032d1256 100644 --- a/extensions/synology-chat/src/channel.ts +++ b/extensions/synology-chat/src/channel.ts @@ -178,8 +178,8 @@ export function createSynologyChatPlugin() { deliveryMode: "gateway" as const, textChunkLimit: 2000, - sendText: async ({ to, text, accountId, account: ctxAccount }: any) => { - const account: ResolvedSynologyChatAccount = ctxAccount ?? resolveAccount({}, accountId); + sendText: async ({ to, text, accountId, cfg }: any) => { + const account: ResolvedSynologyChatAccount = resolveAccount(cfg ?? {}, accountId); if (!account.incomingUrl) { throw new Error("Synology Chat incoming URL not configured"); @@ -192,8 +192,8 @@ export function createSynologyChatPlugin() { return { channel: CHANNEL_ID, messageId: `sc-${Date.now()}`, chatId: to }; }, - sendMedia: async ({ to, mediaUrl, accountId, account: ctxAccount }: any) => { - const account: ResolvedSynologyChatAccount = ctxAccount ?? resolveAccount({}, accountId); + sendMedia: async ({ to, mediaUrl, accountId, cfg }: any) => { + const account: ResolvedSynologyChatAccount = resolveAccount(cfg ?? {}, accountId); if (!account.incomingUrl) { throw new Error("Synology Chat incoming URL not configured");