diff --git a/server/src/app.module.ts b/server/src/app.module.ts index 1f71792..59b5160 100644 --- a/server/src/app.module.ts +++ b/server/src/app.module.ts @@ -31,7 +31,7 @@ import { SessionModule } from './session/session.module'; ThrottlerModule.forRoot([ { ttl: 60000, - limit: 5, + limit: 1000, }, ]), TypeOrmModule.forRoot({ diff --git a/server/src/client/client.controller.ts b/server/src/client/client.controller.ts index 6ac04a9..8b66a04 100644 --- a/server/src/client/client.controller.ts +++ b/server/src/client/client.controller.ts @@ -10,6 +10,7 @@ import { Query, Logger, } from '@nestjs/common'; +import { Throttle } from '@nestjs/throttler'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; import type { Response, Request } from 'express'; @@ -34,6 +35,7 @@ export class ClientController { ) {} @Public() + @Throttle({ default: { limit: 300, ttl: 60000 } }) @Get('bus/:uuid') async getSubscription( @Param('uuid') uuid: string, @@ -92,6 +94,7 @@ export class ClientController { } @Public() + @Throttle({ default: { limit: 300, ttl: 60000 } }) @Get('bus/:uuid/:tunnelId') async getRelaySubscription( @Param('uuid') uuid: string, diff --git a/server/test/app/app.config.spec.ts b/server/test/app/app.config.spec.ts index 3ac2aed..2c5451e 100644 --- a/server/test/app/app.config.spec.ts +++ b/server/test/app/app.config.spec.ts @@ -28,7 +28,7 @@ describe('AppModule конфигурация', () => { delete process.env.JWT_SECRET; }); - it('должен регистрировать ThrottlerModule с лимитом 5/60000ms', () => { + it('должен регистрировать ThrottlerModule с лимитом 1000/60000ms (лояльный API)', () => { const imports = (Reflect.getMetadata(MODULE_METADATA.IMPORTS, AppModule) ?? []) as DynamicModuleLike[]; const throttlerDynamicModule = imports.find( @@ -43,7 +43,7 @@ describe('AppModule конфигурация', () => { expect(throttlerOptionsProvider?.useValue).toEqual( expect.arrayContaining([ expect.objectContaining({ - limit: 5, + limit: 1000, ttl: 60000, }), ]),