From 400440b2ba1dde9a01f3bc04370f535b18fd79d7 Mon Sep 17 00:00:00 2001 From: jhspetersson Date: Fri, 29 Sep 2023 15:59:31 +0200 Subject: [PATCH] make checking for updates a configurable behavior --- src/config.rs | 2 ++ src/main.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index bcb24bd24..dcaf64e80 100644 --- a/src/config.rs +++ b/src/config.rs @@ -23,6 +23,7 @@ pub struct Config { pub is_source : Vec, pub is_video : Vec, pub default_file_size_format : Option, + pub check_for_updates: Option, #[serde(skip_serializing, default = "get_false")] pub debug : bool, #[serde(skip)] @@ -142,6 +143,7 @@ impl Config { is_source : vec![String::from(".asm"), String::from(".bas"), String::from(".c"), String::from(".cc"), String::from(".ceylon"), String::from(".clj"), String::from(".coffee"), String::from(".cpp"), String::from(".cs"), String::from(".d"), String::from(".dart"), String::from(".elm"), String::from(".erl"), String::from(".go"), String::from(".groovy"), String::from(".h"), String::from(".hh"), String::from(".hpp"), String::from(".java"), String::from(".jl"), String::from(".js"), String::from(".jsp"), String::from(".jsx"), String::from(".kt"), String::from(".kts"), String::from(".lua"), String::from(".nim"), String::from(".pas"), String::from(".php"), String::from(".pl"), String::from(".pm"), String::from(".py"), String::from(".rb"), String::from(".rs"), String::from(".scala"), String::from(".sol"), String::from(".swift"), String::from(".tcl"), String::from(".ts"), String::from(".vala"), String::from(".vb"), String::from(".zig")], is_video : vec![String::from(".3gp"), String::from(".avi"), String::from(".flv"), String::from(".m4p"), String::from(".m4v"), String::from(".mkv"), String::from(".mov"), String::from(".mp4"), String::from(".mpeg"), String::from(".mpg"), String::from(".webm"), String::from(".wmv")], default_file_size_format : Some(String::new()), + check_for_updates : Some(false), debug : false, save : true, } diff --git a/src/main.rs b/src/main.rs index 51a0f32d0..6e58a3ae4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -166,7 +166,7 @@ fn main() -> ExitCode { config.save(); #[cfg(feature = "update-notifications")] - if stdout().is_terminal() { + if config.check_for_updates.unwrap_or(false) && stdout().is_terminal() { let name = env!("CARGO_PKG_NAME"); let version = env!("CARGO_PKG_VERSION"); let informer = update_informer::new(registry::Crates, name, version).interval(Duration::from_secs(60 * 60));