From 7deaa00d6e7b129f96fc24a0ff5081637131f94f Mon Sep 17 00:00:00 2001 From: notplants Date: Fri, 20 May 2022 13:31:06 +0200 Subject: [PATCH 01/22] Fix hardcoded path --- peach-lib/src/sbot.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/peach-lib/src/sbot.rs b/peach-lib/src/sbot.rs index 880479d..12cb57c 100644 --- a/peach-lib/src/sbot.rs +++ b/peach-lib/src/sbot.rs @@ -199,9 +199,8 @@ impl Default for SbotConfig { impl SbotConfig { /// Read the go-sbot `config.toml` file from file and deserialize into `SbotConfig`. pub fn read() -> Result { - // determine path of user's home directory - let mut config_path = dirs::home_dir().ok_or(PeachError::HomeDir)?; - config_path.push(".ssb-go/config.toml"); + // determine path of user's go-sbot config.toml + let config_path = format!("{}/config.toml", get_config_value("GO_SBOT_DATADIR")?); let config_contents = fs::read_to_string(config_path)?; @@ -217,7 +216,7 @@ impl SbotConfig { // convert the provided `SbotConfig` instance to a string let config_string = toml::to_string(&config)?; - // determine path of user's home directory + // determine path of user's go-sbot config.toml let config_path = format!("{}/config.toml", get_config_value("GO_SBOT_DATADIR")?); // open config file for writing From 56c142a387cdf590e2a9a077f0d22b45f7c545c7 Mon Sep 17 00:00:00 2001 From: notplants Date: Fri, 20 May 2022 13:35:37 +0200 Subject: [PATCH 02/22] Make go-sbot.service name configurable --- peach-lib/src/config_manager.rs | 1 + peach-lib/src/sbot.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/peach-lib/src/config_manager.rs b/peach-lib/src/config_manager.rs index 11ae424..600899c 100644 --- a/peach-lib/src/config_manager.rs +++ b/peach-lib/src/config_manager.rs @@ -60,6 +60,7 @@ pub fn get_peach_config_defaults() -> HashMap { ("ADMIN_PASSWORD_HASH", "47"), ("TEMPORARY_PASSWORD_HASH", ""), ("GO_SBOT_DATADIR", "/home/peach/.ssb-go"), + ("GO_SBOT_SERVICE", "go-sbot.service"), ("PEACH_CONFIGDIR", "/var/lib/peachcloud"), ("PEACH_HOMEDIR", "/home/peach"), ("PEACH_WEBDIR", "/usr/share/peach-web"), diff --git a/peach-lib/src/sbot.rs b/peach-lib/src/sbot.rs index 12cb57c..4fffc5c 100644 --- a/peach-lib/src/sbot.rs +++ b/peach-lib/src/sbot.rs @@ -67,7 +67,7 @@ impl SbotStatus { // because non-privileged users are able to run systemctl show let info_output = Command::new("systemctl") .arg("show") - .arg("go-sbot.service") + .arg(get_config_value("GO_SBOT_SERVICE")?) .arg("--no-page") .output()?; @@ -89,7 +89,7 @@ impl SbotStatus { // because non-privileged users are able to run systemctl status let status_output = Command::new("systemctl") .arg("status") - .arg("go-sbot.service") + .arg(get_config_value("GO_SBOT_SERVICE")?) .output()?; let service_status = str::from_utf8(&status_output.stdout)?; From 6434471599fb2edcee3b1e8a610f740db6e6f9c7 Mon Sep 17 00:00:00 2001 From: notplants Date: Fri, 20 May 2022 13:55:21 +0200 Subject: [PATCH 03/22] Bump version numbers --- Cargo.lock | 4 ++-- peach-lib/Cargo.toml | 2 +- peach-web/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9224fae..7ebe40f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2425,7 +2425,7 @@ dependencies = [ [[package]] name = "peach-lib" -version = "1.3.3" +version = "1.3.4" dependencies = [ "async-std", "chrono", @@ -2517,7 +2517,7 @@ dependencies = [ [[package]] name = "peach-web" -version = "0.6.13" +version = "0.6.14" dependencies = [ "async-std", "base64 0.13.0", diff --git a/peach-lib/Cargo.toml b/peach-lib/Cargo.toml index 028c61a..ee14e50 100644 --- a/peach-lib/Cargo.toml +++ b/peach-lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "peach-lib" -version = "1.3.3" +version = "1.3.4" authors = ["Andrew Reid "] edition = "2018" diff --git a/peach-web/Cargo.toml b/peach-web/Cargo.toml index 11d345b..be35863 100644 --- a/peach-web/Cargo.toml +++ b/peach-web/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "peach-web" -version = "0.6.13" +version = "0.6.14" authors = ["Andrew Reid "] edition = "2018" description = "peach-web is a web application which provides a web interface for monitoring and interacting with the PeachCloud device. This allows administration of the single-board computer (ie. Raspberry Pi) running PeachCloud, as well as the ssb-server and related plugins." From 543470b949deaa2aa0dd57b436b855ae61bb2e76 Mon Sep 17 00:00:00 2001 From: notplants Date: Fri, 20 May 2022 16:25:18 +0200 Subject: [PATCH 04/22] Fix lockfile --- peach-lib/src/config_manager.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/peach-lib/src/config_manager.rs b/peach-lib/src/config_manager.rs index 600899c..49d6d38 100644 --- a/peach-lib/src/config_manager.rs +++ b/peach-lib/src/config_manager.rs @@ -132,7 +132,10 @@ pub fn save_peach_config_to_disc( peach_config: HashMap, ) -> Result, PeachError> { // use a file lock to avoid race conditions while saving config - let mut lock = LockFile::open(&*LOCK_FILE_PATH)?; + let mut lock = LockFile::open(&*LOCK_FILE_PATH).map_err(|source| PeachError::Read { + source, + path: LOCK_FILE_PATH.to_string(), + })?; lock.lock()?; // first convert Hashmap to BTreeMap (so that keys are saved in deterministic alphabetical order) From 3adb2269690faba4ccfdc863578dcfd907ca6300 Mon Sep 17 00:00:00 2001 From: notplants Date: Wed, 25 May 2022 12:25:54 +0200 Subject: [PATCH 05/22] Bump version number --- Cargo.lock | 2 +- peach-web/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ebe40f..b7aa8f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2517,7 +2517,7 @@ dependencies = [ [[package]] name = "peach-web" -version = "0.6.14" +version = "0.6.15" dependencies = [ "async-std", "base64 0.13.0", diff --git a/peach-web/Cargo.toml b/peach-web/Cargo.toml index be35863..94a7160 100644 --- a/peach-web/Cargo.toml +++ b/peach-web/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "peach-web" -version = "0.6.14" +version = "0.6.15" authors = ["Andrew Reid "] edition = "2018" description = "peach-web is a web application which provides a web interface for monitoring and interacting with the PeachCloud device. This allows administration of the single-board computer (ie. Raspberry Pi) running PeachCloud, as well as the ssb-server and related plugins." From 21fb29c3221f14c82058bd360edc949e1ab4dbc4 Mon Sep 17 00:00:00 2001 From: notplants Date: Wed, 25 May 2022 14:49:05 +0200 Subject: [PATCH 06/22] 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) From 9f6ba141239e609a144687d4a6df5171f033f42a Mon Sep 17 00:00:00 2001 From: notplants Date: Wed, 25 May 2022 14:50:41 +0200 Subject: [PATCH 07/22] 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}; From 5147eed497cd64378d1169ca0ddcb8bd04016a18 Mon Sep 17 00:00:00 2001 From: notplants Date: Thu, 26 May 2022 23:17:20 +0200 Subject: [PATCH 08/22] Change sbot.rs to use configurable go-sbot service name --- peach-web/src/utils/sbot.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/peach-web/src/utils/sbot.rs b/peach-web/src/utils/sbot.rs index def0ba9..64c8bed 100644 --- a/peach-web/src/utils/sbot.rs +++ b/peach-web/src/utils/sbot.rs @@ -3,7 +3,6 @@ use std::{ error::Error, fs, fs::File, - io, io::prelude::*, path::Path, process::{Command, Output}, @@ -25,12 +24,13 @@ use crate::{error::PeachWebError, utils::sbot}; // SBOT HELPER FUNCTIONS /// Executes a systemctl command for the go-sbot.service process. -pub fn systemctl_sbot_cmd(cmd: &str) -> io::Result { - Command::new("sudo") +pub fn systemctl_sbot_cmd(cmd: &str) -> Result { + let output = Command::new("sudo") .arg("systemctl") .arg(cmd) - .arg("go-sbot.service") - .output() + .arg(get_config_value("GO_SBOT_SERVICE")?) + .output()?; + Ok(output) } /// Executes a systemctl stop command followed by start command. From 3493e5adb9d0505478ec77d9b8de591745c6dbef Mon Sep 17 00:00:00 2001 From: notplants Date: Thu, 26 May 2022 23:17:20 +0200 Subject: [PATCH 09/22] Change sbot.rs to use configurable go-sbot service name --- peach-web/src/utils/sbot.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/peach-web/src/utils/sbot.rs b/peach-web/src/utils/sbot.rs index 8a8b34c..c0953e6 100644 --- a/peach-web/src/utils/sbot.rs +++ b/peach-web/src/utils/sbot.rs @@ -3,7 +3,6 @@ use std::{ error::Error, fs, fs::File, - io, io::prelude::*, path::Path, process::{Command, Output}, @@ -23,12 +22,13 @@ use crate::{error::PeachWebError, utils::sbot}; // SBOT HELPER FUNCTIONS /// Executes a systemctl command for the go-sbot.service process. -pub fn systemctl_sbot_cmd(cmd: &str) -> io::Result { - Command::new("sudo") +pub fn systemctl_sbot_cmd(cmd: &str) -> Result { + let output = Command::new("sudo") .arg("systemctl") .arg(cmd) - .arg("go-sbot.service") - .output() + .arg(get_config_value("GO_SBOT_SERVICE")?) + .output()?; + Ok(output) } /// Executes a systemctl stop command followed by start command. From 16e6d42f87539f96692729ea915371ab9f501877 Mon Sep 17 00:00:00 2001 From: notplants Date: Thu, 26 May 2022 23:19:31 +0200 Subject: [PATCH 10/22] Cargo clippy --- Cargo.lock | 2 +- peach-web/src/utils/sbot.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index b7aa8f0..4963ead 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1111,7 +1111,7 @@ dependencies = [ [[package]] name = "golgi" version = "0.1.1" -source = "git+https://git.coopcloud.tech/golgi-ssb/golgi#77dd75bcd4649b7487069a61e2a8069b49f60a1d" +source = "git+https://git.coopcloud.tech/golgi-ssb/golgi.git#77dd75bcd4649b7487069a61e2a8069b49f60a1d" dependencies = [ "async-std", "async-stream 0.3.3", diff --git a/peach-web/src/utils/sbot.rs b/peach-web/src/utils/sbot.rs index c0953e6..1a71489 100644 --- a/peach-web/src/utils/sbot.rs +++ b/peach-web/src/utils/sbot.rs @@ -13,6 +13,7 @@ use dirs; use futures::stream::TryStreamExt; 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; From f3d4ba9fe5781fac5b5821332297492debc63aa0 Mon Sep 17 00:00:00 2001 From: mycognosist Date: Tue, 14 Jun 2022 09:03:08 +0100 Subject: [PATCH 11/22] url-encode the ssb id for profile buttons --- peach-web/src/routes/scuttlebutt/profile.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/peach-web/src/routes/scuttlebutt/profile.rs b/peach-web/src/routes/scuttlebutt/profile.rs index feecdb7..43875ac 100644 --- a/peach-web/src/routes/scuttlebutt/profile.rs +++ b/peach-web/src/routes/scuttlebutt/profile.rs @@ -83,13 +83,15 @@ fn social_interaction_buttons_template(profile: &Profile) -> Markup { @match (profile.following, &profile.id) { (Some(false), Some(ssb_id)) => { form id="followForm" class="center" action="/scuttlebutt/follow" method="post" { - input type="hidden" id="publicKey" name="public_key" value=(ssb_id); + // url encode the ssb_id value + input type="hidden" id="publicKey" name="public_key" value=(ssb_id.replace('/', "%2F")); input id="followPeer" class="button button-primary center" type="submit" title="Follow Peer" value="Follow"; } }, (Some(true), Some(ssb_id)) => { form id="unfollowForm" class="center" action="/scuttlebutt/unfollow" method="post" { - input type="hidden" id="publicKey" name="public_key" value=(ssb_id); + // url encode the ssb_id value + input type="hidden" id="publicKey" name="public_key" value=(ssb_id.replace('/', "%2F")); input id="unfollowPeer" class="button button-primary center" type="submit" title="Unfollow Peer" value="Unfollow"; } }, @@ -98,13 +100,15 @@ fn social_interaction_buttons_template(profile: &Profile) -> Markup { @match (profile.blocking, &profile.id) { (Some(false), Some(ssb_id)) => { form id="blockForm" class="center" action="/scuttlebutt/block" method="post" { - input type="hidden" id="publicKey" name="public_key" value=(ssb_id); + // url encode the ssb_id value + input type="hidden" id="publicKey" name="public_key" value=(ssb_id.replace('/', "%2F")); input id="blockPeer" class="button button-primary center" type="submit" title="Block Peer" value="Block"; } }, (Some(true), Some(ssb_id)) => { form id="unblockForm" class="center" action="/scuttlebutt/unblock" method="post" { - input type="hidden" id="publicKey" name="public_key" value=(ssb_id); + // url encode the ssb_id value + input type="hidden" id="publicKey" name="public_key" value=(ssb_id.replace('/', "%2F")); input id="unblockPeer" class="button button-primary center" type="submit" title="Unblock Peer" value="Unblock"; } }, @@ -112,7 +116,8 @@ fn social_interaction_buttons_template(profile: &Profile) -> Markup { } @if let Some(ssb_id) = &profile.id { form class="center" { - a id="privateMessage" class="button button-primary center" href={ "/scuttlebutt/private/" (ssb_id) } title="Private Message" { + // url encode the ssb_id + a id="privateMessage" class="button button-primary center" href={ "/scuttlebutt/private/" (ssb_id.replace('/', "%2F")) } title="Private Message" { "Send Private Message" } } From 0923c246932f08d6cc50c04c806b1dddc79259c9 Mon Sep 17 00:00:00 2001 From: mycognosist Date: Tue, 14 Jun 2022 09:03:24 +0100 Subject: [PATCH 12/22] update lockfile --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 32c6254..90ce926 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1111,7 +1111,7 @@ dependencies = [ [[package]] name = "golgi" version = "0.1.1" -source = "git+https://git.coopcloud.tech/golgi-ssb/golgi#0aa616d92b005b38359aa34bf448f3f1f47e8e6a" +source = "git+https://git.coopcloud.tech/golgi-ssb/golgi.git#0aa616d92b005b38359aa34bf448f3f1f47e8e6a" dependencies = [ "async-std", "async-stream 0.3.3", From e1877b50242c0ae86f7b3aed555be5a06f88f03b Mon Sep 17 00:00:00 2001 From: glyph Date: Wed, 15 Jun 2022 08:46:16 +0100 Subject: [PATCH 13/22] fix link to set new password --- peach-web/src/routes/authentication/forgot.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peach-web/src/routes/authentication/forgot.rs b/peach-web/src/routes/authentication/forgot.rs index d61f90d..84ff7df 100644 --- a/peach-web/src/routes/authentication/forgot.rs +++ b/peach-web/src/routes/authentication/forgot.rs @@ -30,7 +30,7 @@ pub fn build_template(request: &Request) -> PreEscaped { form id="sendPasswordReset" action="/auth/temporary" method="post" { div id="buttonDiv" { input class="button button-primary center" style="margin-top: 1rem;" type="submit" value="Send Temporary Password" title="Send temporary password to Scuttlebutt admin(s)"; - a href="/auth/reset_password" class="button button-primary center" title="Set a new password using the temporary password" { + a href="/auth/reset" class="button button-primary center" title="Set a new password using the temporary password" { "Set New Password" } } From 8b0b872d21ff74b49d936441962f4eb0a9333dfe Mon Sep 17 00:00:00 2001 From: notplants Date: Wed, 15 Jun 2022 12:36:44 +0200 Subject: [PATCH 14/22] Reponse to CR --- Cargo.lock | 47 ++++++++++++++++++++++++++++++++++++++++--- peach-lib/src/sbot.rs | 12 +++++------ peach-web/Cargo.toml | 4 ++-- 3 files changed, 52 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b7aa8f0..c3b1af1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1120,7 +1120,26 @@ dependencies = [ "hex", "kuska-handshake", "kuska-sodiumoxide", - "kuska-ssb", + "kuska-ssb 0.4.0", + "serde 1.0.136", + "serde_json", + "sha2", +] + +[[package]] +name = "golgi" +version = "0.1.4" +source = "git+https://git.coopcloud.tech/golgi-ssb/golgi.git?branch=dev#6daddeab9e3d48713b2e29d2437535ad6cedb84d" +dependencies = [ + "async-std", + "async-stream 0.3.3", + "base64 0.13.0", + "futures 0.3.21", + "hex", + "kuska-handshake", + "kuska-sodiumoxide", + "kuska-ssb 0.4.1", + "log 0.4.16", "serde 1.0.136", "serde_json", "sha2", @@ -1726,6 +1745,28 @@ dependencies = [ "thiserror", ] +[[package]] +name = "kuska-ssb" +version = "0.4.1" +source = "git+https://github.com/mhfowler/kuska-ssb.git#48adac914fd2288abcc267560c5a3e013a072003" +dependencies = [ + "async-std", + "async-stream 0.2.1", + "base64 0.11.0", + "dirs 2.0.2", + "futures 0.3.21", + "get_if_addrs", + "hex", + "kuska-handshake", + "kuska-sodiumoxide", + "log 0.4.16", + "once_cell", + "regex", + "serde 1.0.136", + "serde_json", + "thiserror", +] + [[package]] name = "kv-log-macro" version = "1.0.7" @@ -2431,7 +2472,7 @@ dependencies = [ "chrono", "dirs 4.0.0", "fslock", - "golgi", + "golgi 0.1.1", "jsonrpc-client-core", "jsonrpc-client-http", "jsonrpc-core 8.0.1", @@ -2525,7 +2566,7 @@ dependencies = [ "dirs 4.0.0", "env_logger 0.8.4", "futures 0.3.21", - "golgi", + "golgi 0.1.4", "lazy_static", "log 0.4.16", "maud", diff --git a/peach-lib/src/sbot.rs b/peach-lib/src/sbot.rs index 4fffc5c..35f869f 100644 --- a/peach-lib/src/sbot.rs +++ b/peach-lib/src/sbot.rs @@ -2,7 +2,7 @@ use std::{fs, fs::File, io, io::Write, path::PathBuf, process::Command, str}; -use crate::config_manager::get_config_value; +use crate::config_manager; use serde::{Deserialize, Serialize}; use crate::error::PeachError; @@ -67,7 +67,7 @@ impl SbotStatus { // because non-privileged users are able to run systemctl show let info_output = Command::new("systemctl") .arg("show") - .arg(get_config_value("GO_SBOT_SERVICE")?) + .arg(config_manager::get_config_value("GO_SBOT_SERVICE")?) .arg("--no-page") .output()?; @@ -89,7 +89,7 @@ impl SbotStatus { // because non-privileged users are able to run systemctl status let status_output = Command::new("systemctl") .arg("status") - .arg(get_config_value("GO_SBOT_SERVICE")?) + .arg(config_manager::get_config_value("GO_SBOT_SERVICE")?) .output()?; let service_status = str::from_utf8(&status_output.stdout)?; @@ -128,7 +128,7 @@ impl SbotStatus { } // get path to blobstore - let blobstore_path = format!("{}/blobs/sha256", get_config_value("GO_SBOT_DATADIR")?); + let blobstore_path = format!("{}/blobs/sha256", config_manager::get_config_value("GO_SBOT_DATADIR")?); // determine the size of the blobstore directory in bytes status.blobstore = dir_size(blobstore_path).ok(); @@ -200,7 +200,7 @@ impl SbotConfig { /// Read the go-sbot `config.toml` file from file and deserialize into `SbotConfig`. pub fn read() -> Result { // determine path of user's go-sbot config.toml - let config_path = format!("{}/config.toml", get_config_value("GO_SBOT_DATADIR")?); + let config_path = format!("{}/config.toml", config_manager::get_config_value("GO_SBOT_DATADIR")?); let config_contents = fs::read_to_string(config_path)?; @@ -217,7 +217,7 @@ impl SbotConfig { let config_string = toml::to_string(&config)?; // determine path of user's go-sbot config.toml - let config_path = format!("{}/config.toml", get_config_value("GO_SBOT_DATADIR")?); + let config_path = format!("{}/config.toml", config_manager::get_config_value("GO_SBOT_DATADIR")?); // open config file for writing let mut file = File::create(config_path)?; diff --git a/peach-web/Cargo.toml b/peach-web/Cargo.toml index 239588f..053bfbb 100644 --- a/peach-web/Cargo.toml +++ b/peach-web/Cargo.toml @@ -39,8 +39,8 @@ 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" } +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" maud = "0.23" From a81b8b42cfae47e1c7c7efa34c3242ac9b432c2c Mon Sep 17 00:00:00 2001 From: notplants Date: Wed, 15 Jun 2022 12:48:51 +0200 Subject: [PATCH 15/22] Use main golgi branch --- Cargo.lock | 47 +++----------------------------------------- peach-web/Cargo.toml | 3 +-- 2 files changed, 4 insertions(+), 46 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 86aa685..f741d7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1120,26 +1120,7 @@ dependencies = [ "hex", "kuska-handshake", "kuska-sodiumoxide", - "kuska-ssb 0.4.0", - "serde 1.0.137", - "serde_json", - "sha2", -] - -[[package]] -name = "golgi" -version = "0.1.4" -source = "git+https://git.coopcloud.tech/golgi-ssb/golgi.git?branch=dev#51dc82280af418f47bb2a80fb7c1dd3e43f9b051" -dependencies = [ - "async-std", - "async-stream 0.3.3", - "base64 0.13.0", - "futures 0.3.21", - "hex", - "kuska-handshake", - "kuska-sodiumoxide", - "kuska-ssb 0.4.1", - "log 0.4.17", + "kuska-ssb", "serde 1.0.137", "serde_json", "sha2", @@ -1745,28 +1726,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "kuska-ssb" -version = "0.4.1" -source = "git+https://github.com/mhfowler/kuska-ssb.git#48adac914fd2288abcc267560c5a3e013a072003" -dependencies = [ - "async-std", - "async-stream 0.2.1", - "base64 0.11.0", - "dirs 2.0.2", - "futures 0.3.21", - "get_if_addrs", - "hex", - "kuska-handshake", - "kuska-sodiumoxide", - "log 0.4.17", - "once_cell", - "regex", - "serde 1.0.137", - "serde_json", - "thiserror", -] - [[package]] name = "kv-log-macro" version = "1.0.7" @@ -2440,7 +2399,7 @@ dependencies = [ "chrono", "dirs 4.0.0", "fslock", - "golgi 0.1.1", + "golgi", "jsonrpc-client-core", "jsonrpc-client-http", "jsonrpc-core 8.0.1", @@ -2534,7 +2493,7 @@ dependencies = [ "dirs 4.0.0", "env_logger 0.8.4", "futures 0.3.21", - "golgi 0.1.4", + "golgi", "lazy_static", "log 0.4.17", "maud", diff --git a/peach-web/Cargo.toml b/peach-web/Cargo.toml index 053bfbb..94a7160 100644 --- a/peach-web/Cargo.toml +++ b/peach-web/Cargo.toml @@ -39,8 +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" } +golgi = { git = "https://git.coopcloud.tech/golgi-ssb/golgi.git" } lazy_static = "1.4" log = "0.4" maud = "0.23" From 9c6fa00ec7288fceab04930546f67b1e88cc5958 Mon Sep 17 00:00:00 2001 From: notplants Date: Wed, 15 Jun 2022 13:33:56 +0200 Subject: [PATCH 16/22] Fix cargo.lock --- Cargo.lock | 218 +++---------------------------------------- Cargo.toml | 3 +- peach-web/Cargo.toml | 5 +- 3 files changed, 16 insertions(+), 210 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f741d7e..2986338 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -563,7 +563,7 @@ dependencies = [ "lazy_static", "maybe-uninit", "memoffset", - "scopeguard 1.1.0", + "scopeguard", ] [[package]] @@ -787,28 +787,6 @@ version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", - "synstructure", -] - [[package]] name = "fake-simd" version = "0.1.2" @@ -1110,8 +1088,8 @@ dependencies = [ [[package]] name = "golgi" -version = "0.1.1" -source = "git+https://git.coopcloud.tech/golgi-ssb/golgi#0aa616d92b005b38359aa34bf448f3f1f47e8e6a" +version = "0.1.4" +source = "git+https://git.coopcloud.tech/golgi-ssb/golgi.git#ca4c1114ddf328b818144c5a1af0187b1357e9be" dependencies = [ "async-std", "async-stream 0.3.3", @@ -1121,23 +1099,12 @@ dependencies = [ "kuska-handshake", "kuska-sodiumoxide", "kuska-ssb", + "log 0.4.17", "serde 1.0.137", "serde_json", "sha2", ] -[[package]] -name = "gpio-cdev" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04d50743080fbae298c55f0b28dd5ea4b513c53cddeddace6cbdd31db7dda981" -dependencies = [ - "bitflags 1.3.2", - "error-chain", - "libc", - "nix 0.11.1", -] - [[package]] name = "h2" version = "0.1.26" @@ -1458,7 +1425,7 @@ dependencies = [ "derive_more", "futures 0.3.21", "jsonrpc-core 18.0.0", - "jsonrpc-pubsub 18.0.0", + "jsonrpc-pubsub", "log 0.4.17", "serde 1.0.137", "serde_json", @@ -1506,20 +1473,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "jsonrpc-core-client" -version = "11.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c889ca27072f038496a62f38356e8f827acf194d7276030120265362b2974eab" -dependencies = [ - "failure", - "futures 0.1.31", - "jsonrpc-core 11.0.0", - "log 0.4.17", - "serde 1.0.137", - "serde_json", -] - [[package]] name = "jsonrpc-core-client" version = "18.0.0" @@ -1560,18 +1513,6 @@ dependencies = [ "unicase", ] -[[package]] -name = "jsonrpc-pubsub" -version = "11.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c233c4570183a45f7bde14cd7d23446d6c236de6df9442e53a60951adae9fd34" -dependencies = [ - "jsonrpc-core 11.0.0", - "log 0.4.17", - "parking_lot 0.7.1", - "serde 1.0.137", -] - [[package]] name = "jsonrpc-pubsub" version = "18.0.0" @@ -1622,20 +1563,6 @@ dependencies = [ "unicase", ] -[[package]] -name = "jsonrpc-test" -version = "11.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aedad254cd8faba2bf8d1fe00c52fe9d9944f1a8c3f789916b68a61a3414c87" -dependencies = [ - "jsonrpc-core 11.0.0", - "jsonrpc-core-client 11.0.0", - "jsonrpc-pubsub 11.0.0", - "log 0.4.17", - "serde 1.0.137", - "serde_json", -] - [[package]] name = "jsonrpc-test" version = "18.0.0" @@ -1643,27 +1570,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4347ecf335735719f555eff3f119e198049ddb22eec4d60dd7b4d63a3b10a6" dependencies = [ "jsonrpc-core 18.0.0", - "jsonrpc-core-client 18.0.0", - "jsonrpc-pubsub 18.0.0", + "jsonrpc-core-client", + "jsonrpc-pubsub", "log 0.4.17", "serde 1.0.137", "serde_json", ] -[[package]] -name = "jsonrpc-ws-server" -version = "11.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e72d8f524c7afd11d9c71614d1f814ee1c46377869933ce42d559d6973922f79" -dependencies = [ - "jsonrpc-core 11.0.0", - "jsonrpc-server-utils 11.0.0", - "log 0.4.17", - "parking_lot 0.7.1", - "slab 0.4.6", - "ws", -] - [[package]] name = "keccak" version = "0.1.0" @@ -1706,8 +1619,8 @@ dependencies = [ [[package]] name = "kuska-ssb" -version = "0.4.0" -source = "git+https://github.com/Kuska-ssb/ssb#fb7062de606e7c9cae8dd4df402a122db46c1b77" +version = "0.4.1" +source = "git+https://github.com/Kuska-ssb/ssb#6b0457a8ddd0e86a8f84cffac2b5cb835723822f" dependencies = [ "async-std", "async-stream 0.2.1", @@ -1800,23 +1713,13 @@ dependencies = [ "sysfs_gpio", ] -[[package]] -name = "lock_api" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" -dependencies = [ - "owning_ref", - "scopeguard 0.3.3", -] - [[package]] name = "lock_api" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" dependencies = [ - "scopeguard 1.1.0", + "scopeguard", ] [[package]] @@ -1826,7 +1729,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" dependencies = [ "autocfg 1.1.0", - "scopeguard 1.1.0", + "scopeguard", ] [[package]] @@ -2248,31 +2151,12 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" -[[package]] -name = "owning_ref" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" -dependencies = [ - "stable_deref_trait", -] - [[package]] name = "parking" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" -[[package]] -name = "parking_lot" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" -dependencies = [ - "lock_api 0.1.5", - "parking_lot_core 0.4.0", -] - [[package]] name = "parking_lot" version = "0.9.0" @@ -2295,19 +2179,6 @@ dependencies = [ "parking_lot_core 0.8.5", ] -[[package]] -name = "parking_lot_core" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" -dependencies = [ - "libc", - "rand 0.6.5", - "rustc_version 0.2.3", - "smallvec 0.6.14", - "winapi 0.3.9", -] - [[package]] name = "parking_lot_core" version = "0.6.2" @@ -2337,21 +2208,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "peach-buttons" -version = "0.1.3" -dependencies = [ - "crossbeam-channel", - "env_logger 0.6.2", - "gpio-cdev", - "jsonrpc-core 11.0.0", - "jsonrpc-pubsub 11.0.0", - "jsonrpc-test 11.0.0", - "jsonrpc-ws-server", - "log 0.4.17", - "snafu 0.4.4", -] - [[package]] name = "peach-config" version = "0.1.25" @@ -2385,7 +2241,7 @@ dependencies = [ "env_logger 0.9.0", "jsonrpc-core 18.0.0", "jsonrpc-http-server 18.0.0", - "jsonrpc-test 18.0.0", + "jsonrpc-test", "log 0.4.17", "peach-stats", "serde_json", @@ -2463,7 +2319,7 @@ dependencies = [ "env_logger 0.9.0", "jsonrpc-core 18.0.0", "jsonrpc-http-server 18.0.0", - "jsonrpc-test 18.0.0", + "jsonrpc-test", "linux-embedded-hal", "log 0.4.17", "nix 0.11.1", @@ -2485,7 +2341,7 @@ dependencies = [ [[package]] name = "peach-web" -version = "0.6.15" +version = "0.6.13" dependencies = [ "async-std", "base64 0.13.0", @@ -3007,12 +2863,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" -[[package]] -name = "scopeguard" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" - [[package]] name = "scopeguard" version = "1.1.0" @@ -3228,17 +3078,6 @@ dependencies = [ "snafu-derive 0.2.3", ] -[[package]] -name = "snafu" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b028158eb06caa8345bee10cccfb25fa632beccf0ef5308832b4fd4b78a7db48" -dependencies = [ - "backtrace", - "doc-comment", - "snafu-derive 0.4.4", -] - [[package]] name = "snafu" version = "0.6.10" @@ -3260,17 +3099,6 @@ dependencies = [ "syn 0.15.44", ] -[[package]] -name = "snafu-derive" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf50aaef500c248a590e2696e8bf8c7620ca2235b9bb90a70363d82dd1abec6a" -dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", -] - [[package]] name = "snafu-derive" version = "0.6.10" @@ -3313,12 +3141,6 @@ dependencies = [ "embedded-hal", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "string" version = "0.2.1" @@ -3380,18 +3202,6 @@ dependencies = [ "unicode-xid 0.2.3", ] -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2 1.0.38", - "quote 1.0.18", - "syn 1.0.94", - "unicode-xid 0.2.3", -] - [[package]] name = "sysfs_gpio" version = "0.5.4" diff --git a/Cargo.toml b/Cargo.toml index 25471e2..0317b43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,5 @@ [workspace] - members = [ - "peach-buttons", "peach-oled", "peach-lib", "peach-config", @@ -13,3 +11,4 @@ members = [ "peach-jsonrpc-server", "peach-dyndns-updater" ] + diff --git a/peach-web/Cargo.toml b/peach-web/Cargo.toml index 94a7160..4e791fe 100644 --- a/peach-web/Cargo.toml +++ b/peach-web/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "peach-web" -version = "0.6.15" +version = "0.6.13" authors = ["Andrew Reid "] edition = "2018" description = "peach-web is a web application which provides a web interface for monitoring and interacting with the PeachCloud device. This allows administration of the single-board computer (ie. Raspberry Pi) running PeachCloud, as well as the ssb-server and related plugins." @@ -9,7 +9,6 @@ repository = "https://github.com/peachcloud/peach-web" readme = "README.md" license = "AGPL-3.0-only" publish = false - [package.metadata.deb] depends = "apache2-utils" extended-description = """\ @@ -27,11 +26,9 @@ assets = [ ["static/images/*", "/usr/share/peach-web/static/images/", "644"], ["README.md", "/usr/share/doc/peach-web/README", "644"], ] - [badges] travis-ci = { repository = "peachcloud/peach-web", branch = "master" } maintenance = { status = "actively-developed" } - [dependencies] async-std = "1.10" base64 = "0.13" From 5838faf12845e6b1b102841b9992befa7c38934e Mon Sep 17 00:00:00 2001 From: notplants Date: Wed, 15 Jun 2022 13:37:36 +0200 Subject: [PATCH 17/22] Cargo fmt --- Cargo.lock | 2 +- peach-config/src/set_permissions.rs | 8 ++++---- peach-web/src/utils/sbot.rs | 9 ++++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2986338..c1ad90f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1089,7 +1089,7 @@ dependencies = [ [[package]] name = "golgi" version = "0.1.4" -source = "git+https://git.coopcloud.tech/golgi-ssb/golgi.git#ca4c1114ddf328b818144c5a1af0187b1357e9be" +source = "git+https://git.coopcloud.tech/golgi-ssb/golgi#ca4c1114ddf328b818144c5a1af0187b1357e9be" dependencies = [ "async-std", "async-stream 0.3.3", diff --git a/peach-config/src/set_permissions.rs b/peach-config/src/set_permissions.rs index 355e24f..0ad2ac8 100644 --- a/peach-config/src/set_permissions.rs +++ b/peach-config/src/set_permissions.rs @@ -1,17 +1,17 @@ use lazy_static::lazy_static; -use peach_lib::config_manager::get_config_value; +use peach_lib::config_manager; use crate::error::PeachConfigError; use crate::utils::cmd; lazy_static! { - pub static ref PEACH_CONFIGDIR: String = get_config_value("PEACH_CONFIGDIR") + pub static ref PEACH_CONFIGDIR: String = config_manager::get_config_value("PEACH_CONFIGDIR") .expect("Failed to load config value for PEACH_CONFIGDIR"); pub static ref PEACH_WEBDIR: String = - get_config_value("PEACH_WEBDIR").expect("Failed to load config value for PEACH_WEBDIR"); + config_manager::get_config_value("PEACH_WEBDIR").expect("Failed to load config value for PEACH_WEBDIR"); pub static ref PEACH_HOMEDIR: String = - get_config_value("PEACH_HOMEDIR").expect("Failed to load config value for PEACH_HOMEDIR"); + config_manager::get_config_value("PEACH_HOMEDIR").expect("Failed to load config value for PEACH_HOMEDIR"); } /// Utility function to set correct file permissions on the PeachCloud device. diff --git a/peach-web/src/utils/sbot.rs b/peach-web/src/utils/sbot.rs index 65a4ebd..98ab413 100644 --- a/peach-web/src/utils/sbot.rs +++ b/peach-web/src/utils/sbot.rs @@ -15,7 +15,7 @@ use golgi::{ api::friends::RelationshipQuery, blobs, messages::SsbMessageValue, sbot::Keystore, Sbot, }; use log::debug; -use peach_lib::config_manager::get_config_value; +use peach_lib::config_manager; use peach_lib::sbot::SbotConfig; use rouille::input::post::BufferedFile; use temporary::Directory; @@ -29,7 +29,7 @@ pub fn systemctl_sbot_cmd(cmd: &str) -> Result { let output = Command::new("sudo") .arg("systemctl") .arg(cmd) - .arg(get_config_value("GO_SBOT_SERVICE")?) + .arg(config_manager::get_config_value("GO_SBOT_SERVICE")?) .output()?; Ok(output) } @@ -69,7 +69,10 @@ 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 key_path = format!( + "{}/secret", + config_manager::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) => { From 87ad2439b9913cf1ad124c37b2a25ca92e7e0782 Mon Sep 17 00:00:00 2001 From: notplants Date: Wed, 15 Jun 2022 13:46:51 +0200 Subject: [PATCH 18/22] Fix cargo fmt --- peach-config/src/set_permissions.rs | 8 ++++---- peach-lib/src/sbot.rs | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/peach-config/src/set_permissions.rs b/peach-config/src/set_permissions.rs index 0ad2ac8..c50ffd0 100644 --- a/peach-config/src/set_permissions.rs +++ b/peach-config/src/set_permissions.rs @@ -8,10 +8,10 @@ use crate::utils::cmd; lazy_static! { pub static ref PEACH_CONFIGDIR: String = config_manager::get_config_value("PEACH_CONFIGDIR") .expect("Failed to load config value for PEACH_CONFIGDIR"); - pub static ref PEACH_WEBDIR: String = - config_manager::get_config_value("PEACH_WEBDIR").expect("Failed to load config value for PEACH_WEBDIR"); - pub static ref PEACH_HOMEDIR: String = - config_manager::get_config_value("PEACH_HOMEDIR").expect("Failed to load config value for PEACH_HOMEDIR"); + pub static ref PEACH_WEBDIR: String = config_manager::get_config_value("PEACH_WEBDIR") + .expect("Failed to load config value for PEACH_WEBDIR"); + pub static ref PEACH_HOMEDIR: String = config_manager::get_config_value("PEACH_HOMEDIR") + .expect("Failed to load config value for PEACH_HOMEDIR"); } /// Utility function to set correct file permissions on the PeachCloud device. diff --git a/peach-lib/src/sbot.rs b/peach-lib/src/sbot.rs index 35f869f..e2ddba7 100644 --- a/peach-lib/src/sbot.rs +++ b/peach-lib/src/sbot.rs @@ -128,7 +128,10 @@ impl SbotStatus { } // get path to blobstore - let blobstore_path = format!("{}/blobs/sha256", config_manager::get_config_value("GO_SBOT_DATADIR")?); + let blobstore_path = format!( + "{}/blobs/sha256", + config_manager::get_config_value("GO_SBOT_DATADIR")? + ); // determine the size of the blobstore directory in bytes status.blobstore = dir_size(blobstore_path).ok(); @@ -200,7 +203,10 @@ impl SbotConfig { /// Read the go-sbot `config.toml` file from file and deserialize into `SbotConfig`. pub fn read() -> Result { // determine path of user's go-sbot config.toml - let config_path = format!("{}/config.toml", config_manager::get_config_value("GO_SBOT_DATADIR")?); + let config_path = format!( + "{}/config.toml", + config_manager::get_config_value("GO_SBOT_DATADIR")? + ); let config_contents = fs::read_to_string(config_path)?; @@ -217,7 +223,10 @@ impl SbotConfig { let config_string = toml::to_string(&config)?; // determine path of user's go-sbot config.toml - let config_path = format!("{}/config.toml", config_manager::get_config_value("GO_SBOT_DATADIR")?); + let config_path = format!( + "{}/config.toml", + config_manager::get_config_value("GO_SBOT_DATADIR")? + ); // open config file for writing let mut file = File::create(config_path)?; From 1b43dc8b189d2c30ff735a712f10d15434954a5b Mon Sep 17 00:00:00 2001 From: glyph Date: Thu, 16 Jun 2022 09:18:38 +0100 Subject: [PATCH 19/22] bump patch version --- peach-web/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peach-web/Cargo.toml b/peach-web/Cargo.toml index 11d345b..be35863 100644 --- a/peach-web/Cargo.toml +++ b/peach-web/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "peach-web" -version = "0.6.13" +version = "0.6.14" authors = ["Andrew Reid "] edition = "2018" description = "peach-web is a web application which provides a web interface for monitoring and interacting with the PeachCloud device. This allows administration of the single-board computer (ie. Raspberry Pi) running PeachCloud, as well as the ssb-server and related plugins." From cddcb8f9bd4cf885f167193377395a64de14328d Mon Sep 17 00:00:00 2001 From: glyph Date: Thu, 16 Jun 2022 09:19:59 +0100 Subject: [PATCH 20/22] fix spacing in manifest --- peach-web/Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/peach-web/Cargo.toml b/peach-web/Cargo.toml index 9efc691..be35863 100644 --- a/peach-web/Cargo.toml +++ b/peach-web/Cargo.toml @@ -9,6 +9,7 @@ repository = "https://github.com/peachcloud/peach-web" readme = "README.md" license = "AGPL-3.0-only" publish = false + [package.metadata.deb] depends = "apache2-utils" extended-description = """\ @@ -26,9 +27,11 @@ assets = [ ["static/images/*", "/usr/share/peach-web/static/images/", "644"], ["README.md", "/usr/share/doc/peach-web/README", "644"], ] + [badges] travis-ci = { repository = "peachcloud/peach-web", branch = "master" } maintenance = { status = "actively-developed" } + [dependencies] async-std = "1.10" base64 = "0.13" From 216b60b86a9b35192a9ec8ce91ceb203f95922b9 Mon Sep 17 00:00:00 2001 From: glyph Date: Thu, 16 Jun 2022 11:07:44 +0100 Subject: [PATCH 21/22] bump version in manifest --- peach-web/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peach-web/Cargo.toml b/peach-web/Cargo.toml index 11d345b..94a7160 100644 --- a/peach-web/Cargo.toml +++ b/peach-web/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "peach-web" -version = "0.6.13" +version = "0.6.15" authors = ["Andrew Reid "] edition = "2018" description = "peach-web is a web application which provides a web interface for monitoring and interacting with the PeachCloud device. This allows administration of the single-board computer (ie. Raspberry Pi) running PeachCloud, as well as the ssb-server and related plugins." From 76d5e6a35573b8fb74c8f93283a042058da37c0c Mon Sep 17 00:00:00 2001 From: glyph Date: Thu, 16 Jun 2022 11:19:04 +0100 Subject: [PATCH 22/22] fix probes version --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d91633a..505c83a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1079,7 +1079,7 @@ dependencies = [ [[package]] name = "golgi" version = "0.1.4" -source = "git+https://git.coopcloud.tech/golgi-ssb/golgi.git#ca4c1114ddf328b818144c5a1af0187b1357e9be" +source = "git+https://git.coopcloud.tech/golgi-ssb/golgi#ca4c1114ddf328b818144c5a1af0187b1357e9be" dependencies = [ "async-std", "async-stream 0.3.3", @@ -2405,7 +2405,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f77e66f6d6d898cbbd4a09c48fd3507cfc210b7c83055de02a38b5f7a1e6d216" dependencies = [ "libc", - "time 0.3.9", + "time 0.1.44", ] [[package]]