Remove encryption logic as it is handled by matrix-sdk e2e-encryption feature directly
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
1008
matrixgw_backend/Cargo.lock
generated
1008
matrixgw_backend/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -27,8 +27,8 @@ ipnet = { version = "2.11.0", features = ["serde"] }
|
|||||||
rand = "0.9.2"
|
rand = "0.9.2"
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
mailchecker = "6.0.19"
|
mailchecker = "6.0.19"
|
||||||
matrix-sdk = { version = "0.16.0" }
|
matrix-sdk = { version = "0.16.0", features = ["e2e-encryption"] }
|
||||||
matrix-sdk-ui = "0.14.0"
|
matrix-sdk-ui = "0.16.0"
|
||||||
url = "2.5.7"
|
url = "2.5.7"
|
||||||
ractor = "0.15.9"
|
ractor = "0.15.9"
|
||||||
serde_json = "1.0.145"
|
serde_json = "1.0.145"
|
||||||
|
|||||||
@@ -4,11 +4,9 @@ use crate::utils::crypt_utils::sha512;
|
|||||||
use actix_web::dev::Payload;
|
use actix_web::dev::Payload;
|
||||||
use actix_web::http::header;
|
use actix_web::http::header;
|
||||||
use actix_web::{FromRequest, HttpRequest, HttpResponse, web};
|
use actix_web::{FromRequest, HttpRequest, HttpResponse, web};
|
||||||
use matrix_sdk::crypto::{AttachmentDecryptor, MediaEncryptionInfo};
|
|
||||||
use matrix_sdk::media::{MediaFormat, MediaRequestParameters, MediaThumbnailSettings};
|
use matrix_sdk::media::{MediaFormat, MediaRequestParameters, MediaThumbnailSettings};
|
||||||
use matrix_sdk::ruma::events::room::MediaSource;
|
use matrix_sdk::ruma::events::room::MediaSource;
|
||||||
use matrix_sdk::ruma::{OwnedMxcUri, UInt};
|
use matrix_sdk::ruma::{OwnedMxcUri, UInt};
|
||||||
use std::io::{Cursor, Read};
|
|
||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
pub struct MediaMXCInPath {
|
pub struct MediaMXCInPath {
|
||||||
@@ -54,21 +52,6 @@ pub async fn serve_media(req: HttpRequest, source: MediaSource, thumbnail: bool)
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// Decrypt file if needed
|
|
||||||
let media = if let MediaSource::Encrypted(file) = source {
|
|
||||||
let mut cursor = Cursor::new(media);
|
|
||||||
let mut decryptor =
|
|
||||||
AttachmentDecryptor::new(&mut cursor, MediaEncryptionInfo::from(*file))?;
|
|
||||||
|
|
||||||
let mut decrypted_data = Vec::new();
|
|
||||||
|
|
||||||
decryptor.read_to_end(&mut decrypted_data)?;
|
|
||||||
|
|
||||||
decrypted_data
|
|
||||||
} else {
|
|
||||||
media
|
|
||||||
};
|
|
||||||
|
|
||||||
let digest = sha512(&media);
|
let digest = sha512(&media);
|
||||||
|
|
||||||
let mime_type = infer::get(&media).map(|x| x.mime_type());
|
let mime_type = infer::get(&media).map(|x| x.mime_type());
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ pub async fn hierarchy(client: MatrixClientExtractor) -> HttpResult {
|
|||||||
let space_service = SpaceService::new(client.client.client);
|
let space_service = SpaceService::new(client.client.client);
|
||||||
let mut hierarchy = HashMap::new();
|
let mut hierarchy = HashMap::new();
|
||||||
for space in spaces {
|
for space in spaces {
|
||||||
let rooms = space_service.space_room_list(space.room_id().to_owned());
|
let rooms = space_service
|
||||||
|
.space_room_list(space.room_id().to_owned())
|
||||||
|
.await;
|
||||||
while !matches!(
|
while !matches!(
|
||||||
rooms.pagination_state(),
|
rooms.pagination_state(),
|
||||||
SpaceRoomListPaginationState::Idle { end_reached: true }
|
SpaceRoomListPaginationState::Idle { end_reached: true }
|
||||||
|
|||||||
Reference in New Issue
Block a user