upgrade to latest ruma

This commit is contained in:
Charles Hall 2024-10-24 16:03:37 -07:00
parent 2dbb101140
commit c9c30fba30
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
8 changed files with 119 additions and 119 deletions

View file

@ -17,7 +17,7 @@ use ruma::{
federation,
},
serde::Raw,
DeviceKeyAlgorithm, OwnedDeviceId, OwnedUserId, UserId,
OneTimeKeyAlgorithm, OwnedDeviceId, OwnedUserId, UserId,
};
use serde_json::json;
use tracing::debug;
@ -474,7 +474,16 @@ pub(crate) async fn get_keys_helper<F: Fn(&UserId) -> bool>(
let (_, our_master_key) = services()
.users
.parse_master_key(&user, &our_master_key)?;
master_key.signatures.extend(our_master_key.signatures);
for (entity, v) in &*our_master_key.signatures {
for (key_identifier, value) in v {
master_key.signatures.insert_signature(
entity.clone(),
key_identifier.clone(),
value.clone(),
);
}
}
}
let json = serde_json::to_value(master_key)
.expect("to_value always works");
@ -525,7 +534,7 @@ fn add_unsigned_device_display_name(
pub(crate) async fn claim_keys_helper(
one_time_keys_input: &BTreeMap<
OwnedUserId,
BTreeMap<OwnedDeviceId, DeviceKeyAlgorithm>,
BTreeMap<OwnedDeviceId, OneTimeKeyAlgorithm>,
>,
) -> Result<claim_keys::v3::Response> {
let mut one_time_keys = BTreeMap::new();

View file

@ -670,11 +670,13 @@ pub(crate) async fn get_content_thumbnail_legacy_route(
AmResponse {
file,
content_type,
..
}: AmResponse,
) -> LegacyResponse {
LegacyResponse {
file,
content_type,
content_disposition: None,
cross_origin_resource_policy: Some("cross-origin".to_owned()),
}
}
@ -833,6 +835,7 @@ async fn get_content_thumbnail_route_ruma(
authenticated_media_client::get_content_thumbnail::v1::Response {
file,
content_type,
content_disposition: None,
}
};

View file

@ -4,7 +4,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_actions, set_pushrule_enabled,
},
},
events::{push_rules::PushRulesEvent, GlobalAccountDataEventType},
@ -89,13 +89,6 @@ pub(crate) 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(
@ -168,13 +161,6 @@ pub(crate) async fn get_pushrule_actions_route(
) -> Result<Ra<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(
@ -213,13 +199,6 @@ pub(crate) async fn set_pushrule_actions_route(
) -> Result<Ra<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(
@ -268,13 +247,6 @@ pub(crate) async fn get_pushrule_enabled_route(
) -> Result<Ra<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(
@ -314,13 +286,6 @@ pub(crate) async fn set_pushrule_enabled_route(
) -> Result<Ra<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(
@ -369,13 +334,6 @@ pub(crate) async fn delete_pushrule_route(
) -> Result<Ra<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

@ -59,7 +59,7 @@ use ruma::{
uint, user_id, CanonicalJsonObject, CanonicalJsonValue, EventId,
MilliSecondsSinceUnixEpoch, OwnedEventId, OwnedRoomId, OwnedServerName,
OwnedServerSigningKeyId, OwnedSigningKeyId, OwnedUserId, RoomId,
ServerName,
ServerName, Signatures,
};
use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
use tokio::sync::RwLock;
@ -617,7 +617,7 @@ pub(crate) async fn get_server_keys_route() -> Result<impl IntoResponse> {
server_name: services().globals.server_name().to_owned(),
verify_keys,
old_verify_keys,
signatures: BTreeMap::new(),
signatures: Signatures::new(),
valid_until_ts: keys.valid_until_ts,
})
.expect("static conversion, no errors"),