mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
refactor(synology-chat): thread command authorization from webhook gate
This commit is contained in:
@@ -282,7 +282,7 @@ export function createSynologyChatPlugin() {
|
||||
Surface: CHANNEL_ID,
|
||||
ConversationLabel: msg.senderName || msg.from,
|
||||
Timestamp: Date.now(),
|
||||
CommandAuthorized: true,
|
||||
CommandAuthorized: msg.commandAuthorized,
|
||||
});
|
||||
|
||||
// Dispatch via the SDK's buffered block dispatcher
|
||||
|
||||
@@ -237,6 +237,7 @@ describe("createWebhookHandler", () => {
|
||||
body: "Hello from json",
|
||||
from: "123",
|
||||
senderName: "json-user",
|
||||
commandAuthorized: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -396,6 +397,7 @@ describe("createWebhookHandler", () => {
|
||||
senderName: "testuser",
|
||||
provider: "synology-chat",
|
||||
chatType: "direct",
|
||||
commandAuthorized: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -422,6 +424,7 @@ describe("createWebhookHandler", () => {
|
||||
expect(deliver).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
body: expect.stringContaining("[FILTERED]"),
|
||||
commandAuthorized: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -225,6 +225,7 @@ export interface WebhookHandlerDeps {
|
||||
chatType: string;
|
||||
sessionKey: string;
|
||||
accountId: string;
|
||||
commandAuthorized: boolean;
|
||||
/** Chat API user_id for sending replies (may differ from webhook user_id) */
|
||||
chatUserId?: string;
|
||||
}) => Promise<string | null>;
|
||||
@@ -364,6 +365,7 @@ export function createWebhookHandler(deps: WebhookHandlerDeps) {
|
||||
chatType: "direct",
|
||||
sessionKey,
|
||||
accountId: account.accountId,
|
||||
commandAuthorized: auth.allowed,
|
||||
chatUserId: replyUserId,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user