From 21fb29c3221f14c82058bd360edc949e1ab4dbc4 Mon Sep 17 00:00:00 2001 From: notplants Date: Wed, 25 May 2022 14:49:05 +0200 Subject: [PATCH 1/2] Working sbot --- peach-web/Cargo.toml | 1 + peach-web/src/utils/sbot.rs | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/peach-web/Cargo.toml b/peach-web/Cargo.toml index 94a7160..239588f 100644 --- a/peach-web/Cargo.toml +++ b/peach-web/Cargo.toml @@ -39,6 +39,7 @@ chrono = "0.4" dirs = "4.0" env_logger = "0.8" futures = "0.3" +#golgi = { git = "https://git.coopcloud.tech/golgi-ssb/golgi.git", branch = "dev" } golgi = { git = "https://git.coopcloud.tech/golgi-ssb/golgi.git" } lazy_static = "1.4" log = "0.4" diff --git a/peach-web/src/utils/sbot.rs b/peach-web/src/utils/sbot.rs index 8a8b34c..85220b8 100644 --- a/peach-web/src/utils/sbot.rs +++ b/peach-web/src/utils/sbot.rs @@ -13,10 +13,12 @@ use async_std::task; use dirs; use futures::stream::TryStreamExt; use golgi::{api::friends::RelationshipQuery, blobs, messages::SsbMessageValue, Sbot}; +use golgi::sbot::Keystore; use log::debug; use peach_lib::sbot::SbotConfig; use rouille::input::post::BufferedFile; use temporary::Directory; +use peach_lib::config_manager::get_config_value; use crate::{error::PeachWebError, utils::sbot}; @@ -66,13 +68,14 @@ pub async fn init_sbot_with_config( ) -> Result { debug!("Initialising an sbot client with configuration parameters"); // initialise sbot connection with ip:port and shscap from config file + let key_path = format!("{}/secret", get_config_value("GO_SBOT_DATADIR")?); let sbot_client = match sbot_config { // TODO: panics if we pass `Some(conf.shscap)` as second arg Some(conf) => { let ip_port = conf.lis.clone(); - Sbot::init(Some(ip_port), None).await? + Sbot::init(Keystore::CustomGoSbot(key_path), Some(ip_port), None).await? } - None => Sbot::init(None, None).await?, + None => Sbot::init(Keystore::CustomGoSbot(key_path), None, None).await?, }; Ok(sbot_client) -- 2.49.0 From 9f6ba141239e609a144687d4a6df5171f033f42a Mon Sep 17 00:00:00 2001 From: notplants Date: Wed, 25 May 2022 14:50:41 +0200 Subject: [PATCH 2/2] Cargo fmt --- peach-web/src/utils/sbot.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/peach-web/src/utils/sbot.rs b/peach-web/src/utils/sbot.rs index 85220b8..def0ba9 100644 --- a/peach-web/src/utils/sbot.rs +++ b/peach-web/src/utils/sbot.rs @@ -12,13 +12,13 @@ use std::{ use async_std::task; use dirs; use futures::stream::TryStreamExt; -use golgi::{api::friends::RelationshipQuery, blobs, messages::SsbMessageValue, Sbot}; use golgi::sbot::Keystore; +use golgi::{api::friends::RelationshipQuery, blobs, messages::SsbMessageValue, Sbot}; use log::debug; +use peach_lib::config_manager::get_config_value; use peach_lib::sbot::SbotConfig; use rouille::input::post::BufferedFile; use temporary::Directory; -use peach_lib::config_manager::get_config_value; use crate::{error::PeachWebError, utils::sbot}; -- 2.49.0