diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2024-12-08 13:07:55 -0500 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2024-12-08 13:22:07 -0500 |
| commit | 2946f85592022f5aaa490d3f40d6e3068957d33f (patch) | |
| tree | 38a92dcc2c211d14c43b0afafc27346510e42a05 /packages/backend/src/server/FileServerService.ts | |
| parent | fix rate limit scaling (it's no longer inverted) (diff) | |
| download | sharkey-2946f85592022f5aaa490d3f40d6e3068957d33f.tar.gz sharkey-2946f85592022f5aaa490d3f40d6e3068957d33f.tar.bz2 sharkey-2946f85592022f5aaa490d3f40d6e3068957d33f.zip | |
fix type errors from new rate limit definitions
Diffstat (limited to 'packages/backend/src/server/FileServerService.ts')
| -rw-r--r-- | packages/backend/src/server/FileServerService.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/backend/src/server/FileServerService.ts b/packages/backend/src/server/FileServerService.ts index 3a03cd8c00..5293d529ad 100644 --- a/packages/backend/src/server/FileServerService.ts +++ b/packages/backend/src/server/FileServerService.ts @@ -32,7 +32,7 @@ import { getIpHash } from '@/misc/get-ip-hash.js'; import { AuthenticateService } from '@/server/api/AuthenticateService.js'; import { RoleService } from '@/core/RoleService.js'; import { SkRateLimiterService } from '@/server/api/SkRateLimiterService.js'; -import { RateLimit, sendRateLimitHeaders } from '@/misc/rate-limit-utils.js'; +import { Keyed, RateLimit, sendRateLimitHeaders } from '@/misc/rate-limit-utils.js'; import type { FastifyInstance, FastifyRequest, FastifyReply, FastifyPluginOptions } from 'fastify'; const _filename = fileURLToPath(import.meta.url); @@ -633,7 +633,7 @@ export class FileServerService { } private async checkResourceLimit(reply: FastifyReply, actor: string, group: string, resource: string, factor = 1): Promise<boolean> { - const limit: RateLimit = { + const limit: Keyed<RateLimit> = { // Group by resource key: `${group}${resource}`, type: 'bucket', @@ -647,7 +647,7 @@ export class FileServerService { } private async checkSharedLimit(reply: FastifyReply, actor: string, group: string, factor = 1): Promise<boolean> { - const limit: RateLimit = { + const limit: Keyed<RateLimit> = { key: group, type: 'bucket', @@ -658,7 +658,7 @@ export class FileServerService { return await this.checkLimit(reply, actor, limit, factor); } - private async checkLimit(reply: FastifyReply, actor: string, limit: RateLimit, factor = 1): Promise<boolean> { + private async checkLimit(reply: FastifyReply, actor: string, limit: Keyed<RateLimit>, factor = 1): Promise<boolean> { const info = await this.rateLimiterService.limit(limit, actor, factor); sendRateLimitHeaders(reply, info); |