📈 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
fixed the selfhosted swetrix edition
Blue Mouse7cad61129a44
diff --git a/migrations/clickhouse/initialise_selfhosted.js b/migrations/clickhouse/initialise_selfhosted.jsindex 3a41ba22f..56bddc451 100644--- a/migrations/clickhouse/initialise_selfhosted.js+++ b/migrations/clickhouse/initialise_selfhosted.js@@ -15,6 +15,14 @@ const CLICKHOUSE_INIT_QUERIES = [ENGINE = MergeTree()PARTITION BY toYYYYMM(created)ORDER BY (created);`,++ `CREATE TABLE IF NOT EXISTS ${dbName}.refresh_token+ (+ userId String,+ refreshToken String+ )+ ENGINE = MergeTree()+ ORDER BY userId;`,]const initialiseSelfhosted = async () => {diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.tsindex c2a2fcf28..dfa7b4e26 100644--- a/src/auth/auth.controller.ts+++ b/src/auth/auth.controller.ts@@ -27,11 +27,12 @@ import { I18nValidationExceptionFilter, I18n, I18nContext } from 'nestjs-i18n'import * as _pick from 'lodash/pick'import { checkRateLimit } from 'src/common/utils'-import { UserType } from 'src/user/entities/user.entity'+import { UserType, User } from 'src/user/entities/user.entity'import { UserService } from 'src/user/user.service'-import { isDevelopment } from 'src/common/constants'+import { isDevelopment, isSelfhosted } from 'src/common/constants'import { AuthService } from './auth.service'import { Public, CurrentUserId, CurrentUser, Roles } from './decorators'+import { SelfhostedGuard } from '../common/guards/selfhosted.guard'import {RegisterResponseDto,RegisterRequestDto,@@ -53,8 +54,7 @@ import {import { SSOProviders } from './dtos/sso-generate.dto'import { JwtAccessTokenGuard, JwtRefreshTokenGuard, RolesGuard } from './guards'-const LOCAL_OAUTH_RATE_LIMIT = 2000-const PRODUCTION_OAUTH_RATE_LIMIT = 15+const OAUTH_RATE_LIMIT = 15@ApiTags('Auth')@Controller({ path: 'auth', version: '1' })@@ -79,6 +79,7 @@ export class AuthController {description: 'User registered',type: RegisterResponseDto,})+ @UseGuards(SelfhostedGuard)@Public()@Post('register')public async register(@@ -148,23 +149,29 @@ export class AuthController {throw new ConflictException(i18n.t('auth.invalidCredentials'))}- await this.authService.sendTelegramNotification(user.id, headers, ip)-const jwtTokens = await this.authService.generateJwtTokens(user.id,!user.isTwoFactorAuthenticationEnabled,)+ if (isSelfhosted) {+ return {+ ...jwtTokens,+ user,+ }+ }++ await this.authService.sendTelegramNotification(user.id, headers, ip)+if (user.isTwoFactorAuthenticationEnabled) {user = _pick(user, ['isTwoFactorAuthenticationEnabled', 'email'])} else {- user = await this.authService.getSharedProjectsForUser(user)+ user = await this.authService.getSharedProjectsForUser(user as User)}return {- accessToken: jwtTokens.accessToken,- refreshToken: jwtTokens.refreshToken,- user: this.userService.omitSensitiveData(user),+ ...jwtTokens,+ user: this.userService.omitSensitiveData(user as User),}}@@ -172,6 +179,7 @@ export class AuthController {@ApiOkResponse({description: 'User email verified',})+ @UseGuards(SelfhostedGuard)@Public()@Get('verify-email/:token')public async verifyEmail(@@ -193,6 +201,7 @@ export class AuthController {@ApiOkResponse({description: 'Password reset requested',})+ @UseGuards(SelfhostedGuard)@Public()@Post('reset-password')public async requestResetPassword(@@ -220,6 +229,7 @@ export class AuthController {@ApiOkResponse({description: 'Password reset',})+ @UseGuards(SelfhostedGuard)@Public()@Post('reset-password/confirm/:token')@HttpCode(200)@@ -243,6 +253,7 @@ export class AuthController {@ApiOkResponse({description: 'Password changed',})+ @UseGuards(SelfhostedGuard)@UseGuards(RolesGuard)@Roles(UserType.CUSTOMER, UserType.ADMIN)@Post('change-password')@@ -273,6 +284,7 @@ export class AuthController {@ApiOkResponse({description: 'Resend of the verification email requested',})+ @UseGuards(SelfhostedGuard)@UseGuards(RolesGuard)@Roles(UserType.CUSTOMER, UserType.ADMIN)@Post('verify-email')@@ -304,6 +316,7 @@ export class AuthController {@ApiOkResponse({description: 'User email changed',})+ @UseGuards(SelfhostedGuard)@UseGuards(RolesGuard)@Roles(UserType.CUSTOMER, UserType.ADMIN)@Post('change-email')@@ -340,6 +353,7 @@ export class AuthController {@ApiOkResponse({description: 'User email confirmed',})+ @UseGuards(SelfhostedGuard)@Public()@Get('change-email/confirm/:token')public async confirmChangeEmail(@@ -427,6 +441,7 @@ export class AuthController {// SSO section@ApiOperation({ summary: 'Generate SSO authentication URL' })@Post('sso/generate')+ @UseGuards(SelfhostedGuard)@Public()async generateAuthURL(@Body() body: SSOGenerateDto,@@ -439,7 +454,7 @@ export class AuthController {await checkRateLimit(ip,'sso-generate',- isDevelopment ? LOCAL_OAUTH_RATE_LIMIT : PRODUCTION_OAUTH_RATE_LIMIT,+ OAUTH_RATE_LIMIT,1800,)@@ -458,6 +473,7 @@ export class AuthController {@ApiOperation({ summary: 'Process authentication token (or code)' })@Post('sso/process-token')+ @UseGuards(SelfhostedGuard)@Public()async processSSOToken(@Body() body: ProcessSSOCodeDto,@@ -470,7 +486,7 @@ export class AuthController {await checkRateLimit(ip,'sso-process',- isDevelopment ? LOCAL_OAUTH_RATE_LIMIT : PRODUCTION_OAUTH_RATE_LIMIT,+ OAUTH_RATE_LIMIT,1800,)@@ -481,6 +497,7 @@ export class AuthController {@ApiOperation({ summary: 'Auth user' })@Post('sso/hash')+ @UseGuards(SelfhostedGuard)@Public()// Validates the authorisation code and returns the JWT tokensasync getJWTByHash(@@ -500,6 +517,7 @@ export class AuthController {@ApiOkResponse({description: 'SSO provider linked to an existing account',})+ @UseGuards(SelfhostedGuard)@UseGuards(RolesGuard)@Roles(UserType.CUSTOMER, UserType.ADMIN)@Post('sso/link_by_hash')@@ -516,6 +534,7 @@ export class AuthController {@ApiOkResponse({description: 'SSO provider unlinked from an existing account',})+ @UseGuards(SelfhostedGuard)@UseGuards(RolesGuard)@Roles(UserType.CUSTOMER, UserType.ADMIN)@Delete('sso/unlink')diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.tsindex 893f23772..f162f495f 100644--- a/src/auth/auth.service.ts+++ b/src/auth/auth.service.ts@@ -32,19 +32,29 @@ import {MAX_EMAIL_REQUESTS,User,TRIAL_DURATION,+ SelfhostedUser,+ generateSelfhostedUser,} from 'src/user/entities/user.entity'import { TelegrafContext } from 'src/user/user.controller'import { UserService } from 'src/user/user.service'import { ProjectService } from 'src/project/project.service'+import {+ saveRefreshTokenClickhouse, findRefreshTokenClickhouse,+} from 'src/common/utils'import {REDIS_SSO_UUID,redis,PRODUCTION_ORIGIN,isDevelopment,+ isSelfhosted,+ SELFHOSTED_EMAIL,+ SELFHOSTED_PASSWORD,+ SELFHOSTED_UUID,} from 'src/common/constants'import { SSOProviders } from './dtos/sso-generate.dto'import { UserGoogleDTO } from '../user/dto/user-google.dto'import { UserGithubDTO } from '../user/dto/user-github.dto'+import { RefreshToken } from 'src/user/entities/refresh-token.entity'const REDIS_SSO_SESSION_TIMEOUT = 60 * 5 // 5 minutesconst getSSORedisKey = (uuid: string) => `${REDIS_SSO_UUID}:${uuid}`@@ -179,7 +189,15 @@ export class AuthService {public async validateUser(email: string,password: string,- ): Promise<User | null> {+ ): Promise<User | SelfhostedUser | null> {+ if (isSelfhosted) {+ if (email !== SELFHOSTED_EMAIL || password !== SELFHOSTED_PASSWORD) {+ return null+ }++ return generateSelfhostedUser()+ }+const user = await this.userService.findUser(email)if (user && (await this.comparePassword(password, user.password))) {@@ -423,7 +441,11 @@ export class AuthService {},)- await this.userService.saveRefreshToken(userId, refreshToken)+ if (isSelfhosted) {+ await saveRefreshTokenClickhouse(userId, refreshToken)+ } else {+ await this.userService.saveRefreshToken(userId, refreshToken)+ }return refreshToken}@@ -432,7 +454,15 @@ export class AuthService {userId: string,refreshToken: string,): Promise<boolean> {- const token = await this.userService.findRefreshToken(userId, refreshToken)+ let token: string | RefreshToken++ if (isSelfhosted) {+ const token2 = await findRefreshTokenClickhouse(userId, refreshToken)++ console.log(token2)+ }++ token = await this.userService.findRefreshToken(userId, refreshToken)return Boolean(token)}diff --git a/src/auth/guards/roles.guard.ts b/src/auth/guards/roles.guard.tsindex e00678ba8..2b6c535dd 100644--- a/src/auth/guards/roles.guard.ts+++ b/src/auth/guards/roles.guard.ts@@ -3,9 +3,10 @@ import { Reflector } from '@nestjs/core'import { ExtractJwt } from 'passport-jwt'import { verify } from 'jsonwebtoken'-import { UserType } from 'src/user/entities/user.entity'+import { UserType, generateSelfhostedUser } from 'src/user/entities/user.entity'import { UserService } from 'src/user/user.service'import { IS_TWO_FA_NOT_REQUIRED_KEY, ROLES_KEY } from '../decorators'+import { isSelfhosted } from 'src/common/constants'const ACCESS_TOKEN_SECRET = process.env.JWT_ACCESS_TOKEN_SECRET@@ -32,7 +33,9 @@ export class RolesGuard implements CanActivate {const request = context.switchToHttp().getRequest()const userFromRequest = request.user- const user = await this.userService.findUserById(userFromRequest.id)+ const user = isSelfhosted+ ? generateSelfhostedUser()+ : await this.userService.findUserById(userFromRequest.id)// this is a temp measure as well due to some fucking bug related to undefined user, will revert it when I find the causelet hasRole@@ -46,10 +49,6 @@ export class RolesGuard implements CanActivate {if (!hasRole) return false- if (isTwoFaNotRequired) {- return true- }-let token = ''if (request.cookies.token) {token = request.cookies.token@@ -58,6 +57,25 @@ export class RolesGuard implements CanActivate {token = extract(request)}+ if (isSelfhosted) {+ try {+ const decoded: any = verify(token, ACCESS_TOKEN_SECRET)++ // If the token is not decoded, it means it's invalid+ if (!decoded) {+ return false+ }+ } catch {+ return false+ }++ return true+ }++ if (isTwoFaNotRequired) {+ return true+ }+try {const decoded: any = verify(token, ACCESS_TOKEN_SECRET)diff --git a/src/auth/strategies/jwt-access-token.strategy.ts b/src/auth/strategies/jwt-access-token.strategy.tsindex eac802ec6..6205225a3 100644--- a/src/auth/strategies/jwt-access-token.strategy.ts+++ b/src/auth/strategies/jwt-access-token.strategy.ts@@ -2,6 +2,11 @@ import { Injectable, UnauthorizedException } from '@nestjs/common'import { ConfigService } from '@nestjs/config'import { PassportStrategy } from '@nestjs/passport'import { Strategy, ExtractJwt } from 'passport-jwt'++import {+ isSelfhosted, SELFHOSTED_UUID,+} from 'src/common/constants'+import { generateSelfhostedUser } from 'src/user/entities/user.entity'import { UserService } from 'src/user/user.service'import { IJwtPayload } from '../interfaces'@@ -22,8 +27,20 @@ export class JwtAccessTokenStrategy extends PassportStrategy(}public async validate(payload: IJwtPayload) {+ if (isSelfhosted) {+ if (payload.sub !== SELFHOSTED_UUID) {+ throw new UnauthorizedException()+ }++ return generateSelfhostedUser()+ }+const user = await this.userService.findUserById(payload.sub)- if (!user) throw new UnauthorizedException()++ if (!user) {+ throw new UnauthorizedException()+ }+return user}}diff --git a/src/common/guards/selfhosted.guard.ts b/src/common/guards/selfhosted.guard.tsindex 305e71573..b8fbcb851 100644--- a/src/common/guards/selfhosted.guard.ts+++ b/src/common/guards/selfhosted.guard.ts@@ -1,12 +1,12 @@-import { Injectable, CanActivate, ForbiddenException } from '@nestjs/common'+import { Injectable, CanActivate, NotImplementedException } from '@nestjs/common'import { isSelfhosted } from '../constants'@Injectable()export class SelfhostedGuard implements CanActivate {canActivate(): boolean {if (isSelfhosted) {- throw new ForbiddenException(- 'This API route is disabled in selfhosted edition',+ throw new NotImplementedException(+ 'This API route is disabled in the Swetrix Selfhosted edition',)}diff --git a/src/common/utils.ts b/src/common/utils.tsindex 23f9a0531..e3268f5b6 100644--- a/src/common/utils.ts+++ b/src/common/utils.ts@@ -22,6 +22,7 @@ import {DEFAULT_SELFHOSTED_UUID,SELFHOSTED_EMAIL,UUIDV5_NAMESPACE,+ isDevelopment,} from './constants'import { Project } from '../project/entity/project.entity'@@ -73,6 +74,10 @@ const checkRateLimit = async (reqAmount: number = RATE_LIMIT_REQUESTS_AMOUNT,reqTimeout: number = RATE_LIMIT_TIMEOUT,): Promise<void> => {+ if (isDevelopment) {+ return+ }+const rlHash = getRateLimitHash(ip, action)const rlCount: number = _toNumber(await redis.get(rlHash)) || 0@@ -198,6 +203,29 @@ const createProjectClickhouse = async (project: Project) => {return clickhouse.query(query, paramsData).toPromise()}+const saveRefreshTokenClickhouse = async (userId: string, refreshToken: string) => {+ const paramsData = {+ params: {+ userId,+ refreshToken,+ },+ }+ const query = 'INSERT INTO refresh_token (*) VALUES ({userId:String},{refreshToken:String})'++ return clickhouse.query(query, paramsData).toPromise()+}++const findRefreshTokenClickhouse = async (userId: string, refreshToken: string) => {+ const paramsData = {+ params: {+ userId,+ refreshToken,+ },+ }+ const query = 'SELECT * FROM refresh_token WHERE userId = {userId:String} AND refreshToken = {refreshToken:String}'+ return clickhouse.query(query, paramsData).toPromise()+}+const generateRecoveryCode = () =>randomstring.generate({length: 30,@@ -232,4 +260,6 @@ export {millisecondsToSeconds,generateRandomString,getSelfhostedUUID,+ saveRefreshTokenClickhouse,+ findRefreshTokenClickhouse,}diff --git a/src/project/project.controller.ts b/src/project/project.controller.tsindex 0973cc1e0..41df8902d 100644--- a/src/project/project.controller.ts+++ b/src/project/project.controller.ts@@ -105,7 +105,7 @@ export class ProjectController {private readonly logger: AppLoggerService,private readonly actionTokensService: ActionTokensService,private readonly mailerService: MailerService,- ) {}+ ) { }@Get('/')@ApiQuery({ name: 'take', required: false })@@ -127,7 +127,7 @@ export class ProjectController {const results = await getProjectsClickhouse()const formatted = _map(results, this.projectService.formatFromClickhouse)return {- results,+ results: formatted,page_total: _size(formatted),total: _size(formatted),totalMonthlyEvents: 0, // not needed as it's selfhosed@@ -186,6 +186,7 @@ export class ProjectController {@ApiQuery({ name: 'skip', required: false })@ApiQuery({ name: 'relatedonly', required: false, type: Boolean })@ApiResponse({ status: 200, type: [Project] })+ @UseGuards(SelfhostedGuard)@Auth([UserType.CUSTOMER, UserType.ADMIN], true)async getShared(@CurrentUserId() userId: string,@@ -194,23 +195,15 @@ export class ProjectController {): Promise<Pagination<ProjectShare> | ProjectShare[] | object> {this.logger.log({ userId, take, skip }, 'GET /project/shared')- if (isSelfhosted) {- throw new NotImplementedException(- 'This feature is not available on selfhosted yet',- )- } else {- const where = Object()- where.user = userId+ const where = Object()+ where.user = userId- const paginated = await this.projectService.paginateShared(- { take, skip },- where,- )+ const paginated = await this.projectService.paginateShared(+ { take, skip },+ where,+ )- return {- ...paginated,- }- }+ return paginated}@Get('/all')@@ -475,7 +468,7 @@ export class ProjectController {@Delete('/captcha/reset/:id')@HttpCode(204)- @UseGuards(JwtAccessTokenGuard, RolesGuard)+ @UseGuards(SelfhostedGuard, JwtAccessTokenGuard, RolesGuard)@Roles(UserType.CUSTOMER, UserType.ADMIN)@ApiResponse({ status: 204, description: 'Empty body' })async resetCAPTCHA(@@ -491,37 +484,27 @@ export class ProjectController {const query = `ALTER table captcha DELETE WHERE pid='${id}'`- if (isSelfhosted) {- try {- await clickhouse.query(query).toPromise()- return 'CAPTCHA project resetted successfully'- } catch (e) {- this.logger.error(e)- return 'Error while resetting your CAPTCHA project'- }- } else {- const user = await this.userService.findOne(uid)- const project = await this.projectService.findOneWhere(- { id },- {- relations: ['admin'],- select: ['id'],- },- )+ const user = await this.userService.findOne(uid)+ const project = await this.projectService.findOneWhere(+ { id },+ {+ relations: ['admin'],+ select: ['id'],+ },+ )- if (_isEmpty(project)) {- throw new NotFoundException(`Project with ID ${id} does not exist`)- }+ if (_isEmpty(project)) {+ throw new NotFoundException(`Project with ID ${id} does not exist`)+ }- this.projectService.allowedToManage(project, uid, user.roles)+ this.projectService.allowedToManage(project, uid, user.roles)- try {- await clickhouse.query(query).toPromise()- return 'CAPTCHA project resetted successfully'- } catch (e) {- this.logger.error(e)- return 'Error while resetting your CAPTCHA project'- }+ try {+ await clickhouse.query(query).toPromise()+ return 'CAPTCHA project resetted successfully'+ } catch (e) {+ this.logger.error(e)+ return 'Error while resetting your CAPTCHA project'}}@@ -582,7 +565,7 @@ export class ProjectController {@Delete('/captcha/:id')@HttpCode(204)- @UseGuards(JwtAccessTokenGuard, RolesGuard)+ @UseGuards(SelfhostedGuard, JwtAccessTokenGuard, RolesGuard)@Roles(UserType.CUSTOMER, UserType.ADMIN)@ApiResponse({ status: 204, description: 'Empty body' })async deleteCAPTCHA(@@ -597,40 +580,36 @@ export class ProjectController {)}- if (isSelfhosted) {- // TODO- } else {- const user = await this.userService.findOne(uid)- const project = await this.projectService.findOneWhere(- { id },- {- relations: ['admin'],- select: ['id'],- },- )+ const user = await this.userService.findOne(uid)+ const project = await this.projectService.findOneWhere(+ { id },+ {+ relations: ['admin'],+ select: ['id'],+ },+ )- if (_isEmpty(project)) {- throw new NotFoundException(`Project with ID ${id} does not exist`)- }+ if (_isEmpty(project)) {+ throw new NotFoundException(`Project with ID ${id} does not exist`)+ }- this.projectService.allowedToManage(project, uid, user.roles)+ this.projectService.allowedToManage(project, uid, user.roles)- const query = `ALTER table captcha DELETE WHERE pid='${id}'`+ const query = `ALTER table captcha DELETE WHERE pid='${id}'`- try {- await clickhouse.query(query).toPromise()+ try {+ await clickhouse.query(query).toPromise()- project.captchaSecretKey = null- project.isCaptchaEnabled = false- project.isCaptchaProject = false+ project.captchaSecretKey = null+ project.isCaptchaEnabled = false+ project.isCaptchaProject = false- await this.projectService.update(id, project)+ await this.projectService.update(id, project)- return 'CAPTCHA project deleted successfully'- } catch (e) {- this.logger.error(e)- return 'Error while deleting your CAPTCHA project'- }+ return 'CAPTCHA project deleted successfully'+ } catch (e) {+ this.logger.error(e)+ return 'Error while deleting your CAPTCHA project'}return null@@ -788,9 +767,8 @@ export class ProjectController {ActionTokenType.PROJECT_SHARE,share.id,)- const url = `${- isDevelopment ? headers.origin : PRODUCTION_ORIGIN- }/share/${actionToken.id}`+ const url = `${isDevelopment ? headers.origin : PRODUCTION_ORIGIN+ }/share/${actionToken.id}`await this.mailerService.sendEmail(invitee.email,LetterTemplate.ProjectInvitation,@@ -1190,7 +1168,6 @@ export class ProjectController {}if (isSelfhosted) {- // todo: delete share for selfhostedawait deleteProjectClickhouse(id)const query1 = `ALTER table analytics DELETE WHERE pid='${id}'`diff --git a/src/project/project.service.ts b/src/project/project.service.tsindex e64094b20..e231f147c 100644--- a/src/project/project.service.ts+++ b/src/project/project.service.ts@@ -375,13 +375,10 @@ export class ProjectService {])}- formatToClickhouse(project: Project): object {+ formatToClickhouse(project: any): object {const updProject = { ...project }- // @ts-ignoreupdProject.active = Number(updProject.active)- // @ts-ignoreupdProject.public = Number(updProject.public)- // @ts-ignoreupdProject.origins = _isString(updProject.origins)? updProject.origins: _join(updProject.origins, ',')@@ -389,11 +386,9 @@ export class ProjectService {return updProject}- formatFromClickhouse(project: object): object {+ formatFromClickhouse(project: any): object {const updProject = { ...project }- // @ts-ignoreupdProject.active = Boolean(updProject.active)- // @ts-ignoreupdProject.public = Boolean(updProject.public)return updProjectdiff --git a/src/user/entities/user.entity.ts b/src/user/entities/user.entity.tsindex a36d5075b..8c46c941f 100644--- a/src/user/entities/user.entity.ts+++ b/src/user/entities/user.entity.ts@@ -14,6 +14,9 @@ import { ExtensionToUser } from '../../marketplace/extensions/entities/extensionimport { Comment } from '../../marketplace/comments/entities/comment.entity'import { Complaint } from '../../marketplace/complaints/entities/complaint.entity'import { RefreshToken } from './refresh-token.entity'+import {+ SELFHOSTED_EMAIL, SELFHOSTED_UUID,+} from '../../common/constants'export enum PlanCode {none = 'none',@@ -132,6 +135,24 @@ export const DEFAULT_TIMEZONE = 'Etc/GMT'export const TRIAL_DURATION = 14 // days+export interface SelfhostedUser {+ id: string+ email: string+ isTwoFactorAuthenticationEnabled: boolean+ planCode: PlanCode+ roles: UserType[]+ isActive: boolean+}++export const generateSelfhostedUser = (): SelfhostedUser => ({+ id: SELFHOSTED_UUID,+ email: SELFHOSTED_EMAIL,+ isTwoFactorAuthenticationEnabled: false,+ planCode: PlanCode.enterprise,+ roles: [UserType.ADMIN, UserType.CUSTOMER],+ isActive: true,+})+@Entity()export class User {@PrimaryGeneratedColumn('uuid')diff --git a/src/user/user.controller.ts b/src/user/user.controller.tsindex 096391771..b39b9489d 100644--- a/src/user/user.controller.ts+++ b/src/user/user.controller.ts@@ -40,6 +40,7 @@ import {MAX_EMAIL_REQUESTS,PlanCode,Theme,+ generateSelfhostedUser,} from './entities/user.entity'import { Roles } from '../auth/decorators/roles.decorator'import { Pagination } from '../common/pagination/pagination'@@ -47,8 +48,6 @@ import {GDPR_EXPORT_TIMEFRAME,clickhouse,isSelfhosted,- SELFHOSTED_UUID,- SELFHOSTED_EMAIL,isDevelopment,PRODUCTION_ORIGIN,} from '../common/constants'@@ -94,10 +93,7 @@ export class UserController {let userif (isSelfhosted) {- user = {- id: SELFHOSTED_UUID,- email: SELFHOSTED_EMAIL,- }+ user = generateSelfhostedUser()} else {const sharedProjects = await this.projectService.findShare({where: {