diff --git a/src/client_server.rs b/src/client_server.rs index a2cc5754..dd609f2b 100644 --- a/src/client_server.rs +++ b/src/client_server.rs @@ -756,7 +756,7 @@ pub async fn get_public_rooms_filtered_route( chunk.extend_from_slice( &server_server::send_request( &data, - "https://matrix.koesters.xyz".to_owned(), + "matrix.koesters.xyz".to_owned(), ruma_federation_api::v1::get_public_rooms::Request { limit: None, since: None, diff --git a/src/server_server.rs b/src/server_server.rs index cbdcb6ad..f0fdf655 100644 --- a/src/server_server.rs +++ b/src/server_server.rs @@ -32,24 +32,26 @@ where T::Error: std::fmt::Debug, { let mut http_request: http::Request<_> = request.try_into().unwrap(); - let uri = destination.clone() + T::METADATA.path; - *http_request.uri_mut() = uri.parse().unwrap(); + + *http_request.uri_mut() = ("https://".to_owned() + &destination.clone() + T::METADATA.path).parse().unwrap(); - let body = http_request.body(); - let mut request_json = if !body.is_empty() { - serde_json::to_value(http_request.body()).unwrap() - } else { - serde_json::Map::new().into() + let mut request_map = serde_json::Map::new(); + + if !http_request.body().is_empty() { + request_map.insert("content".to_owned(), + serde_json::to_value(http_request.body()).unwrap()); }; - let request_map = request_json.as_object_mut().unwrap(); - request_map.insert("method".to_owned(), T::METADATA.method.to_string().into()); - request_map.insert("uri".to_owned(), uri.into()); + request_map.insert("uri".to_owned(), T::METADATA.path.into()); request_map.insert("origin".to_owned(), data.hostname().into()); request_map.insert("destination".to_owned(), destination.to_string().into()); + //request_map.insert("signatures".to_owned(), json!({})); + + let mut request_json = request_map.into(); + ruma_signatures::sign_json(data.hostname(), data.keypair(), dbg!(&mut request_json)).unwrap(); + dbg!(&request_json); - ruma_signatures::sign_json(data.hostname(), data.keypair(), &mut request_json).unwrap(); let signatures = request_json["signatures"] .as_object() .unwrap()