use bucket rate limit for posts and chat messages
This commit is contained in:
parent
ed68230811
commit
591c6d603f
4 changed files with 21 additions and 10 deletions
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue