From b85513496c3ad6c9293c56f03d7d6eb94e6ac123 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 27 Dec 2024 13:18:22 -0600 Subject: [PATCH] Ratelimit follow and unfollow --- src/app.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/app.ts b/src/app.ts index b8cd7a83..c9d51441 100644 --- a/src/app.ts +++ b/src/app.ts @@ -227,8 +227,18 @@ app.post('/api/v1/accounts/:pubkey{[0-9a-f]{64}}/block', requireSigner, blockCon app.post('/api/v1/accounts/:pubkey{[0-9a-f]{64}}/unblock', requireSigner, unblockController); app.post('/api/v1/accounts/:pubkey{[0-9a-f]{64}}/mute', requireSigner, muteController); app.post('/api/v1/accounts/:pubkey{[0-9a-f]{64}}/unmute', requireSigner, unmuteController); -app.post('/api/v1/accounts/:pubkey{[0-9a-f]{64}}/follow', requireSigner, followController); -app.post('/api/v1/accounts/:pubkey{[0-9a-f]{64}}/unfollow', requireSigner, unfollowController); +app.post( + '/api/v1/accounts/:pubkey{[0-9a-f]{64}}/follow', + rateLimitMiddleware(2, Time.seconds(1)), + requireSigner, + followController, +); +app.post( + '/api/v1/accounts/:pubkey{[0-9a-f]{64}}/unfollow', + rateLimitMiddleware(2, Time.seconds(1)), + requireSigner, + unfollowController, +); app.get( '/api/v1/accounts/:pubkey{[0-9a-f]{64}}/followers', rateLimitMiddleware(8, Time.seconds(30)),