Skip to content

📈 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!

removed redundant methods

Blue Mouse3d6a1ff31f89
diff --git a/src/analytics/analytics.service.spec.ts b/src/analytics/analytics.service.spec.ts
index 4370ff26a..4cfcc86ae 100644
--- a/src/analytics/analytics.service.spec.ts
+++ b/src/analytics/analytics.service.spec.ts
@@ -69,9 +69,6 @@ describe('AnalyticsService', () => {
it('should be defined with groupByTimeBucket()', () => {
expect(service.groupByTimeBucket).toBeDefined()
})
- it('should be defined with isSessionOpen()', () => {
- expect(service.isSessionOpen).toBeDefined()
- })
it('should be defined with isUnique()', () => {
expect(service.isUnique).toBeDefined()
})
@@ -81,9 +78,6 @@ describe('AnalyticsService', () => {
it('should be defined with validate()', () => {
expect(service.validate).toBeDefined()
})
- it('should be defined with validateHB()', () => {
- expect(service.validateHB).toBeDefined()
- })
it('should be defined with validatePID()', () => {
expect(service.validatePID).toBeDefined()
})
diff --git a/src/analytics/analytics.service.ts b/src/analytics/analytics.service.ts
index 4444ac9b1..0f5788228 100644
--- a/src/analytics/analytics.service.ts
+++ b/src/analytics/analytics.service.ts
@@ -341,32 +341,11 @@ export class AnalyticsService {
return null
}
- async validateHB(
- logDTO: PageviewsDTO,
- userAgent: string,
- ip: string,
- ): Promise<string | null> {
- if (_isEmpty(logDTO))
- throw new BadRequestException('The request cannot be empty')
-
- const { pid } = logDTO
- this.validatePID(pid)
-
- const salt = await redis.get(REDIS_SESSION_SALT_KEY)
- const sessionHash = getSessionKey(ip, userAgent, pid, salt)
- const sessionExists = await this.isSessionOpen(sessionHash)
-
- if (!sessionExists)
- throw new ForbiddenException('The Heartbeat session does not exist')
-
- return sessionHash
- }
-
async getSessionHash(
pid: string,
userAgent: string,
ip: string,
- ): Promise<string | null> {
+ ): Promise<string> {
this.validatePID(pid)
const salt = await redis.get(REDIS_SESSION_SALT_KEY)
@@ -469,11 +448,6 @@ export class AnalyticsService {
return !session
}
- async isSessionOpen(sessionHash: string) {
- const session = await redis.get(sessionHash)
- return Boolean(session)
- }
-
async getSummary(
pids: string[],
period: 'w' | 'M' = 'w',