feat: Add support for MSC4322

This commit is contained in:
Ginger committed 2026-12-03 09:27:52 -05:00
1 parent 8fb898c84d
commit 2a611fbd49
7 files changed
+114 -19

No files matched your search

+22 -1
View File
@@ -18,7 +18,7 @@ use ruma::{
get_content, get_content_as_filename, get_content_thumbnail, get_media_config,
get_media_preview,
},
media::create_content,
media::{self, create_content},
},
};
use service::media::mxc::Mxc;
@@ -240,6 +240,27 @@ pub(crate) async fn get_media_preview_route(
})
}
/// # `POST /_matrix/client/unstable/uk.timedout.msc4322/media/redact/{server_name}/{media_id}`
pub(crate) async fn unstable_redact_media_route(
State(services): State<crate::State>,
body: Ruma<media::redact::msc4322::Request>,
) -> Result<media::redact::msc4322::Response> {
let user = body.identity.expect_sender_user()?;
let mxc = Mxc {
server_name: &body.server_name,
media_id: &body.media_id,
};
if !(services.media.user_owns(user, &mxc).await || services.admin.user_is_admin(user).await) {
return Err!(Request(Forbidden("You cannot redact this media.")));
}
services.media.redact(&mxc).await?;
Ok(media::redact::msc4322::Response::new())
}
async fn fetch_thumbnail_meta(
services: &Services,
mxc: &Mxc<'_>,