use bucket rate limit for posts and chat messages

This commit is contained in:
Hazelnoot 2025-07-26 19:10:22 -04:00
parent ed68230811
commit 591c6d603f
4 changed files with 21 additions and 10 deletions

View file

@ -21,9 +21,11 @@ export const meta = {
kind: 'write:chat',
// Up to 10 message burst, then 2/second
limit: {
duration: ms('1hour'),
max: 500,
type: 'bucket',
size: 10,
dripRate: 500,
},
res: {

View file

@ -21,9 +21,11 @@ export const meta = {
kind: 'write:chat',
// Up to 10 message burst, then 2/second
limit: {
duration: ms('1hour'),
max: 500,
type: 'bucket',
size: 10,
dripRate: 500,
},
res: {

View file

@ -27,10 +27,11 @@ export const meta = {
prohibitMoved: true,
// Up to 10 post burst, then 4/second
limit: {
duration: ms('1hour'),
max: 300,
minInterval: ms('1sec'),
type: 'bucket',
size: 10,
dripRate: 250,
},
kind: 'write:notes',

View file

@ -1,4 +1,8 @@
import ms from 'ms';
/*
* SPDX-FileCopyrightText: marie and other Sharkey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { In } from 'typeorm';
import { Inject, Injectable } from '@nestjs/common';
import type { MiUser } from '@/models/User.js';
@ -22,9 +26,11 @@ export const meta = {
prohibitMoved: true,
// Up to 10 post burst, then 2/second
limit: {
duration: ms('1hour'),
max: 300,
type: 'bucket',
size: 10,
dripRate: 500,
},
kind: 'write:notes',