1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-08-01 17:38:36 +00:00

feat(media): blocking

This commit is contained in:
Matthias Ahouansou 2025-03-31 00:39:19 +01:00
parent d76637048a
commit 594fe5f98f
No known key found for this signature in database
9 changed files with 738 additions and 19 deletions

View file

@ -199,6 +199,8 @@ async fn get_content(
allow_remote: bool,
authenticated: bool,
) -> Result<get_content::v1::Response, Error> {
services().media.check_blocked(server_name, &media_id)?;
if let Ok(Some(FileMeta {
content_disposition,
content_type,
@ -278,6 +280,8 @@ async fn get_content_as_filename(
allow_remote: bool,
authenticated: bool,
) -> Result<get_content_as_filename::v1::Response, Error> {
services().media.check_blocked(server_name, &media_id)?;
if let Ok(Some(FileMeta {
file, content_type, ..
})) = services()
@ -371,6 +375,8 @@ async fn get_content_thumbnail(
allow_remote: bool,
authenticated: bool,
) -> Result<get_content_thumbnail::v1::Response, Error> {
services().media.check_blocked(server_name, &media_id)?;
if let Some(FileMeta {
file,
content_type,

View file

@ -2221,6 +2221,10 @@ pub async fn create_invite_route(
pub async fn get_content_route(
body: Ruma<get_content::v1::Request>,
) -> Result<get_content::v1::Response> {
services()
.media
.check_blocked(services().globals.server_name(), &body.media_id)?;
if let Some(FileMeta {
content_disposition,
content_type,
@ -2249,6 +2253,10 @@ pub async fn get_content_route(
pub async fn get_content_thumbnail_route(
body: Ruma<get_content_thumbnail::v1::Request>,
) -> Result<get_content_thumbnail::v1::Response> {
services()
.media
.check_blocked(services().globals.server_name(), &body.media_id)?;
let Some(FileMeta {
file,
content_type,