Skip to content

Commit

Permalink
⚡ (radar) Add radar cumulative keyword alternatives check
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Jan 15, 2024
1 parent b412f0e commit 0b00fa7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/env/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ const baseEnv = {
RADAR_CUMULATIVE_KEYWORDS: z
.string()
.min(1)
.transform((val) => val.split('/').map((s) => s.split(',')))
.transform((val) =>
val.split('/').map((s) => s.split(',').map((s) => s.split('|')))
)
.optional(),
},
client: {
Expand Down
6 changes: 4 additions & 2 deletions packages/radar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ export const computeRiskLevel = (typebot: any) => {
if (
env.RADAR_CUMULATIVE_KEYWORDS?.some((set) =>
set.every((keyword) =>
new RegExp(`(?<!https?://[^\\s"]*)\\b${keyword}\\b`, 'gi').test(
stringifiedTypebot
keyword.some((k) =>
new RegExp(`(?<!https?://[^\\s"]*)\\b${k}\\b`, 'gi').test(
stringifiedTypebot
)
)
)
)
Expand Down
8 changes: 8 additions & 0 deletions packages/radar/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@typebot.io/tsconfig/base.json",
"include": ["**/*.ts"],
"exclude": ["node_modules"],
"compilerOptions": {
"target": "ES2015"
}
}

2 comments on commit 0b00fa7

@vercel
Copy link

@vercel vercel bot commented on 0b00fa7 Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
app.typebot.io
builder-v2-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 0b00fa7 Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

landing-page-v2 – ./apps/landing-page

landing-page-v2-git-main-typebot-io.vercel.app
landing-page-v2-typebot-io.vercel.app
home.typebot.io

Please sign in to comment.