mirror of
https://github.com/docmost/docmost.git
synced 2025-11-21 08:01:09 +10:00
Merge remote-tracking branch 'refs/remotes/origin/main'
This commit is contained in:
@ -16,6 +16,7 @@ import { HistoryListener } from './listeners/history.listener';
|
|||||||
PersistenceExtension,
|
PersistenceExtension,
|
||||||
HistoryListener,
|
HistoryListener,
|
||||||
],
|
],
|
||||||
|
exports: [CollaborationGateway],
|
||||||
imports: [TokenModule],
|
imports: [TokenModule],
|
||||||
})
|
})
|
||||||
export class CollaborationModule implements OnModuleInit, OnModuleDestroy {
|
export class CollaborationModule implements OnModuleInit, OnModuleDestroy {
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { DatabaseModule } from '@docmost/db/database.module';
|
|||||||
import { QueueModule } from '../../integrations/queue/queue.module';
|
import { QueueModule } from '../../integrations/queue/queue.module';
|
||||||
import { EventEmitterModule } from '@nestjs/event-emitter';
|
import { EventEmitterModule } from '@nestjs/event-emitter';
|
||||||
import { HealthModule } from '../../integrations/health/health.module';
|
import { HealthModule } from '../../integrations/health/health.module';
|
||||||
|
import { CollaborationController } from './collaboration.controller';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@ -17,7 +18,12 @@ import { HealthModule } from '../../integrations/health/health.module';
|
|||||||
HealthModule,
|
HealthModule,
|
||||||
EventEmitterModule.forRoot(),
|
EventEmitterModule.forRoot(),
|
||||||
],
|
],
|
||||||
controllers: [AppController],
|
controllers: [
|
||||||
|
AppController,
|
||||||
|
...(process.env.COLLAB_SHOW_STATS.toLowerCase() === 'true'
|
||||||
|
? [CollaborationController]
|
||||||
|
: []),
|
||||||
|
],
|
||||||
providers: [AppService],
|
providers: [AppService],
|
||||||
})
|
})
|
||||||
export class CollabAppAppModule {}
|
export class CollabAppModule {}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { NestFactory } from '@nestjs/core';
|
import { NestFactory } from '@nestjs/core';
|
||||||
import { CollabAppAppModule } from './collab-app.module';
|
import { CollabAppModule } from './collab-app.module';
|
||||||
import {
|
import {
|
||||||
FastifyAdapter,
|
FastifyAdapter,
|
||||||
NestFastifyApplication,
|
NestFastifyApplication,
|
||||||
@ -10,7 +10,7 @@ import { Logger } from '@nestjs/common';
|
|||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create<NestFastifyApplication>(
|
const app = await NestFactory.create<NestFastifyApplication>(
|
||||||
CollabAppAppModule,
|
CollabAppModule,
|
||||||
new FastifyAdapter({
|
new FastifyAdapter({
|
||||||
ignoreTrailingSlash: true,
|
ignoreTrailingSlash: true,
|
||||||
ignoreDuplicateSlashes: true,
|
ignoreDuplicateSlashes: true,
|
||||||
|
|||||||
@ -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(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user