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

@ -26,6 +26,12 @@ export const meta = {
id: '4938f5f3-6167-4c04-9149-6607b7542861',
},
},
// 3 calls per second
limit: {
duration: 1000,
max: 3,
},
} as const;
export const paramDef = {

View file

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

View file

@ -26,6 +26,12 @@ export const meta = {
id: 'c0031718-d573-4e85-928e-10039f1fbb68',
},
},
// 3 calls per second
limit: {
duration: 1000,
max: 3,
},
} as const;
export const paramDef = {

View file

@ -26,6 +26,12 @@ export const meta = {
ref: 'Channel',
},
},
// 10 calls per 5 seconds
limit: {
duration: 1000 * 5,
max: 10,
},
} as const;
export const paramDef = {

View file

@ -25,6 +25,12 @@ export const meta = {
ref: 'Channel',
},
},
// 10 calls per 5 seconds
limit: {
duration: 1000 * 5,
max: 10,
},
} as const;
export const paramDef = {

View file

@ -26,6 +26,12 @@ export const meta = {
ref: 'Channel',
},
},
// 10 calls per 5 seconds
limit: {
duration: 1000 * 5,
max: 10,
},
} as const;
export const paramDef = {

View file

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

View file

@ -28,6 +28,12 @@ export const meta = {
id: '6f6c314b-7486-4897-8966-c04a66a02923',
},
},
// 10 calls per 5 seconds
limit: {
duration: 1000 * 5,
max: 10,
},
} as const;
export const paramDef = {

View file

@ -38,6 +38,12 @@ export const meta = {
id: '4d0eeeba-a02c-4c3c-9966-ef60d38d2e7f',
},
},
// 10 calls per 5 seconds
limit: {
duration: 1000 * 5,
max: 10,
},
} as const;
export const paramDef = {

View file

@ -25,6 +25,12 @@ export const meta = {
id: '353c68dd-131a-476c-aa99-88a345e83668',
},
},
// 3 calls per second
limit: {
duration: 1000,
max: 3,
},
} as const;
export const paramDef = {

View file

@ -26,6 +26,12 @@ export const meta = {
id: '19959ee9-0153-4c51-bbd9-a98c49dc59d6',
},
},
// 3 calls per second
limit: {
duration: 1000,
max: 3,
},
} as const;
export const paramDef = {

View file

@ -10,6 +10,7 @@ import { ChannelEntityService } from '@/core/entities/ChannelEntityService.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: ['channels'],
@ -43,6 +44,11 @@ export const meta = {
id: 'e86c14a4-0da2-4032-8df3-e737a04c7f3b',
},
},
limit: {
duration: ms('1hour'),
max: 10,
},
} as const;
export const paramDef = {