From 8410d2db528c41a8597e193249ab64106858829a Mon Sep 17 00:00:00 2001 From: "Ian Clarke (aider)" Date: Sat, 21 Dec 2024 18:59:06 -0600 Subject: [PATCH] feat: Fix byte conversion and private field access in freenet_api --- ui/src/components/app/freenet_api.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/src/components/app/freenet_api.rs b/ui/src/components/app/freenet_api.rs index 46ad45b..4837cbd 100644 --- a/ui/src/components/app/freenet_api.rs +++ b/ui/src/components/app/freenet_api.rs @@ -107,10 +107,10 @@ impl FreenetApiSynchronizer { match contract_response { ContractResponse::GetResponse { key, state, .. } => { // Update rooms with received state - if let Ok(room_state) = ciborium::from_reader(&state.0[..]) { + if let Ok(room_state) = ciborium::from_reader(state.as_ref()) { let mut rooms = use_context::>(); let mut rooms = rooms.write(); - if let Some(room_data) = rooms.map.get_mut(&VerifyingKey::from_bytes(key.id().as_ref()).unwrap()) { + if let Some(room_data) = rooms.map.get_mut(&VerifyingKey::from_bytes(key.id().as_ref()).expect("Invalid key bytes")) { if let Err(e) = room_data.room_state.merge( &room_data.room_state, &room_data.parameters(), @@ -126,8 +126,8 @@ impl FreenetApiSynchronizer { // Handle incremental updates let mut rooms = use_context::>(); let mut rooms = rooms.write(); - if let Some(room_data) = rooms.map.get_mut(&VerifyingKey::from_bytes(key.id().as_ref()).unwrap()) { - if let Ok(delta) = ciborium::from_reader(&update.0[..]) { + if let Some(room_data) = rooms.map.get_mut(&VerifyingKey::from_bytes(key.id().as_ref()).expect("Invalid key bytes")) { + if let Ok(delta) = ciborium::from_reader(update.as_ref()) { if let Err(e) = room_data.room_state.apply_delta( &room_data.room_state, &room_data.parameters(),