📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Bot filtering setting
Blue Mousef0df34284ca6
diff --git a/backend/apps/production/src/project/dto/project.dto.ts b/backend/apps/production/src/project/dto/project.dto.tsindex 38f36e056..5bf5bf155 100644--- a/backend/apps/production/src/project/dto/project.dto.ts+++ b/backend/apps/production/src/project/dto/project.dto.ts@@ -1,5 +1,6 @@import { ApiProperty } from '@nestjs/swagger'-import { IsNotEmpty, Length } from 'class-validator'+import { IsNotEmpty, Length, IsEnum, IsOptional } from 'class-validator'+import { BotsProtectionLevel } from '../entity/project.entity'export class ProjectDTO {@ApiProperty({@@ -26,6 +27,15 @@ export class ProjectDTO {})origins: string[] | null+ @ApiProperty({+ enum: BotsProtectionLevel,+ required: false,+ description: 'Bots protection level',+ })+ @IsEnum(BotsProtectionLevel)+ @IsOptional()+ botsProtectionLevel?: BotsProtectionLevel+@ApiProperty({example: '::1,127.0.0.1,192.168.0.1/32',required: false,diff --git a/backend/apps/production/src/project/entity/project.entity.ts b/backend/apps/production/src/project/entity/project.entity.tsindex 59581af2f..725f9fd73 100644--- a/backend/apps/production/src/project/entity/project.entity.ts+++ b/backend/apps/production/src/project/entity/project.entity.ts@@ -18,6 +18,11 @@ import { CAPTCHA_SECRET_KEY_LENGTH } from '../../common/constants'import { ProjectViewEntity } from './project-view.entity'import { MonitorEntity } from './monitor.entity'+export enum BotsProtectionLevel {+ OFF = 'off',+ BASIC = 'basic',+}+// In case of modifying some properties here add them to the GDPR data export email template@Entity()export class Project {@@ -72,6 +77,14 @@ export class Project {@Column('varchar', { default: null, length: CAPTCHA_SECRET_KEY_LENGTH })captchaSecretKey: string+ @ApiProperty()+ @Column({+ type: 'enum',+ enum: BotsProtectionLevel,+ default: BotsProtectionLevel.BASIC,+ })+ botsProtectionLevel: BotsProtectionLevel+@ApiProperty({ type: () => User })@ManyToOne(() => User, user => user.projects)admin: Userdiff --git a/backend/apps/production/src/project/project.controller.ts b/backend/apps/production/src/project/project.controller.tsindex f3cdd5d7a..f9a29e14a 100644--- a/backend/apps/production/src/project/project.controller.ts+++ b/backend/apps/production/src/project/project.controller.ts@@ -1832,6 +1832,10 @@ export class ProjectController {project.ipBlacklist = null}+ if (projectDTO.botsProtectionLevel) {+ project.botsProtectionLevel = projectDTO.botsProtectionLevel+ }+if (projectDTO.name) {project.name = _trim(projectDTO.name)}