Merge branch 'main' into var-interpolation
This commit is contained in:
Generated
+22
@@ -1359,6 +1359,7 @@ dependencies = [
|
|||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
"urlencoding",
|
"urlencoding",
|
||||||
|
"veil",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2644,6 +2645,27 @@ version = "0.2.15"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "veil"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0f00796f9c5969da55497f5c8802c2e69eaf21c0166fe28b6006c7c4699f4d0e"
|
||||||
|
dependencies = [
|
||||||
|
"once_cell",
|
||||||
|
"veil-macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "veil-macros"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b2d5567b6fbd34e8f0488d56b648e67c0d999535f4af2060d14f9074b43e833"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.90",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wait-timeout"
|
name = "wait-timeout"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ derive_setters = "0.1.6"
|
|||||||
deunicode = "1.6.0"
|
deunicode = "1.6.0"
|
||||||
paste = "1.0.15"
|
paste = "1.0.15"
|
||||||
openssl = { version = "0.10.68", features = ["vendored"] }
|
openssl = { version = "0.10.68", features = ["vendored"] }
|
||||||
|
veil = "0.2.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assert_cmd = "2.0.16"
|
assert_cmd = "2.0.16"
|
||||||
|
|||||||
@@ -409,4 +409,23 @@ mod tests {
|
|||||||
"https://dontdo:this@testing.com/query?test=%20query#results"
|
"https://dontdo:this@testing.com/query?test=%20query#results"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn test_servarr_config_redacted_debug() {
|
||||||
|
let host = "localhost".to_owned();
|
||||||
|
let port = 1234;
|
||||||
|
let uri = "http://localhost:1234".to_owned();
|
||||||
|
let api_token = "thisisatest".to_owned();
|
||||||
|
let ssl_cert_path = "/some/path".to_owned();
|
||||||
|
let expected_str = format!("ServarrConfig {{ host: Some(\"{}\"), port: Some({}), uri: Some(\"{}\"), api_token: \"***********\", ssl_cert_path: Some(\"{}\") }}",
|
||||||
|
host, port, uri, ssl_cert_path);
|
||||||
|
let servarr_config = ServarrConfig {
|
||||||
|
host: Some(host),
|
||||||
|
port: Some(port),
|
||||||
|
uri: Some(uri),
|
||||||
|
api_token,
|
||||||
|
ssl_cert_path: Some(ssl_cert_path),
|
||||||
|
};
|
||||||
|
|
||||||
|
assert_str_eq!(format!("{servarr_config:?}"), expected_str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -7,6 +7,7 @@ use regex::Regex;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tokio::sync::mpsc::Sender;
|
use tokio::sync::mpsc::Sender;
|
||||||
use tokio_util::sync::CancellationToken;
|
use tokio_util::sync::CancellationToken;
|
||||||
|
use veil::Redact;
|
||||||
|
|
||||||
use crate::app::context_clues::{build_context_clue_string, SERVARR_CONTEXT_CLUES};
|
use crate::app::context_clues::{build_context_clue_string, SERVARR_CONTEXT_CLUES};
|
||||||
use crate::cli::Command;
|
use crate::cli::Command;
|
||||||
@@ -43,7 +44,7 @@ pub struct App<'a> {
|
|||||||
pub data: Data<'a>,
|
pub data: Data<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> App<'a> {
|
impl App<'_> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
network_tx: Sender<NetworkEvent>,
|
network_tx: Sender<NetworkEvent>,
|
||||||
config: AppConfig,
|
config: AppConfig,
|
||||||
@@ -166,7 +167,7 @@ impl<'a> App<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Default for App<'a> {
|
impl Default for App<'_> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
App {
|
App {
|
||||||
navigation_stack: Vec::new(),
|
navigation_stack: Vec::new(),
|
||||||
@@ -259,7 +260,7 @@ impl AppConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Redact, Deserialize, Serialize, Clone)]
|
||||||
pub struct ServarrConfig {
|
pub struct ServarrConfig {
|
||||||
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
|
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
|
||||||
pub host: Option<String>,
|
pub host: Option<String>,
|
||||||
@@ -268,6 +269,7 @@ pub struct ServarrConfig {
|
|||||||
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
|
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
|
||||||
pub uri: Option<String>,
|
pub uri: Option<String>,
|
||||||
#[serde(default, deserialize_with = "deserialize_env_var")]
|
#[serde(default, deserialize_with = "deserialize_env_var")]
|
||||||
|
#[redact]
|
||||||
pub api_token: String,
|
pub api_token: String,
|
||||||
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
|
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
|
||||||
pub ssl_cert_path: Option<String>,
|
pub ssl_cert_path: Option<String>,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ pub mod radarr_context_clues;
|
|||||||
#[path = "radarr_tests.rs"]
|
#[path = "radarr_tests.rs"]
|
||||||
mod radarr_tests;
|
mod radarr_tests;
|
||||||
|
|
||||||
impl<'a> App<'a> {
|
impl App<'_> {
|
||||||
pub(super) async fn dispatch_by_radarr_block(&mut self, active_radarr_block: &ActiveRadarrBlock) {
|
pub(super) async fn dispatch_by_radarr_block(&mut self, active_radarr_block: &ActiveRadarrBlock) {
|
||||||
match active_radarr_block {
|
match active_radarr_block {
|
||||||
ActiveRadarrBlock::Blocklist => {
|
ActiveRadarrBlock::Blocklist => {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ pub mod sonarr_context_clues;
|
|||||||
#[path = "sonarr_tests.rs"]
|
#[path = "sonarr_tests.rs"]
|
||||||
mod sonarr_tests;
|
mod sonarr_tests;
|
||||||
|
|
||||||
impl<'a> App<'a> {
|
impl App<'_> {
|
||||||
pub(super) async fn dispatch_by_sonarr_block(&mut self, active_sonarr_block: &ActiveSonarrBlock) {
|
pub(super) async fn dispatch_by_sonarr_block(&mut self, active_sonarr_block: &ActiveSonarrBlock) {
|
||||||
match active_sonarr_block {
|
match active_sonarr_block {
|
||||||
ActiveSonarrBlock::Series => {
|
ActiveSonarrBlock::Series => {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pub(super) struct BlocklistHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveRadarrBlock>,
|
_context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> BlocklistHandler<'a, 'b> {
|
impl BlocklistHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
blocklist,
|
blocklist,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ pub(super) struct CollectionDetailsHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveRadarrBlock>,
|
_context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> CollectionDetailsHandler<'a, 'b> {
|
impl CollectionDetailsHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
collection_movies,
|
collection_movies,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ pub(super) struct EditCollectionHandler<'a, 'b> {
|
|||||||
context: Option<ActiveRadarrBlock>,
|
context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> EditCollectionHandler<'a, 'b> {
|
impl EditCollectionHandler<'_, '_> {
|
||||||
fn build_edit_collection_params(&mut self) -> EditCollectionParams {
|
fn build_edit_collection_params(&mut self) -> EditCollectionParams {
|
||||||
let edit_collection_modal = self
|
let edit_collection_modal = self
|
||||||
.app
|
.app
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ pub(super) struct CollectionsHandler<'a, 'b> {
|
|||||||
context: Option<ActiveRadarrBlock>,
|
context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> CollectionsHandler<'a, 'b> {
|
impl CollectionsHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
collections,
|
collections,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ pub(super) struct DownloadsHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveRadarrBlock>,
|
_context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> DownloadsHandler<'a, 'b> {
|
impl DownloadsHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
downloads,
|
downloads,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ pub(super) struct EditIndexerHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveRadarrBlock>,
|
_context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> EditIndexerHandler<'a, 'b> {
|
impl EditIndexerHandler<'_, '_> {
|
||||||
fn build_edit_indexer_params(&mut self) -> EditIndexerParams {
|
fn build_edit_indexer_params(&mut self) -> EditIndexerParams {
|
||||||
let edit_indexer_modal = self
|
let edit_indexer_modal = self
|
||||||
.app
|
.app
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ pub(super) struct IndexerSettingsHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveRadarrBlock>,
|
_context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> IndexerSettingsHandler<'a, 'b> {
|
impl IndexerSettingsHandler<'_, '_> {
|
||||||
fn build_edit_indexer_settings_body(&mut self) -> IndexerSettings {
|
fn build_edit_indexer_settings_body(&mut self) -> IndexerSettings {
|
||||||
self
|
self
|
||||||
.app
|
.app
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ pub(super) struct IndexersHandler<'a, 'b> {
|
|||||||
context: Option<ActiveRadarrBlock>,
|
context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> IndexersHandler<'a, 'b> {
|
impl IndexersHandler<'_, '_> {
|
||||||
handle_table_events!(self, indexers, self.app.data.radarr_data.indexers, Indexer);
|
handle_table_events!(self, indexers, self.app.data.radarr_data.indexers, Indexer);
|
||||||
|
|
||||||
fn extract_indexer_id(&self) -> i64 {
|
fn extract_indexer_id(&self) -> i64 {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ pub(super) struct TestAllIndexersHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveRadarrBlock>,
|
_context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> TestAllIndexersHandler<'a, 'b> {
|
impl TestAllIndexersHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
indexer_test_all_results,
|
indexer_test_all_results,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ pub(super) struct AddMovieHandler<'a, 'b> {
|
|||||||
context: Option<ActiveRadarrBlock>,
|
context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> AddMovieHandler<'a, 'b> {
|
impl AddMovieHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
add_movie_search_results,
|
add_movie_search_results,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ pub(super) struct DeleteMovieHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveRadarrBlock>,
|
_context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> DeleteMovieHandler<'a, 'b> {
|
impl DeleteMovieHandler<'_, '_> {
|
||||||
fn build_delete_movie_params(&mut self) -> DeleteMovieParams {
|
fn build_delete_movie_params(&mut self) -> DeleteMovieParams {
|
||||||
let id = self.app.data.radarr_data.movies.current_selection().id;
|
let id = self.app.data.radarr_data.movies.current_selection().id;
|
||||||
let delete_movie_files = self.app.data.radarr_data.delete_movie_files;
|
let delete_movie_files = self.app.data.radarr_data.delete_movie_files;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ pub(super) struct EditMovieHandler<'a, 'b> {
|
|||||||
context: Option<ActiveRadarrBlock>,
|
context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> EditMovieHandler<'a, 'b> {
|
impl EditMovieHandler<'_, '_> {
|
||||||
fn build_edit_movie_params(&mut self) -> EditMovieParams {
|
fn build_edit_movie_params(&mut self) -> EditMovieParams {
|
||||||
let movie_id = self.app.data.radarr_data.movies.current_selection().id;
|
let movie_id = self.app.data.radarr_data.movies.current_selection().id;
|
||||||
let edit_movie_modal = self
|
let edit_movie_modal = self
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ pub(super) struct LibraryHandler<'a, 'b> {
|
|||||||
context: Option<ActiveRadarrBlock>,
|
context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> LibraryHandler<'a, 'b> {
|
impl LibraryHandler<'_, '_> {
|
||||||
handle_table_events!(self, movies, self.app.data.radarr_data.movies, Movie);
|
handle_table_events!(self, movies, self.app.data.radarr_data.movies, Movie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ pub(super) struct MovieDetailsHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveRadarrBlock>,
|
_context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> MovieDetailsHandler<'a, 'b> {
|
impl MovieDetailsHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
movie_releases,
|
movie_releases,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pub(super) struct RootFoldersHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveRadarrBlock>,
|
_context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> RootFoldersHandler<'a, 'b> {
|
impl RootFoldersHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
root_folders,
|
root_folders,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ pub(super) struct SystemDetailsHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveRadarrBlock>,
|
_context: Option<ActiveRadarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> SystemDetailsHandler<'a, 'b> {
|
impl SystemDetailsHandler<'_, '_> {
|
||||||
fn extract_task_name(&self) -> RadarrTaskName {
|
fn extract_task_name(&self) -> RadarrTaskName {
|
||||||
self
|
self
|
||||||
.app
|
.app
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pub(super) struct BlocklistHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveSonarrBlock>,
|
_context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> BlocklistHandler<'a, 'b> {
|
impl BlocklistHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
blocklist,
|
blocklist,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ pub(super) struct DownloadsHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveSonarrBlock>,
|
_context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> DownloadsHandler<'a, 'b> {
|
impl DownloadsHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
downloads,
|
downloads,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pub(super) struct HistoryHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveSonarrBlock>,
|
_context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> HistoryHandler<'a, 'b> {
|
impl HistoryHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
history,
|
history,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ pub(super) struct EditIndexerHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveSonarrBlock>,
|
_context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> EditIndexerHandler<'a, 'b> {
|
impl EditIndexerHandler<'_, '_> {
|
||||||
fn build_edit_indexer_params(&mut self) -> EditIndexerParams {
|
fn build_edit_indexer_params(&mut self) -> EditIndexerParams {
|
||||||
let edit_indexer_modal = self
|
let edit_indexer_modal = self
|
||||||
.app
|
.app
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ pub(super) struct IndexerSettingsHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveSonarrBlock>,
|
_context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> IndexerSettingsHandler<'a, 'b> {
|
impl IndexerSettingsHandler<'_, '_> {
|
||||||
fn build_edit_indexer_settings_params(&mut self) -> IndexerSettings {
|
fn build_edit_indexer_settings_params(&mut self) -> IndexerSettings {
|
||||||
self
|
self
|
||||||
.app
|
.app
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ pub(super) struct IndexersHandler<'a, 'b> {
|
|||||||
context: Option<ActiveSonarrBlock>,
|
context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> IndexersHandler<'a, 'b> {
|
impl IndexersHandler<'_, '_> {
|
||||||
handle_table_events!(self, indexers, self.app.data.sonarr_data.indexers, Indexer);
|
handle_table_events!(self, indexers, self.app.data.sonarr_data.indexers, Indexer);
|
||||||
|
|
||||||
fn extract_indexer_id(&self) -> i64 {
|
fn extract_indexer_id(&self) -> i64 {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ pub(super) struct TestAllIndexersHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveSonarrBlock>,
|
_context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> TestAllIndexersHandler<'a, 'b> {
|
impl TestAllIndexersHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
indexer_test_all_results,
|
indexer_test_all_results,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ pub(super) struct AddSeriesHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveSonarrBlock>,
|
_context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> AddSeriesHandler<'a, 'b> {
|
impl AddSeriesHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
add_searched_series,
|
add_searched_series,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ pub(super) struct DeleteSeriesHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveSonarrBlock>,
|
_context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> DeleteSeriesHandler<'a, 'b> {
|
impl DeleteSeriesHandler<'_, '_> {
|
||||||
fn build_delete_series_params(&mut self) -> DeleteSeriesParams {
|
fn build_delete_series_params(&mut self) -> DeleteSeriesParams {
|
||||||
let id = self.app.data.sonarr_data.series.current_selection().id;
|
let id = self.app.data.sonarr_data.series.current_selection().id;
|
||||||
let delete_series_files = self.app.data.sonarr_data.delete_series_files;
|
let delete_series_files = self.app.data.sonarr_data.delete_series_files;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ pub(super) struct EditSeriesHandler<'a, 'b> {
|
|||||||
context: Option<ActiveSonarrBlock>,
|
context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> EditSeriesHandler<'a, 'b> {
|
impl EditSeriesHandler<'_, '_> {
|
||||||
fn build_edit_series_params(&mut self) -> EditSeriesParams {
|
fn build_edit_series_params(&mut self) -> EditSeriesParams {
|
||||||
let edit_series_modal = self
|
let edit_series_modal = self
|
||||||
.app
|
.app
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ pub(super) struct EpisodeDetailsHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveSonarrBlock>,
|
_context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> EpisodeDetailsHandler<'a, 'b> {
|
impl EpisodeDetailsHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
episode_history,
|
episode_history,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ pub(super) struct LibraryHandler<'a, 'b> {
|
|||||||
context: Option<ActiveSonarrBlock>,
|
context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> LibraryHandler<'a, 'b> {
|
impl LibraryHandler<'_, '_> {
|
||||||
handle_table_events!(self, series, self.app.data.sonarr_data.series, Series);
|
handle_table_events!(self, series, self.app.data.sonarr_data.series, Series);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ pub(super) struct SeasonDetailsHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveSonarrBlock>,
|
_context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> SeasonDetailsHandler<'a, 'b> {
|
impl SeasonDetailsHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
episodes,
|
episodes,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ pub(super) struct SeriesDetailsHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveSonarrBlock>,
|
_context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> SeriesDetailsHandler<'a, 'b> {
|
impl SeriesDetailsHandler<'_, '_> {
|
||||||
handle_table_events!(self, season, self.app.data.sonarr_data.seasons, Season);
|
handle_table_events!(self, season, self.app.data.sonarr_data.seasons, Season);
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pub(super) struct RootFoldersHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveSonarrBlock>,
|
_context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> RootFoldersHandler<'a, 'b> {
|
impl RootFoldersHandler<'_, '_> {
|
||||||
handle_table_events!(
|
handle_table_events!(
|
||||||
self,
|
self,
|
||||||
root_folders,
|
root_folders,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ pub(super) struct SystemDetailsHandler<'a, 'b> {
|
|||||||
_context: Option<ActiveSonarrBlock>,
|
_context: Option<ActiveSonarrBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> SystemDetailsHandler<'a, 'b> {
|
impl SystemDetailsHandler<'_, '_> {
|
||||||
fn extract_task_name(&self) -> SonarrTaskName {
|
fn extract_task_name(&self) -> SonarrTaskName {
|
||||||
self
|
self
|
||||||
.app
|
.app
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ mod tests {
|
|||||||
fn handle_char_key_event(&mut self) {}
|
fn handle_char_key_event(&mut self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> TableHandlerUnit<'a, 'b> {
|
impl TableHandlerUnit<'_, '_> {
|
||||||
handle_table_events!(self, movies, self.app.data.radarr_data.movies, Movie);
|
handle_table_events!(self, movies, self.app.data.radarr_data.movies, Movie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -1,4 +1,4 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2021_compatibility)]
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use std::panic::PanicHookInfo;
|
use std::panic::PanicHookInfo;
|
||||||
@@ -13,7 +13,7 @@ use crossterm::execute;
|
|||||||
use crossterm::terminal::{
|
use crossterm::terminal::{
|
||||||
disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen,
|
disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen,
|
||||||
};
|
};
|
||||||
use log::{error, warn};
|
use log::{debug, error, warn};
|
||||||
use network::NetworkTrait;
|
use network::NetworkTrait;
|
||||||
use ratatui::backend::CrosstermBackend;
|
use ratatui::backend::CrosstermBackend;
|
||||||
use ratatui::Terminal;
|
use ratatui::Terminal;
|
||||||
@@ -93,6 +93,7 @@ async fn main() -> Result<()> {
|
|||||||
confy::load("managarr", "config")?
|
confy::load("managarr", "config")?
|
||||||
};
|
};
|
||||||
let spinner_disabled = args.disable_spinner;
|
let spinner_disabled = args.disable_spinner;
|
||||||
|
debug!("Managarr loaded using config: {config:?}");
|
||||||
config.validate();
|
config.validate();
|
||||||
let reqwest_client = build_network_client(&config);
|
let reqwest_client = build_network_client(&config);
|
||||||
let (sync_network_tx, sync_network_rx) = mpsc::channel(500);
|
let (sync_network_tx, sync_network_rx) = mpsc::channel(500);
|
||||||
|
|||||||
+1
-1
@@ -363,7 +363,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
impl<'a, T> BlockSelectionState<'a, T>
|
impl<T> BlockSelectionState<'_, T>
|
||||||
where
|
where
|
||||||
T: Sized + Clone + Copy + Default,
|
T: Sized + Clone + Copy + Default,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ pub struct RadarrData<'a> {
|
|||||||
pub add_list_exclusion: bool,
|
pub add_list_exclusion: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> RadarrData<'a> {
|
impl RadarrData<'_> {
|
||||||
pub fn reset_delete_movie_preferences(&mut self) {
|
pub fn reset_delete_movie_preferences(&mut self) {
|
||||||
self.delete_movie_files = false;
|
self.delete_movie_files = false;
|
||||||
self.add_list_exclusion = false;
|
self.add_list_exclusion = false;
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ pub struct SonarrData<'a> {
|
|||||||
pub version: String,
|
pub version: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> SonarrData<'a> {
|
impl SonarrData<'_> {
|
||||||
pub fn reset_delete_series_preferences(&mut self) {
|
pub fn reset_delete_series_preferences(&mut self) {
|
||||||
self.delete_series_files = false;
|
self.delete_series_files = false;
|
||||||
self.add_list_exclusion = false;
|
self.add_list_exclusion = false;
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ pub struct Network<'a, 'b> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl<'a, 'b> NetworkTrait for Network<'a, 'b> {
|
impl NetworkTrait for Network<'_, '_> {
|
||||||
async fn handle_network_event(&mut self, network_event: NetworkEvent) -> Result<Serdeable> {
|
async fn handle_network_event(&mut self, network_event: NetworkEvent) -> Result<Serdeable> {
|
||||||
let resp = match network_event {
|
let resp = match network_event {
|
||||||
NetworkEvent::Radarr(radarr_event) => self
|
NetworkEvent::Radarr(radarr_event) => self
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ impl From<RadarrEvent> for NetworkEvent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> Network<'a, 'b> {
|
impl Network<'_, '_> {
|
||||||
pub async fn handle_radarr_event(
|
pub async fn handle_radarr_event(
|
||||||
&mut self,
|
&mut self,
|
||||||
radarr_event: RadarrEvent,
|
radarr_event: RadarrEvent,
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ impl From<SonarrEvent> for NetworkEvent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> Network<'a, 'b> {
|
impl Network<'_, '_> {
|
||||||
pub async fn handle_sonarr_event(
|
pub async fn handle_sonarr_event(
|
||||||
&mut self,
|
&mut self,
|
||||||
sonarr_event: SonarrEvent,
|
sonarr_event: SonarrEvent,
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ where
|
|||||||
fn warning(self) -> T;
|
fn warning(self) -> T;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T, U> ManagarrStyle<'a, T> for U
|
impl<T, U> ManagarrStyle<'_, T> for U
|
||||||
where
|
where
|
||||||
U: Styled<Item = T>,
|
U: Styled<Item = T>,
|
||||||
T: Default,
|
T: Default,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ pub struct Button<'a> {
|
|||||||
is_selected: bool,
|
is_selected: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Button<'a> {
|
impl Button<'_> {
|
||||||
fn render_button_with_icon(self, area: Rect, buf: &mut Buffer) {
|
fn render_button_with_icon(self, area: Rect, buf: &mut Buffer) {
|
||||||
let [title_area, icon_area] = Layout::horizontal([
|
let [title_area, icon_area] = Layout::horizontal([
|
||||||
Constraint::Length(self.title.len() as u16),
|
Constraint::Length(self.title.len() as u16),
|
||||||
@@ -69,7 +69,7 @@ impl<'a> Button<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for Button<'a> {
|
impl Widget for Button<'_> {
|
||||||
fn render(self, area: Rect, buf: &mut Buffer)
|
fn render(self, area: Rect, buf: &mut Buffer)
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ impl<'a> Checkbox<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for Checkbox<'a> {
|
impl Widget for Checkbox<'_> {
|
||||||
fn render(self, area: Rect, buf: &mut Buffer) {
|
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||||
self.render_checkbox(area, buf);
|
self.render_checkbox(area, buf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ pub struct ConfirmationPrompt<'a> {
|
|||||||
yes_no_highlighted: bool,
|
yes_no_highlighted: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ConfirmationPrompt<'a> {
|
impl ConfirmationPrompt<'_> {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
title: "",
|
title: "",
|
||||||
@@ -135,7 +135,7 @@ impl<'a> ConfirmationPrompt<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for ConfirmationPrompt<'a> {
|
impl Widget for ConfirmationPrompt<'_> {
|
||||||
fn render(self, area: Rect, buf: &mut Buffer) {
|
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||||
if self.checkboxes.is_some() {
|
if self.checkboxes.is_some() {
|
||||||
self.render_confirmation_prompt_with_checkboxes(area, buf);
|
self.render_confirmation_prompt_with_checkboxes(area, buf);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ impl<'a> InputBox<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for InputBox<'a> {
|
impl Widget for InputBox<'_> {
|
||||||
fn render(self, area: Rect, buf: &mut Buffer)
|
fn render(self, area: Rect, buf: &mut Buffer)
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
@@ -105,7 +105,7 @@ impl<'a> Widget for InputBox<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WidgetRef for InputBox<'a> {
|
impl WidgetRef for InputBox<'_> {
|
||||||
fn render_ref(&self, area: Rect, buf: &mut Buffer) {
|
fn render_ref(&self, area: Rect, buf: &mut Buffer) {
|
||||||
self.render_input_box(area, buf);
|
self.render_input_box(area, buf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ impl<'a> InputBoxPopup<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WidgetRef for InputBoxPopup<'a> {
|
impl WidgetRef for InputBoxPopup<'_> {
|
||||||
fn render_ref(&self, area: Rect, buf: &mut Buffer) {
|
fn render_ref(&self, area: Rect, buf: &mut Buffer) {
|
||||||
self.render_popup(area, buf);
|
self.render_popup(area, buf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ impl<'a> LoadingBlock<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for LoadingBlock<'a> {
|
impl Widget for LoadingBlock<'_> {
|
||||||
fn render(self, area: Rect, buf: &mut Buffer) {
|
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||||
self.render_loading_block(area, buf);
|
self.render_loading_block(area, buf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ impl<'a> Message<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Widget for Message<'a> {
|
impl Widget for Message<'_> {
|
||||||
fn render(self, area: Rect, buf: &mut Buffer) {
|
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||||
self.render_message(area, buf);
|
self.render_message(area, buf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ impl<'a, T: Widget> Popup<'a, T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Widget> Widget for Popup<'a, T> {
|
impl<T: Widget> Widget for Popup<'_, T> {
|
||||||
fn render(self, area: Rect, buf: &mut Buffer) {
|
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||||
self.render_popup(area, buf);
|
self.render_popup(area, buf);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user