Reponse to CR

This commit is contained in:
notplants 2022-06-15 12:36:44 +02:00
parent 5147eed497
commit 8b0b872d21
3 changed files with 52 additions and 11 deletions

47
Cargo.lock generated
View File

@ -1120,7 +1120,26 @@ dependencies = [
"hex", "hex",
"kuska-handshake", "kuska-handshake",
"kuska-sodiumoxide", "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 1.0.136",
"serde_json", "serde_json",
"sha2", "sha2",
@ -1726,6 +1745,28 @@ dependencies = [
"thiserror", "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]] [[package]]
name = "kv-log-macro" name = "kv-log-macro"
version = "1.0.7" version = "1.0.7"
@ -2431,7 +2472,7 @@ dependencies = [
"chrono", "chrono",
"dirs 4.0.0", "dirs 4.0.0",
"fslock", "fslock",
"golgi", "golgi 0.1.1",
"jsonrpc-client-core", "jsonrpc-client-core",
"jsonrpc-client-http", "jsonrpc-client-http",
"jsonrpc-core 8.0.1", "jsonrpc-core 8.0.1",
@ -2525,7 +2566,7 @@ dependencies = [
"dirs 4.0.0", "dirs 4.0.0",
"env_logger 0.8.4", "env_logger 0.8.4",
"futures 0.3.21", "futures 0.3.21",
"golgi", "golgi 0.1.4",
"lazy_static", "lazy_static",
"log 0.4.16", "log 0.4.16",
"maud", "maud",

View File

@ -2,7 +2,7 @@
use std::{fs, fs::File, io, io::Write, path::PathBuf, process::Command, str}; 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 serde::{Deserialize, Serialize};
use crate::error::PeachError; use crate::error::PeachError;
@ -67,7 +67,7 @@ impl SbotStatus {
// because non-privileged users are able to run systemctl show // because non-privileged users are able to run systemctl show
let info_output = Command::new("systemctl") let info_output = Command::new("systemctl")
.arg("show") .arg("show")
.arg(get_config_value("GO_SBOT_SERVICE")?) .arg(config_manager::get_config_value("GO_SBOT_SERVICE")?)
.arg("--no-page") .arg("--no-page")
.output()?; .output()?;
@ -89,7 +89,7 @@ impl SbotStatus {
// because non-privileged users are able to run systemctl status // because non-privileged users are able to run systemctl status
let status_output = Command::new("systemctl") let status_output = Command::new("systemctl")
.arg("status") .arg("status")
.arg(get_config_value("GO_SBOT_SERVICE")?) .arg(config_manager::get_config_value("GO_SBOT_SERVICE")?)
.output()?; .output()?;
let service_status = str::from_utf8(&status_output.stdout)?; let service_status = str::from_utf8(&status_output.stdout)?;
@ -128,7 +128,7 @@ impl SbotStatus {
} }
// get path to blobstore // 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 // determine the size of the blobstore directory in bytes
status.blobstore = dir_size(blobstore_path).ok(); 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`. /// Read the go-sbot `config.toml` file from file and deserialize into `SbotConfig`.
pub fn read() -> Result<Self, PeachError> { pub fn read() -> Result<Self, PeachError> {
// determine path of user's go-sbot 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_path = format!("{}/config.toml", config_manager::get_config_value("GO_SBOT_DATADIR")?);
let config_contents = fs::read_to_string(config_path)?; let config_contents = fs::read_to_string(config_path)?;
@ -217,7 +217,7 @@ impl SbotConfig {
let config_string = toml::to_string(&config)?; let config_string = toml::to_string(&config)?;
// determine path of user's go-sbot 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_path = format!("{}/config.toml", config_manager::get_config_value("GO_SBOT_DATADIR")?);
// open config file for writing // open config file for writing
let mut file = File::create(config_path)?; let mut file = File::create(config_path)?;

View File

@ -39,8 +39,8 @@ chrono = "0.4"
dirs = "4.0" dirs = "4.0"
env_logger = "0.8" env_logger = "0.8"
futures = "0.3" 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", 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" lazy_static = "1.4"
log = "0.4" log = "0.4"
maud = "0.23" maud = "0.23"