log rejected sendjoin, remove unnecessary clone

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2023-12-03 20:20:25 -05:00
parent 0ed891b3a1
commit 8454773275
4 changed files with 24 additions and 14 deletions

7
Cargo.lock generated
View File

@ -414,6 +414,7 @@ dependencies = [
"js_option",
"jsonwebtoken",
"lazy_static",
"loole",
"lru-cache",
"nix",
"num_cpus",
@ -1421,6 +1422,12 @@ version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "loole"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a7039a651ba2fccd770a7534059b9744b3641390d696e2f91de6655457e9327"
[[package]]
name = "lru-cache"
version = "0.1.2"

View File

@ -36,6 +36,7 @@ hyperlocal = { git = "https://github.com/softprops/hyperlocal", rev = "2ee4d1496
] }
hyper = { version = "0.14", features = ["server", "http1", "http2"] }
tokio = { version = "1.34.0", features = ["fs", "macros", "signal", "sync"] }
loole = "0.1"
# Used for storing data permanently
#sled = { version = "0.34.7", features = ["compression", "no_metrics"], optional = true }
#sled = { git = "https://github.com/spacejam/sled.git", rev = "e4640e0773595229f398438886f19bca6f7326a2", features = ["compression"] }

View File

@ -631,7 +631,7 @@ async fn join_room_by_id_helper(
));
}
if let Ok(signature) = signed_value["signatures"]
match signed_value["signatures"]
.as_object()
.ok_or(Error::BadRequest(
ErrorKind::InvalidParam,
@ -642,18 +642,20 @@ async fn join_room_by_id_helper(
ErrorKind::InvalidParam,
"Server did not send its signature",
))
})
{
join_event
.get_mut("signatures")
.expect("we created a valid pdu")
.as_object_mut()
.expect("we created a valid pdu")
.insert(remote_server.to_string(), signature.clone());
} else {
warn!(
"Server {remote_server} sent invalid signature in sendjoin signatures for event {signed_value:?}",
);
}) {
Ok(signature) => {
join_event
.get_mut("signatures")
.expect("we created a valid pdu")
.as_object_mut()
.expect("we created a valid pdu")
.insert(remote_server.to_string(), signature.clone());
}
Err(e) => {
warn!(
"Server {remote_server} sent invalid signature in sendjoin signatures for event {signed_value:?}: {e:?}",
);
}
}
}

View File

@ -1921,7 +1921,7 @@ pub async fn get_devices_route(
let device_id_string = metadata.device_id.as_str().to_owned();
let device_display_name = match services().globals.allow_device_name_federation() {
true => metadata.display_name,
false => Some(device_id_string.to_string()),
false => Some(device_id_string),
};
Some(UserDevice {
keys: services()