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 Oct 26, 2023
1 parent 152442f commit 045b4e1
Show file tree
Hide file tree
Showing 2 changed files with 20 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 @@ -1746,6 +1746,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
7 changes: 7 additions & 0 deletions synapse/config/ratelimiting.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,10 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
"rc_third_party_invite",
defaults={"per_second": 0.0025, "burst_count": 5},
)

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

0 comments on commit 045b4e1

Please sign in to comment.