diff --git a/chrono_track/src/main.rs b/chrono_track/src/main.rs index 9eaf2ab..5bb244b 100644 --- a/chrono_track/src/main.rs +++ b/chrono_track/src/main.rs @@ -8,7 +8,7 @@ use lettre::{ use log::{debug, error}; use reqwest::blocking::Client; use serde::{Deserialize, Serialize}; -use std::{path::PathBuf, process::Command}; +use std::path::PathBuf; fn main() -> Result<(), Box> { // --- Loading and setup --- @@ -46,7 +46,6 @@ fn main() -> Result<(), Box> { // --- END Loading and setup --- let mut do_email_summary: bool = false; - let mut do_headscale_reset: bool = false; // --- Get checked and unchecked --- let primary_note = Client::new() @@ -62,22 +61,14 @@ fn main() -> Result<(), Box> { let primary_note_lines: Vec<&str> = primary_note.content.lines().collect(); - debug!("input: {:#?}", primary_note_lines); - let mut unchecked: Vec = vec![]; let mut checked: Vec = vec![]; for line in primary_note_lines.iter() { if line.starts_with("- [x] Send Summary") { - debug!("send summary flag caught"); do_email_summary = true; continue; } - if line.starts_with("- [x] Restart Headscale :(") { - debug!("restart headscale flag caught"); - do_headscale_reset = true; - continue; - } if line.starts_with("- [ ] Send Summary") { continue; } @@ -204,14 +195,9 @@ fn main() -> Result<(), Box> { if do_email_summary { debug!("Send email selected"); - reset_checkboxes(&cfg); + reset_email_checkbox(&cfg); send_email_summary(&cfg, body_content, &args); } - if do_headscale_reset { - debug!("Restarting Headscale"); - reset_checkboxes(&cfg); - reset_headscale(); - } Ok(()) } @@ -257,15 +243,11 @@ struct CliArgs { debug: bool, } -fn reset_headscale() { - let _ = Command::new("systemctl").arg("restart").arg("headscale").output(); -} - // All unwraps are unrecoverable errors // All calls after depend on the success of the one before, and cannot run // without. So it would be too much work to make an error type to handle an error // that would cause a crash anyways -fn reset_checkboxes(config: &Config) { +fn reset_email_checkbox(config: &Config) { let primary_note = Client::new() .get(format!( "https://{}/index.php/apps/notes/api/v1/notes/{}", @@ -286,8 +268,6 @@ fn reset_checkboxes(config: &Config) { for line in primary_note_lines.iter() { if line.starts_with("- [x] Send Summary") { body_content.push("- [ ] Send Summary"); - } else if line.starts_with("- [x] Restart Headscale :(") { - body_content.push("- [ ] Restart Headscale :(") } else { body_content.push(line); }