📈 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
Remove API_ORIGINS support, add apiKey to auth/me to selfhosted
Blue Mouse29d871e00867
diff --git a/backend/.env.example b/backend/.env.exampleindex c10c42c52..d6c97dd32 100644--- a/backend/.env.example+++ b/backend/.env.example@@ -28,8 +28,6 @@ CLICKHOUSE_USER=defaultCLICKHOUSE_PORT=8123CLICKHOUSE_PASSWORD=CLICKHOUSE_DATABASE=analytics-# Leave empty for all origins-API_ORIGINS=# EMAIL SERVICESMTP_HOST=localhostdiff --git a/backend/apps/production/src/main.ts b/backend/apps/production/src/main.tsindex 418ea51e6..cd392f9a2 100644--- a/backend/apps/production/src/main.ts+++ b/backend/apps/production/src/main.ts@@ -43,7 +43,7 @@ async function bootstrap() {res.header('X-Frame-Options', 'DENY')res.header('X-Powered-By', 'Mountain Dew')res.header('X-XSS-Protection', '1; mode=block')- res.header('Access-Control-Allow-Origin', process.env.API_ORIGINS || '*')+ res.header('Access-Control-Allow-Origin', '*')res.header('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE,PATCH')res.header('Access-Control-Allow-Headers', 'Authorization, *')diff --git a/backend/apps/selfhosted/src/main.ts b/backend/apps/selfhosted/src/main.tsindex f36619ea6..718999f67 100644--- a/backend/apps/selfhosted/src/main.ts+++ b/backend/apps/selfhosted/src/main.ts@@ -38,7 +38,7 @@ async function bootstrap() {res.header('X-Frame-Options', 'DENY')res.header('X-Powered-By', 'Mountain Dew')res.header('X-XSS-Protection', '1; mode=block')- res.header('Access-Control-Allow-Origin', process.env.API_ORIGINS || '*')+ res.header('Access-Control-Allow-Origin', '*')res.header('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE,PATCH')res.header('Access-Control-Allow-Headers', 'Authorization, *')diff --git a/backend/apps/selfhosted/src/user/entities/user.entity.ts b/backend/apps/selfhosted/src/user/entities/user.entity.tsindex d5f8d86b7..0484d8247 100644--- a/backend/apps/selfhosted/src/user/entities/user.entity.ts+++ b/backend/apps/selfhosted/src/user/entities/user.entity.ts@@ -1,5 +1,9 @@import _omit from 'lodash/omit'-import { SELFHOSTED_EMAIL, SELFHOSTED_UUID } from '../../common/constants'+import {+ SELFHOSTED_API_KEY,+ SELFHOSTED_EMAIL,+ SELFHOSTED_UUID,+} from '../../common/constants'import { getUserClickhouse } from '../../common/utils'export enum UserType {@@ -24,6 +28,7 @@ export interface SelfhostedUser {timezone: stringtimeFormat: TimeFormatshowLiveVisitorsInTitle: boolean+ apiKey?: string}export const generateSelfhostedUser = (): SelfhostedUser => ({@@ -36,6 +41,7 @@ export const generateSelfhostedUser = (): SelfhostedUser => ({timezone: DEFAULT_TIMEZONE,timeFormat: TimeFormat['12-hour'],showLiveVisitorsInTitle: false,+ apiKey: SELFHOSTED_API_KEY,})export const getSelfhostedUser = async (): Promise<SelfhostedUser> => {