add rate limits to all public endpoints

This commit is contained in:
Hazelnoot 2024-11-22 13:43:06 -05:00
parent a38d8a91a1
commit e3b826db5a
243 changed files with 2908 additions and 9 deletions

View file

@ -38,6 +38,12 @@ export const meta = {
id: 'c118ece3-2e4b-4296-99d1-51756e32d232',
},
},
// 10 calls per 5 seconds
limit: {
duration: 1000 * 5,
max: 10,
},
} as const;
export const paramDef = {

View file

@ -21,6 +21,12 @@ export const meta = {
type: 'boolean',
optional: false, nullable: false,
},
// 10 calls per 5 seconds
limit: {
duration: 1000 * 5,
max: 10,
},
} as const;
export const paramDef = {

View file

@ -11,6 +11,7 @@ import { GlobalEventService } from '@/core/GlobalEventService.js';
import { DI } from '@/di-symbols.js';
import { RoleService } from '@/core/RoleService.js';
import { ApiError } from '../../../error.js';
import ms from 'ms';
export const meta = {
tags: ['drive'],
@ -34,6 +35,12 @@ export const meta = {
id: '5eb8d909-2540-4970-90b8-dd6f86088121',
},
},
// 100 calls per minute
limit: {
duration: 1000 * 60,
max: 100,
},
} as const;
export const paramDef = {

View file

@ -27,6 +27,12 @@ export const meta = {
ref: 'DriveFile',
},
},
// 2 calls per second
limit: {
duration: 1000,
max: 2,
},
} as const;
export const paramDef = {

View file

@ -28,6 +28,12 @@ export const meta = {
ref: 'DriveFile',
},
},
// 2 calls per second
limit: {
duration: 1000,
max: 2,
},
} as const;
export const paramDef = {

View file

@ -40,6 +40,12 @@ export const meta = {
id: '25b73c73-68b1-41d0-bad1-381cfdf6579f',
},
},
// 10 calls per 5 seconds
limit: {
duration: 1000 * 5,
max: 10,
},
} as const;
export const paramDef = {

View file

@ -11,6 +11,7 @@ import { RoleService } from '@/core/RoleService.js';
import { DriveService } from '@/core/DriveService.js';
import type { Config } from '@/config.js';
import { ApiError } from '../../../error.js';
import ms from 'ms';
export const meta = {
tags: ['drive'],
@ -63,6 +64,12 @@ export const meta = {
optional: false, nullable: false,
ref: 'DriveFile',
},
// 100 calls per minute
limit: {
duration: 1000 * 60,
max: 100,
},
} as const;
export const paramDef = {