Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
config: add option to rate limit media creation
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Jun 9, 2023
1 parent 61e6374 commit 1dec8af
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/usage/configuration/config_documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,19 @@ rc_third_party_invite:
burst_count: 10
```
---
### `rc_media_create`

This option ratelimits creation of MXC URIs via the `/_matrix/media/v1/create`
endpoint based on the account that's creating the media. Defaults to
`per_second: 10`, `burst_count: 50`.

Example configuration:
```yaml
rc_media_create:
per_second: 10
burst_count: 50
```
---
### `rc_federation`

Defines limits on federation requests.
Expand Down
6 changes: 6 additions & 0 deletions synapse/config/ratelimiting.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,9 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
config.get("rc_third_party_invite", {}),
defaults={"per_second": 0.0025, "burst_count": 5},
)

# Ratelimit create media requests:
self.rc_media_create = RatelimitSettings(
config.get("rc_media_create", {}),
defaults={"per_second": 10, "burst_count": 50},
)

0 comments on commit 1dec8af

Please sign in to comment.