From 9704269c8aa1dcd18aa83b1f8ae14f694c7dc03e Mon Sep 17 00:00:00 2001 From: mycognosist Date: Thu, 7 Jul 2022 15:44:31 +0100 Subject: [PATCH 1/2] Remove Cargo.lock from .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index e075842..41e4e65 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,3 @@ target *peachdeploy.sh *vpsdeploy.sh *bindeploy.sh -Cargo.lock From eddb167c4c69653977b6b37fcc99b72a60582b5d Mon Sep 17 00:00:00 2001 From: mycognosist Date: Thu, 7 Jul 2022 15:54:19 +0100 Subject: [PATCH 2/2] Remove KVT to Value map and retrieve sequence number directly from KVT --- peach-web/src/utils/sbot.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/peach-web/src/utils/sbot.rs b/peach-web/src/utils/sbot.rs index 6a61c66..24c1b15 100644 --- a/peach-web/src/utils/sbot.rs +++ b/peach-web/src/utils/sbot.rs @@ -8,12 +8,11 @@ use std::{ process::{Command, Output}, }; -use async_std::stream::StreamExt; use async_std::task; use dirs; use futures::stream::TryStreamExt; use golgi::{ - api::friends::RelationshipQuery, blobs, messages::SsbMessageValue, sbot::Keystore, Sbot, + api::friends::RelationshipQuery, blobs, messages::SsbMessageKVT, sbot::Keystore, Sbot, }; use log::debug; use peach_lib::config_manager; @@ -135,11 +134,7 @@ pub fn latest_sequence_number() -> Result> { let id = sbot_client.whoami().await?; let history_stream = sbot_client.create_history_stream(id).await?; - let msg_stream = history_stream.map(|res| match res { - Ok(kvt) => Ok(kvt.value), - Err(err) => Err(err), - }); - let mut msgs: Vec = msg_stream.try_collect().await?; + let mut msgs: Vec = history_stream.try_collect().await?; // there will be zero messages when the sbot is run for the first time if msgs.is_empty() { @@ -149,7 +144,7 @@ pub fn latest_sequence_number() -> Result> { msgs.reverse(); // return the sequence number of the latest msg - Ok(msgs[0].sequence) + Ok(msgs[0].value.sequence) } }) }