|
|
|
@ -10,7 +10,7 @@ use crate::{ |
|
|
|
services, utils, Error, PduEvent, Result, Ruma, |
|
|
|
services, utils, Error, PduEvent, Result, Ruma, |
|
|
|
}; |
|
|
|
}; |
|
|
|
use axum::{response::IntoResponse, Json}; |
|
|
|
use axum::{response::IntoResponse, Json}; |
|
|
|
use axum_extra::headers::{authorization::Credentials, CacheControl, Header}; |
|
|
|
use axum_extra::headers::{CacheControl, Header}; |
|
|
|
use get_profile_information::v1::ProfileField; |
|
|
|
use get_profile_information::v1::ProfileField; |
|
|
|
use http::header::AUTHORIZATION; |
|
|
|
use http::header::AUTHORIZATION; |
|
|
|
|
|
|
|
|
|
|
|
@ -52,7 +52,6 @@ use ruma::{ |
|
|
|
StateEventType, TimelineEventType, |
|
|
|
StateEventType, TimelineEventType, |
|
|
|
}, |
|
|
|
}, |
|
|
|
serde::{Base64, JsonObject, Raw}, |
|
|
|
serde::{Base64, JsonObject, Raw}, |
|
|
|
server_util::authorization::XMatrix, |
|
|
|
|
|
|
|
to_device::DeviceIdOrAllDevices, |
|
|
|
to_device::DeviceIdOrAllDevices, |
|
|
|
uint, user_id, CanonicalJsonObject, CanonicalJsonValue, EventId, MilliSecondsSinceUnixEpoch, |
|
|
|
uint, user_id, CanonicalJsonObject, CanonicalJsonValue, EventId, MilliSecondsSinceUnixEpoch, |
|
|
|
OwnedEventId, OwnedRoomId, OwnedServerName, OwnedServerSigningKeyId, OwnedUserId, RoomId, |
|
|
|
OwnedEventId, OwnedRoomId, OwnedServerName, OwnedServerSigningKeyId, OwnedUserId, RoomId, |
|
|
|
@ -275,15 +274,15 @@ where |
|
|
|
for s in signature_server { |
|
|
|
for s in signature_server { |
|
|
|
http_request.headers_mut().insert( |
|
|
|
http_request.headers_mut().insert( |
|
|
|
AUTHORIZATION, |
|
|
|
AUTHORIZATION, |
|
|
|
XMatrix::parse(&format!( |
|
|
|
format!( |
|
|
|
"X-Matrix origin=\"{}\",destination=\"{}\",key=\"{}\",sig=\"{}\"", |
|
|
|
"X-Matrix origin=\"{}\",destination=\"{}\",key=\"{}\",sig=\"{}\"", |
|
|
|
services().globals.server_name(), |
|
|
|
services().globals.server_name(), |
|
|
|
destination, |
|
|
|
destination, |
|
|
|
s.0, |
|
|
|
s.0, |
|
|
|
s.1 |
|
|
|
s.1 |
|
|
|
)) |
|
|
|
) |
|
|
|
.expect("When Ruma signs JSON, it produces a valid base64 signature. All other types are valid ServerNames or OwnedKeyId") |
|
|
|
.try_into() |
|
|
|
.encode(), |
|
|
|
.unwrap(), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -343,7 +342,7 @@ where |
|
|
|
|
|
|
|
|
|
|
|
response.map_err(|e| { |
|
|
|
response.map_err(|e| { |
|
|
|
warn!( |
|
|
|
warn!( |
|
|
|
"Invalid 200 response from {} on: {} {}", |
|
|
|
"Invalid 200 response from {} on: {} {:?}", |
|
|
|
&destination, url, e |
|
|
|
&destination, url, e |
|
|
|
); |
|
|
|
); |
|
|
|
Error::BadServerResponse("Server returned bad 200 response.") |
|
|
|
Error::BadServerResponse("Server returned bad 200 response.") |
|
|
|
|