validateChatflowDomain (utils/domainValidation.ts)

Flowise · packages/server/src/utils/domainValidation.ts · typescript · Apache-2.0
voice

Utility for validating chatflow domain access and extracting IDs.

// Source: https://github.com/FlowiseAI/Flowise | License: Apache-2.0 | Copyright 2023-present FlowiseAI, Inc
// Provided via justclaw.it.com; keep this notice with the code.
import { isValidUUID } from 'flowise-components'
import chatflowsService from '../services/chatflows'
import logger from './logger'

// List of allowed URL slugs for public access to chatbots
// It assumes the URL format includes one of the following patterns:
// /prediction/{chatflowId}.
// /public-chatbotConfig/{chatflowId}
// /chatflows-streaming/{chatflowId}
const ALLOWED_SLUGS = ['/prediction/', '/public-chatbotConfig/', '/chatflows-streaming/']

// The TTS generate endpoint passes chatflowId in the request body, not the URL path
const TTS_GENERATE_PATH = '/api/v1/text-to-speech/generate'

/**
 * Validates if the

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key