* Extracts the slug from the URL if it matches any of the allowed slugs * @param url - The request URL * @returns string | null - The matched slug or null if no match
(url: string)
| 91 | * @returns string | null - The matched slug or null if no match |
| 92 | */ |
| 93 | function extractSlugFromUrl(url: string): string | null { |
| 94 | for (const publicUrl of ALLOWED_SLUGS) { |
| 95 | if (url.includes(publicUrl)) { |
| 96 | return publicUrl.replace(/\//g, '') // remove slashes |
| 97 | } |
| 98 | } |
| 99 | return null |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Validates if a request is for public chatflows (embedded chatbots) |
no outgoing calls
no test coverage detected