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

chore: upgrade ruma

This commit is contained in:
Matthias Ahouansou 2025-02-23 05:35:28 +00:00
parent 406367b4f2
commit 2a7aa6242f
No known key found for this signature in database
14 changed files with 143 additions and 144 deletions

View file

@ -14,7 +14,7 @@ use ruma::{
federation,
},
serde::Raw,
DeviceKeyAlgorithm, OwnedDeviceId, OwnedUserId, UserId,
OneTimeKeyAlgorithm, OwnedDeviceId, OwnedUserId, UserId,
};
use serde_json::json;
use std::{
@ -465,7 +465,7 @@ fn add_unsigned_device_display_name(
}
pub(crate) async fn claim_keys_helper(
one_time_keys_input: &BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, DeviceKeyAlgorithm>>,
one_time_keys_input: &BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, OneTimeKeyAlgorithm>>,
) -> Result<claim_keys::v3::Response> {
let mut one_time_keys = BTreeMap::new();

View file

@ -301,7 +301,11 @@ async fn get_content_as_filename(
pub async fn get_content_thumbnail_route(
body: Ruma<media::get_content_thumbnail::v3::Request>,
) -> Result<media::get_content_thumbnail::v3::Response> {
let get_content_thumbnail::v1::Response { file, content_type } = get_content_thumbnail(
let get_content_thumbnail::v1::Response {
file,
content_type,
content_disposition,
} = get_content_thumbnail(
&body.server_name,
body.media_id.clone(),
body.height,
@ -316,6 +320,7 @@ pub async fn get_content_thumbnail_route(
file,
content_type,
cross_origin_resource_policy: Some("cross-origin".to_owned()),
content_disposition,
})
}
@ -349,7 +354,9 @@ async fn get_content_thumbnail(
let mxc = format!("mxc://{}/{}", server_name, media_id);
if let Some(FileMeta {
file, content_type, ..
file,
content_type,
content_disposition,
}) = services()
.media
.get_thumbnail(
@ -363,7 +370,11 @@ async fn get_content_thumbnail(
)
.await?
{
Ok(get_content_thumbnail::v1::Response { file, content_type })
Ok(get_content_thumbnail::v1::Response {
file,
content_type,
content_disposition: Some(content_disposition),
})
} else if server_name != services().globals.server_name() && allow_remote {
let thumbnail_response = match services()
.sending
@ -386,6 +397,7 @@ async fn get_content_thumbnail(
}) => get_content_thumbnail::v1::Response {
file: content.file,
content_type: content.content_type,
content_disposition: content.content_disposition,
},
Ok(federation_media::get_content_thumbnail::v1::Response {
@ -393,14 +405,23 @@ async fn get_content_thumbnail(
content: FileOrLocation::Location(url),
}) => {
let get_content::v1::Response {
file, content_type, ..
file,
content_type,
content_disposition,
} = get_location_content(url).await?;
get_content_thumbnail::v1::Response { file, content_type }
get_content_thumbnail::v1::Response {
file,
content_type,
content_disposition,
}
}
Err(Error::BadRequest(ErrorKind::Unrecognized, _)) => {
let media::get_content_thumbnail::v3::Response {
file, content_type, ..
file,
content_type,
content_disposition,
..
} = services()
.sending
.send_federation_request(
@ -419,7 +440,11 @@ async fn get_content_thumbnail(
)
.await?;
get_content_thumbnail::v1::Response { file, content_type }
get_content_thumbnail::v1::Response {
file,
content_type,
content_disposition,
}
}
Err(e) => return Err(e),
};

View file

@ -5,7 +5,7 @@ use ruma::{
push::{
delete_pushrule, get_pushers, get_pushrule, get_pushrule_actions, get_pushrule_enabled,
get_pushrules_all, set_pusher, set_pushrule, set_pushrule_actions,
set_pushrule_enabled, RuleScope,
set_pushrule_enabled,
},
},
events::{push_rules::PushRulesEvent, GlobalAccountDataEventType},
@ -89,13 +89,6 @@ pub async fn set_pushrule_route(
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
let body = body.body;
if body.scope != RuleScope::Global {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Scopes other than 'global' are not supported.",
));
}
let event = services()
.account_data
.get(
@ -161,13 +154,6 @@ pub async fn get_pushrule_actions_route(
) -> Result<get_pushrule_actions::v3::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
if body.scope != RuleScope::Global {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Scopes other than 'global' are not supported.",
));
}
let event = services()
.account_data
.get(
@ -204,13 +190,6 @@ pub async fn set_pushrule_actions_route(
) -> Result<set_pushrule_actions::v3::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
if body.scope != RuleScope::Global {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Scopes other than 'global' are not supported.",
));
}
let event = services()
.account_data
.get(
@ -256,13 +235,6 @@ pub async fn get_pushrule_enabled_route(
) -> Result<get_pushrule_enabled::v3::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
if body.scope != RuleScope::Global {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Scopes other than 'global' are not supported.",
));
}
let event = services()
.account_data
.get(
@ -298,13 +270,6 @@ pub async fn set_pushrule_enabled_route(
) -> Result<set_pushrule_enabled::v3::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
if body.scope != RuleScope::Global {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Scopes other than 'global' are not supported.",
));
}
let event = services()
.account_data
.get(
@ -350,13 +315,6 @@ pub async fn delete_pushrule_route(
) -> Result<delete_pushrule::v3::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
if body.scope != RuleScope::Global {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Scopes other than 'global' are not supported.",
));
}
let event = services()
.account_data
.get(

View file

@ -56,7 +56,7 @@ use ruma::{
to_device::DeviceIdOrAllDevices,
uint, user_id, CanonicalJsonObject, CanonicalJsonValue, EventId, MilliSecondsSinceUnixEpoch,
OwnedEventId, OwnedRoomId, OwnedServerName, OwnedServerSigningKeyId, OwnedUserId, RoomId,
ServerName,
ServerName, Signatures,
};
use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
use std::{
@ -714,7 +714,7 @@ pub async fn get_server_keys_route() -> Result<impl IntoResponse> {
server_name: services().globals.server_name().to_owned(),
verify_keys,
old_verify_keys: BTreeMap::new(),
signatures: BTreeMap::new(),
signatures: Signatures::new(),
valid_until_ts: MilliSecondsSinceUnixEpoch::from_system_time(
SystemTime::now() + Duration::from_secs(86400 * 7),
)