Can request any media file
This commit is contained in:
@@ -55,3 +55,13 @@ pub async fn serve_media(req: HttpRequest, media: OwnedMxcUri) -> HttpResult {
|
||||
.insert_header(("cache-control", "max-age=360000"))
|
||||
.body(media))
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
pub struct MediaMXCInPath {
|
||||
mxc: OwnedMxcUri,
|
||||
}
|
||||
|
||||
/// Save media resource handler
|
||||
pub async fn serve_media_res(req: HttpRequest, media: web::Path<MediaMXCInPath>) -> HttpResult {
|
||||
serve_media(req, media.into_inner().mxc).await
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::controllers::HttpResult;
|
||||
use crate::controllers::matrix::media_controller;
|
||||
use crate::controllers::matrix::matrix_media_controller;
|
||||
use crate::extractors::matrix_client_extractor::MatrixClientExtractor;
|
||||
use actix_web::{HttpRequest, HttpResponse, web};
|
||||
use futures_util::{StreamExt, stream};
|
||||
@@ -72,5 +72,5 @@ pub async fn room_avatar(
|
||||
return Ok(HttpResponse::NotFound().json("Room has no avatar"));
|
||||
};
|
||||
|
||||
media_controller::serve_media(req, uri).await
|
||||
matrix_media_controller::serve_media(req, uri).await
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
pub mod matrix_media_controller;
|
||||
pub mod matrix_profile_controller;
|
||||
pub mod matrix_room_controller;
|
||||
pub mod media_controller;
|
||||
|
||||
Reference in New Issue
Block a user