reintroduce logging statements
This commit is contained in:
parent
d9019d6a4b
commit
979ec4eb64
|
@ -208,13 +208,9 @@ pub fn handle_form(request: &Request, restart: bool) -> Response {
|
||||||
repair: bool,
|
repair: bool,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
debug!("ip: {} port: {}", data.lis_ip, data.lis_port);
|
|
||||||
|
|
||||||
// concat the ip and port for listen address
|
// concat the ip and port for listen address
|
||||||
let lis = format!("{}:{}", data.lis_ip, data.lis_port);
|
let lis = format!("{}:{}", data.lis_ip, data.lis_port);
|
||||||
|
|
||||||
debug!("{}", lis);
|
|
||||||
|
|
||||||
// instantiate `SbotConfig` from form data
|
// instantiate `SbotConfig` from form data
|
||||||
let config = SbotConfig {
|
let config = SbotConfig {
|
||||||
lis,
|
lis,
|
||||||
|
@ -235,14 +231,13 @@ pub fn handle_form(request: &Request, restart: bool) -> Response {
|
||||||
|
|
||||||
match data.startup {
|
match data.startup {
|
||||||
true => {
|
true => {
|
||||||
// TODO: rouille - log integration
|
debug!("Enabling go-sbot.service");
|
||||||
//info!("Enabling go-sbot.service");
|
|
||||||
if let Err(e) = sbot::systemctl_sbot_cmd("enable") {
|
if let Err(e) = sbot::systemctl_sbot_cmd("enable") {
|
||||||
warn!("Failed to enable go-sbot.service: {}", e)
|
warn!("Failed to enable go-sbot.service: {}", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
false => {
|
false => {
|
||||||
// TODO: info!("Disabling go-sbot.service");
|
debug!("Disabling go-sbot.service");
|
||||||
if let Err(e) = sbot::systemctl_sbot_cmd("disable") {
|
if let Err(e) = sbot::systemctl_sbot_cmd("disable") {
|
||||||
warn!("Failed to disable go-sbot.service: {}", e)
|
warn!("Failed to disable go-sbot.service: {}", e)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ use async_std::task;
|
||||||
use dirs;
|
use dirs;
|
||||||
use futures::stream::TryStreamExt;
|
use futures::stream::TryStreamExt;
|
||||||
use golgi::{api::friends::RelationshipQuery, blobs, messages::SsbMessageValue, Sbot};
|
use golgi::{api::friends::RelationshipQuery, blobs, messages::SsbMessageValue, Sbot};
|
||||||
|
use log::debug;
|
||||||
use peach_lib::sbot::SbotConfig;
|
use peach_lib::sbot::SbotConfig;
|
||||||
use rouille::input::post::BufferedFile;
|
use rouille::input::post::BufferedFile;
|
||||||
use temporary::Directory;
|
use temporary::Directory;
|
||||||
|
@ -33,7 +34,7 @@ pub fn systemctl_sbot_cmd(cmd: &str) -> io::Result<Output> {
|
||||||
/// Executes a systemctl stop command followed by start command.
|
/// Executes a systemctl stop command followed by start command.
|
||||||
/// Returns a redirect with a flash message stating the output of the restart attempt.
|
/// Returns a redirect with a flash message stating the output of the restart attempt.
|
||||||
pub fn restart_sbot_process() -> (String, String) {
|
pub fn restart_sbot_process() -> (String, String) {
|
||||||
// TODO: info!("Restarting go-sbot.service");
|
debug!("Restarting go-sbot.service");
|
||||||
match systemctl_sbot_cmd("stop") {
|
match systemctl_sbot_cmd("stop") {
|
||||||
// if stop was successful, try to start the process
|
// if stop was successful, try to start the process
|
||||||
Ok(_) => match systemctl_sbot_cmd("start") {
|
Ok(_) => match systemctl_sbot_cmd("start") {
|
||||||
|
@ -63,6 +64,7 @@ pub fn restart_sbot_process() -> (String, String) {
|
||||||
pub async fn init_sbot_with_config(
|
pub async fn init_sbot_with_config(
|
||||||
sbot_config: &Option<SbotConfig>,
|
sbot_config: &Option<SbotConfig>,
|
||||||
) -> Result<Sbot, PeachWebError> {
|
) -> Result<Sbot, PeachWebError> {
|
||||||
|
debug!("Initialising an sbot client with configuration parameters");
|
||||||
// initialise sbot connection with ip:port and shscap from config file
|
// initialise sbot connection with ip:port and shscap from config file
|
||||||
let sbot_client = match sbot_config {
|
let sbot_client = match sbot_config {
|
||||||
// TODO: panics if we pass `Some(conf.shscap)` as second arg
|
// TODO: panics if we pass `Some(conf.shscap)` as second arg
|
||||||
|
@ -143,7 +145,7 @@ pub fn create_invite(uses: u16) -> Result<String, Box<dyn Error>> {
|
||||||
task::block_on(async {
|
task::block_on(async {
|
||||||
let mut sbot_client = init_sbot_with_config(&sbot_config).await?;
|
let mut sbot_client = init_sbot_with_config(&sbot_config).await?;
|
||||||
|
|
||||||
//TODO: debug!("Generating Scuttlebutt invite code");
|
debug!("Generating Scuttlebutt invite code");
|
||||||
let invite_code = sbot_client.invite_create(uses).await?;
|
let invite_code = sbot_client.invite_create(uses).await?;
|
||||||
|
|
||||||
Ok(invite_code)
|
Ok(invite_code)
|
||||||
|
@ -300,7 +302,7 @@ pub fn update_profile_info(
|
||||||
if let Some(name) = new_name {
|
if let Some(name) = new_name {
|
||||||
// only update the name if it has changed
|
// only update the name if it has changed
|
||||||
if name != current_name {
|
if name != current_name {
|
||||||
// TODO: debug!("Publishing new Scuttlebutt profile name");
|
debug!("Publishing a new Scuttlebutt profile name");
|
||||||
if let Err(e) = sbot_client.publish_name(&name).await {
|
if let Err(e) = sbot_client.publish_name(&name).await {
|
||||||
return Err(format!("Failed to update name: {}", e));
|
return Err(format!("Failed to update name: {}", e));
|
||||||
} else {
|
} else {
|
||||||
|
@ -312,7 +314,7 @@ pub fn update_profile_info(
|
||||||
if let Some(description) = new_description {
|
if let Some(description) = new_description {
|
||||||
// only update the description if it has changed
|
// only update the description if it has changed
|
||||||
if description != current_description {
|
if description != current_description {
|
||||||
//debug!("Publishing new Scuttlebutt profile description");
|
debug!("Publishing a new Scuttlebutt profile description");
|
||||||
if let Err(e) = sbot_client.publish_description(&description).await {
|
if let Err(e) = sbot_client.publish_description(&description).await {
|
||||||
return Err(format!("Failed to update description: {}", e));
|
return Err(format!("Failed to update description: {}", e));
|
||||||
} else {
|
} else {
|
||||||
|
@ -521,7 +523,7 @@ pub fn publish_public_post(text: String) -> Result<String, String> {
|
||||||
.await
|
.await
|
||||||
.map_err(|e| e.to_string())?;
|
.map_err(|e| e.to_string())?;
|
||||||
|
|
||||||
// TODO: debug!("Publishing new Scuttlebutt public post");
|
debug!("Publishing a new Scuttlebutt public post");
|
||||||
match sbot_client.publish_post(&text).await {
|
match sbot_client.publish_post(&text).await {
|
||||||
Ok(_) => Ok("Published post".to_string()),
|
Ok(_) => Ok("Published post".to_string()),
|
||||||
Err(e) => Err(format!("Failed to publish post: {}", e)),
|
Err(e) => Err(format!("Failed to publish post: {}", e)),
|
||||||
|
@ -539,7 +541,7 @@ pub fn publish_private_msg(text: String, recipients: Vec<String>) -> Result<Stri
|
||||||
.await
|
.await
|
||||||
.map_err(|e| e.to_string())?;
|
.map_err(|e| e.to_string())?;
|
||||||
|
|
||||||
// TODO: debug!("Publishing a new Scuttlebutt private message");
|
debug!("Publishing a new Scuttlebutt private message");
|
||||||
match sbot_client
|
match sbot_client
|
||||||
.publish_private(text.to_string(), recipients)
|
.publish_private(text.to_string(), recipients)
|
||||||
.await
|
.await
|
||||||
|
|
Loading…
Reference in New Issue