diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2024-11-22 13:43:06 -0500 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2024-11-22 15:19:24 -0500 |
| commit | e3b826db5a2dd86c15b3c5f5bdfbd7fec8d781ad (patch) | |
| tree | cce9170107529b3d2880c69dc010130d35c87388 /packages/backend/src/server/api/endpoints/notes/renotes.ts | |
| parent | merge: Fix `.punyHost` misuse (!765) (diff) | |
| download | sharkey-e3b826db5a2dd86c15b3c5f5bdfbd7fec8d781ad.tar.gz sharkey-e3b826db5a2dd86c15b3c5f5bdfbd7fec8d781ad.tar.bz2 sharkey-e3b826db5a2dd86c15b3c5f5bdfbd7fec8d781ad.zip | |
add rate limits to all public endpoints
Diffstat (limited to 'packages/backend/src/server/api/endpoints/notes/renotes.ts')
| -rw-r--r-- | packages/backend/src/server/api/endpoints/notes/renotes.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/backend/src/server/api/endpoints/notes/renotes.ts b/packages/backend/src/server/api/endpoints/notes/renotes.ts index a88c286f64..15f114266a 100644 --- a/packages/backend/src/server/api/endpoints/notes/renotes.ts +++ b/packages/backend/src/server/api/endpoints/notes/renotes.ts @@ -34,6 +34,13 @@ export const meta = { id: '12908022-2e21-46cd-ba6a-3edaf6093f46', }, }, + + // 100 calls per 10 seconds. + // This is high because the frontend calls this in a tight loop while loading timelines. + limit: { + duration: 1000 * 10, + max: 100, + }, } as const; export const paramDef = { @@ -72,7 +79,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint- .leftJoinAndSelect('note.renote', 'renote') .leftJoinAndSelect('reply.user', 'replyUser') .leftJoinAndSelect('renote.user', 'renoteUser'); - + if (ps.userId) { query.andWhere("user.id = :userId", { userId: ps.userId }); } |