Skip to content

Conversation

erikjohnston
Copy link
Member

You can now configure how much media can be uploaded by a user in a given time period.

Note the first commit here is a refactor of create/upload content function

This deduplicates a bunch of logic.
You can now configure how much media can be uploaded by a user in a
given time period.
@erikjohnston erikjohnston force-pushed the erikj/ratelimit_media_upload branch from 50bc915 to c064548 Compare June 9, 2025 09:52
@github-actions github-actions bot deployed to PR Documentation Preview June 9, 2025 10:14 Active
@erikjohnston erikjohnston marked this pull request as ready for review June 9, 2025 10:39
@erikjohnston erikjohnston requested a review from a team as a code owner June 9, 2025 10:39
Copy link
Member

@sandhose sandhose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Do we expect to introduce per-user overrides later on?

Comment on lines +1053 to +1055
SELECT COALESCE(SUM(media_length), 0)
FROM local_media_repository
WHERE user_id = ? AND created_ts > ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hits the users_have_local_media index which was introduced 5 years ago, verified on m.org that it should be performant

@erikjohnston
Copy link
Member Author

LGTM. Do we expect to introduce per-user overrides later on?

Oooh, good question. I think we can later add a manual check against the per user override table in the DB if needed easily enough

@github-actions github-actions bot deployed to PR Documentation Preview July 10, 2025 11:05 Active
@erikjohnston erikjohnston merged commit 66daf0b into develop Jul 10, 2025
47 checks passed
@erikjohnston erikjohnston deleted the erikj/ratelimit_media_upload branch July 10, 2025 12:39
@erikjohnston erikjohnston restored the erikj/ratelimit_media_upload branch July 10, 2025 12:41
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Aug 7, 2025
Tested on NetBSD 9 amd64 (federation, multiple clients)

# Synapse 1.135.0 (2025-08-01)

## Features

- Add `recaptcha_private_key_path` and `recaptcha_public_key_path` config option. ([\#17984](element-hq/synapse#17984), [\#18684](element-hq/synapse#18684))
- Add plain-text handling for rich-text topics as per [MSC3765](matrix-org/matrix-spec-proposals#3765). ([\#18195](element-hq/synapse#18195))
- If enabled by the user, server admins will see [soft failed](https://spec.matrix.org/v1.13/server-server-api/#soft-failure) events over the Client-Server API. ([\#18238](element-hq/synapse#18238))
- Add experimental support for [MSC4277: Harmonizing the reporting endpoints](matrix-org/matrix-spec-proposals#4277). ([\#18263](element-hq/synapse#18263))
- Add ability to limit amount of media uploaded by a user in a given time period. ([\#18527](element-hq/synapse#18527))
- Enable workers to write directly to the device lists stream and handle device list updates, reducing load on the main process. ([\#18581](element-hq/synapse#18581))
- Support arbitrary profile fields. Contributed by @clokep. ([\#18635](element-hq/synapse#18635))
- Advertise support for Matrix v1.12. ([\#18647](element-hq/synapse#18647))
- Add an option to issue redactions as an admin user via the [admin redaction endpoint](https://element-hq.github.io/synapse/latest/admin_api/user_admin_api.html#redact-all-the-events-of-a-user). ([\#18671](element-hq/synapse#18671))
- Add experimental and incomplete support for [MSC4306: Thread Subscriptions](https://github.com/matrix-org/matrix-spec-proposals/blob/rei/msc_thread_subscriptions/proposals/4306-thread-subscriptions.md). ([\#18674](element-hq/synapse#18674))
- Include `event_id` when getting state with `?format=event`. Contributed by @tulir @ Beeper. ([\#18675](element-hq/synapse#18675))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants