mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(Chat Trigger Node): Fix Allowed Origins paramter (#11011)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { Response } from 'express';
|
||||
import { Workflow, NodeHelpers } from 'n8n-workflow';
|
||||
import { Workflow, NodeHelpers, CHAT_TRIGGER_NODE_TYPE } from 'n8n-workflow';
|
||||
import type { INode, IWebhookData, IHttpRequestMethods } from 'n8n-workflow';
|
||||
import { Service } from 'typedi';
|
||||
|
||||
@@ -47,12 +47,18 @@ export class LiveWebhooks implements IWebhookManager {
|
||||
select: ['nodes'],
|
||||
});
|
||||
|
||||
const isChatWebhookNode = (type: string, webhookId?: string) =>
|
||||
type === CHAT_TRIGGER_NODE_TYPE && `${webhookId}/chat` === path;
|
||||
|
||||
const nodes = workflowData?.nodes;
|
||||
const webhookNode = nodes?.find(
|
||||
({ type, parameters, typeVersion }) =>
|
||||
parameters?.path === path &&
|
||||
(parameters?.httpMethod ?? 'GET') === httpMethod &&
|
||||
'webhook' in this.nodeTypes.getByNameAndVersion(type, typeVersion),
|
||||
({ type, parameters, typeVersion, webhookId }) =>
|
||||
(parameters?.path === path &&
|
||||
(parameters?.httpMethod ?? 'GET') === httpMethod &&
|
||||
'webhook' in this.nodeTypes.getByNameAndVersion(type, typeVersion)) ||
|
||||
// Chat Trigger has doesn't have configurable path and is always using POST, so
|
||||
// we need to use webhookId for matching
|
||||
isChatWebhookNode(type, webhookId),
|
||||
);
|
||||
return webhookNode?.parameters?.options as WebhookAccessControlOptions;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user