Merge remote-tracking branch 'refs/remotes/origin/main'

This commit is contained in:
Philipinho 2025-02-26 13:14:45 +00:00
commit 81b6c7ef69
4 changed files with 26 additions and 4 deletions

View File

@ -16,6 +16,7 @@ import { HistoryListener } from './listeners/history.listener';
PersistenceExtension,
HistoryListener,
],
exports: [CollaborationGateway],
imports: [TokenModule],
})
export class CollaborationModule implements OnModuleInit, OnModuleDestroy {

View File

@ -7,6 +7,7 @@ import { DatabaseModule } from '@docmost/db/database.module';
import { QueueModule } from '../../integrations/queue/queue.module';
import { EventEmitterModule } from '@nestjs/event-emitter';
import { HealthModule } from '../../integrations/health/health.module';
import { CollaborationController } from './collaboration.controller';
@Module({
imports: [
@ -17,7 +18,12 @@ import { HealthModule } from '../../integrations/health/health.module';
HealthModule,
EventEmitterModule.forRoot(),
],
controllers: [AppController],
controllers: [
AppController,
...(process.env.COLLAB_SHOW_STATS.toLowerCase() === 'true'
? [CollaborationController]
: []),
],
providers: [AppService],
})
export class CollabAppAppModule {}
export class CollabAppModule {}

View File

@ -1,5 +1,5 @@
import { NestFactory } from '@nestjs/core';
import { CollabAppAppModule } from './collab-app.module';
import { CollabAppModule } from './collab-app.module';
import {
FastifyAdapter,
NestFastifyApplication,
@ -10,7 +10,7 @@ import { Logger } from '@nestjs/common';
async function bootstrap() {
const app = await NestFactory.create<NestFastifyApplication>(
CollabAppAppModule,
CollabAppModule,
new FastifyAdapter({
ignoreTrailingSlash: true,
ignoreDuplicateSlashes: true,

View File

@ -0,0 +1,15 @@
import { Controller, Get } from '@nestjs/common';
import { CollaborationGateway } from '../collaboration.gateway';
@Controller('collab')
export class CollaborationController {
constructor(private readonly collaborationGateway: CollaborationGateway) {}
@Get('stats')
async getStats() {
return {
connections: this.collaborationGateway.getConnectionCount(),
documents: this.collaborationGateway.getDocumentCount(),
};
}
}