Tracking issue: Rewrite of media service #1990

Open
opened 2026-07-14 22:24:31 +00:00 by s1lv3r · 1 comment
Member

Tracking issue for me to document progress until i get a PR opened with some actual code.

Background

The media service is currently a smoking mess, almost unreadable, and full of legacy code. I intend to rewrite the entire service to make it more readable and coherent, and to support modular storage backends through the use of a single trait that backends can implement.

Discussions started as me wanting to implement S3 support (#93; matrix.to), something i quickly abandoned (was told wasnt actually important, and the issue was closed). Decided to rewrite the media stack anyways (matrix.to), as it is hot garbage.

Rough outline of tasks

  • Create trait for storage repositories
  • Implement filesystem storage repository
  • Change how files are stored and how they use the DB
    • Currently stores all the data about the file in the key for whatever reason, leaving the value empty. Should be changed
  • Create migrations for files from old to new DB keys
  • Implement dedup? Should be easy enough with a sha256-sum for uploaded files, pointing different MXC-uris to the same files based on that sha-sum.
  • Testing
    • Automated testing? Unit tests? Will need to investigate ways to test different parts of the code.
Tracking issue for me to document progress until i get a PR opened with some actual code. ### Background The media service is currently a smoking mess, almost unreadable, and full of legacy code. I intend to rewrite the entire service to make it more readable and coherent, and to support modular storage backends through the use of a single trait that backends can implement. Discussions started as me wanting to implement S3 support (#93; [matrix.to](https://matrix.to/#/!ksTlboXVgcyWjv5GrlEeKyQuJ8ZCprnwQx2b6-BQ44Q/%24_yyG4ynnJ0JBX93OR76O-pL_6cj2IfnYVpg87yv3E1I?via=wolfgirl.pet&via=explodie.org&via=matrix.org)), something i quickly abandoned (was told wasnt actually important, and the issue was closed). Decided to rewrite the media stack anyways ([matrix.to](https://matrix.to/#/!ksTlboXVgcyWjv5GrlEeKyQuJ8ZCprnwQx2b6-BQ44Q/%24PDtOPr_L1csuGrv3QRjv4tNHOtG6b-lfOoFYQBoSZEY?via=wolfgirl.pet&via=explodie.org&via=matrix.org)), as it is hot garbage. ### Rough outline of tasks - [x] Create trait for storage repositories - [ ] Implement filesystem storage repository - [ ] Change how files are stored and how they use the DB - Currently stores all the data about the file in the key for whatever reason, leaving the value empty. Should be changed - [ ] Create migrations for files from old to new DB keys - [ ] Implement dedup? Should be easy enough with a sha256-sum for uploaded files, pointing different MXC-uris to the same files based on that sha-sum. - [ ] Testing - Automated testing? Unit tests? Will need to investigate ways to test different parts of the code.
s1lv3r changed title from Rewrite media service to Tracking issue: Rewrite of media service 2026-07-14 22:24:46 +00:00
Author
Member

Decided to nuke media_compat_file_link. No more ability to downgrade to Conduit.


Context:

me: Question: At the moment we have the media_compat_file_link option for possible backwards-compatability with Conduit (i.e. moving back to Conduit) -- is this still something we wish to keep? It would make my life a LOT easier if I could just drop that option completely and not allow old filenames and file links
Ginger: kill it

Decided to nuke `media_compat_file_link`. No more ability to downgrade to Conduit. --- Context: > **[me](https://matrix.to/#/!ksTlboXVgcyWjv5GrlEeKyQuJ8ZCprnwQx2b6-BQ44Q/%24tjadZ8AA21lnkaAW_A5bFTgNqIBae7TF0TZuP_xq3AU?via=wolfgirl.pet&via=explodie.org&via=matrix.org):** Question: At the moment we have the `media_compat_file_link` option for possible backwards-compatability with Conduit (i.e. moving _back_ to Conduit) -- is this still something we wish to keep? It would make my life a LOT easier if I could just drop that option completely and not allow old filenames and file links > **[Ginger](https://matrix.to/#/!ksTlboXVgcyWjv5GrlEeKyQuJ8ZCprnwQx2b6-BQ44Q/%24AHK6aiq3IHT0wyIfkRcNfdObhX3MJR6fT7-cmNhoIf8?via=wolfgirl.pet&via=explodie.org&via=matrix.org):** kill it ✅
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
continuwuation/continuwuity#1990
No description provided.