📈 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
use plancode -> none
Blue Mouse2297d36294fb
diff --git a/src/alert/alert.controller.ts b/src/alert/alert.controller.tsindex 177bca091..5b8318f7e 100644--- a/src/alert/alert.controller.ts+++ b/src/alert/alert.controller.ts@@ -100,6 +100,12 @@ export class AlertController {const pids = _map(user.projects, (project) => project.id)const alertsCount = await this.alertService.count({ project: In(pids) })+ if (user.planCode === PlanCode.none) {+ throw new ForbiddenException(+ 'You cannot create new alerts due to no active subscription. Please upgrade your account plan to continue.',+ )+ }+if (alertsCount >= (maxAlerts || ALERTS_MAXIMUM)) {throw new ForbiddenException(`You cannot create more than ${maxAlerts} alerts on your account plan. Please upgrade to be able to create more alerts.`,diff --git a/src/analytics/analytics.service.ts b/src/analytics/analytics.service.tsindex f2d97f900..1e01b80a1 100644--- a/src/analytics/analytics.service.ts+++ b/src/analytics/analytics.service.ts@@ -27,7 +27,7 @@ import {PreconditionFailedException,} from '@nestjs/common'-import { ACCOUNT_PLANS, DEFAULT_TIMEZONE } from '../user/entities/user.entity'+import { ACCOUNT_PLANS, DEFAULT_TIMEZONE, PlanCode } from '../user/entities/user.entity'import {redis,isValidPID,@@ -323,6 +323,12 @@ export class AnalyticsService {}if (!isSelfhosted) {+ if (project.admin.planCode === PlanCode.none) {+ throw new ForbiddenException(+ 'You cannot send analytics to this project due to no active subscription. Please upgrade your account plan to continue sending analytics.',+ )+ }+const count = await this.projectService.getRedisCount(project.admin.id)const maxCount =ACCOUNT_PLANS[project.admin.planCode].monthlyUsageLimit || 0diff --git a/src/project/project.controller.ts b/src/project/project.controller.tsindex a2df925dd..7d5fec03b 100644--- a/src/project/project.controller.ts+++ b/src/project/project.controller.ts@@ -353,6 +353,12 @@ export class ProjectController {throw new ForbiddenException('Please, verify your email address first')}+ if (user.planCode === PlanCode.none) {+ throw new ForbiddenException(+ 'You cannot create new projects due to no active subscription. Please upgrade your account plan to continue.',+ )+ }+if (_size(user.projects) >= (maxProjects || PROJECTS_MAXIMUM)) {throw new ForbiddenException(`You cannot create more than ${maxProjects} projects on your account plan. Please upgrade to be able to create more projects.`,diff --git a/src/task-manager/task-manager.service.ts b/src/task-manager/task-manager.service.tsindex fb01b3416..ab8e66643 100644--- a/src/task-manager/task-manager.service.ts+++ b/src/task-manager/task-manager.service.ts@@ -20,7 +20,7 @@ import { AlertService } from 'src/alert/alert.service'import { ActionTokenType } from '../action-tokens/action-token.entity'import { LetterTemplate } from '../mailer/letter'import { AnalyticsService } from '../analytics/analytics.service'-import { ReportFrequency, ACCOUNT_PLANS } from '../user/entities/user.entity'+import { ReportFrequency, ACCOUNT_PLANS, PlanCode } from '../user/entities/user.entity'import {clickhouse,redis,@@ -387,6 +387,7 @@ export class TaskManagerService {{admin: {isTelegramChatIdConfirmed: true,+ planCode: Not(PlanCode.none),},},['admin'],@@ -439,6 +440,7 @@ export class TaskManagerService {{admin: {isTelegramChatIdConfirmed: true,+ planCode: Not(PlanCode.none),},},['admin'],