Skip to content

Commit

Permalink
Merge branch 'main' into var-interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
tangowithfoxtrot committed Jan 26, 2025
1 parent c4ace8c commit 8d450de
Show file tree
Hide file tree
Showing 55 changed files with 103 additions and 58 deletions.
22 changes: 22 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ derive_setters = "0.1.6"
deunicode = "1.6.0"
paste = "1.0.15"
openssl = { version = "0.10.68", features = ["vendored"] }
veil = "0.2.0"

[dev-dependencies]
assert_cmd = "2.0.16"
Expand Down
19 changes: 19 additions & 0 deletions src/app/app_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,4 +409,23 @@ mod tests {
"https://dontdo:[email protected]/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);
}
}
8 changes: 5 additions & 3 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use regex::Regex;
use serde::{Deserialize, Serialize};
use tokio::sync::mpsc::Sender;
use tokio_util::sync::CancellationToken;
use veil::Redact;

use crate::app::context_clues::{build_context_clue_string, SERVARR_CONTEXT_CLUES};
use crate::cli::Command;
Expand Down Expand Up @@ -43,7 +44,7 @@ pub struct App<'a> {
pub data: Data<'a>,
}

impl<'a> App<'a> {
impl App<'_> {
pub fn new(
network_tx: Sender<NetworkEvent>,
config: AppConfig,
Expand Down Expand Up @@ -166,7 +167,7 @@ impl<'a> App<'a> {
}
}

impl<'a> Default for App<'a> {
impl Default for App<'_> {
fn default() -> Self {
App {
navigation_stack: Vec::new(),
Expand Down Expand Up @@ -259,7 +260,7 @@ impl AppConfig {
}
}

#[derive(Debug, Deserialize, Serialize, Clone)]
#[derive(Redact, Deserialize, Serialize, Clone)]
pub struct ServarrConfig {
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
pub host: Option<String>,
Expand All @@ -268,6 +269,7 @@ pub struct ServarrConfig {
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
pub uri: Option<String>,
#[serde(default, deserialize_with = "deserialize_env_var")]
#[redact]
pub api_token: String,
#[serde(default, deserialize_with = "deserialize_optional_env_var")]
pub ssl_cert_path: Option<String>,
Expand Down
2 changes: 1 addition & 1 deletion src/app/radarr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub mod radarr_context_clues;
#[path = "radarr_tests.rs"]
mod radarr_tests;

impl<'a> App<'a> {
impl App<'_> {
pub(super) async fn dispatch_by_radarr_block(&mut self, active_radarr_block: &ActiveRadarrBlock) {
match active_radarr_block {
ActiveRadarrBlock::Blocklist => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/sonarr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub mod sonarr_context_clues;
#[path = "sonarr_tests.rs"]
mod sonarr_tests;

impl<'a> App<'a> {
impl App<'_> {
pub(super) async fn dispatch_by_sonarr_block(&mut self, active_sonarr_block: &ActiveSonarrBlock) {
match active_sonarr_block {
ActiveSonarrBlock::Series => {
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/radarr_handlers/blocklist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub(super) struct BlocklistHandler<'a, 'b> {
_context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> BlocklistHandler<'a, 'b> {
impl BlocklistHandler<'_, '_> {
handle_table_events!(
self,
blocklist,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub(super) struct CollectionDetailsHandler<'a, 'b> {
_context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> CollectionDetailsHandler<'a, 'b> {
impl CollectionDetailsHandler<'_, '_> {
handle_table_events!(
self,
collection_movies,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(super) struct EditCollectionHandler<'a, 'b> {
context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> EditCollectionHandler<'a, 'b> {
impl EditCollectionHandler<'_, '_> {
fn build_edit_collection_params(&mut self) -> EditCollectionParams {
let edit_collection_modal = self
.app
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/radarr_handlers/collections/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub(super) struct CollectionsHandler<'a, 'b> {
context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> CollectionsHandler<'a, 'b> {
impl CollectionsHandler<'_, '_> {
handle_table_events!(
self,
collections,
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/radarr_handlers/downloads/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(super) struct DownloadsHandler<'a, 'b> {
_context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> DownloadsHandler<'a, 'b> {
impl DownloadsHandler<'_, '_> {
handle_table_events!(
self,
downloads,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(super) struct EditIndexerHandler<'a, 'b> {
_context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> EditIndexerHandler<'a, 'b> {
impl EditIndexerHandler<'_, '_> {
fn build_edit_indexer_params(&mut self) -> EditIndexerParams {
let edit_indexer_modal = self
.app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(super) struct IndexerSettingsHandler<'a, 'b> {
_context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> IndexerSettingsHandler<'a, 'b> {
impl IndexerSettingsHandler<'_, '_> {
fn build_edit_indexer_settings_body(&mut self) -> IndexerSettings {
self
.app
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/radarr_handlers/indexers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub(super) struct IndexersHandler<'a, 'b> {
context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> IndexersHandler<'a, 'b> {
impl IndexersHandler<'_, '_> {
handle_table_events!(self, indexers, self.app.data.radarr_data.indexers, Indexer);

fn extract_indexer_id(&self) -> i64 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub(super) struct TestAllIndexersHandler<'a, 'b> {
_context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> TestAllIndexersHandler<'a, 'b> {
impl TestAllIndexersHandler<'_, '_> {
handle_table_events!(
self,
indexer_test_all_results,
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/radarr_handlers/library/add_movie_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub(super) struct AddMovieHandler<'a, 'b> {
context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> AddMovieHandler<'a, 'b> {
impl AddMovieHandler<'_, '_> {
handle_table_events!(
self,
add_movie_search_results,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub(super) struct DeleteMovieHandler<'a, 'b> {
_context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> DeleteMovieHandler<'a, 'b> {
impl DeleteMovieHandler<'_, '_> {
fn build_delete_movie_params(&mut self) -> DeleteMovieParams {
let id = self.app.data.radarr_data.movies.current_selection().id;
let delete_movie_files = self.app.data.radarr_data.delete_movie_files;
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/radarr_handlers/library/edit_movie_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(super) struct EditMovieHandler<'a, 'b> {
context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> EditMovieHandler<'a, 'b> {
impl EditMovieHandler<'_, '_> {
fn build_edit_movie_params(&mut self) -> EditMovieParams {
let movie_id = self.app.data.radarr_data.movies.current_selection().id;
let edit_movie_modal = self
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/radarr_handlers/library/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub(super) struct LibraryHandler<'a, 'b> {
context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> LibraryHandler<'a, 'b> {
impl LibraryHandler<'_, '_> {
handle_table_events!(self, movies, self.app.data.radarr_data.movies, Movie);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub(super) struct MovieDetailsHandler<'a, 'b> {
_context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> MovieDetailsHandler<'a, 'b> {
impl MovieDetailsHandler<'_, '_> {
handle_table_events!(
self,
movie_releases,
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/radarr_handlers/root_folders/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub(super) struct RootFoldersHandler<'a, 'b> {
_context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> RootFoldersHandler<'a, 'b> {
impl RootFoldersHandler<'_, '_> {
handle_table_events!(
self,
root_folders,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(super) struct SystemDetailsHandler<'a, 'b> {
_context: Option<ActiveRadarrBlock>,
}

impl<'a, 'b> SystemDetailsHandler<'a, 'b> {
impl SystemDetailsHandler<'_, '_> {
fn extract_task_name(&self) -> RadarrTaskName {
self
.app
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/sonarr_handlers/blocklist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub(super) struct BlocklistHandler<'a, 'b> {
_context: Option<ActiveSonarrBlock>,
}

impl<'a, 'b> BlocklistHandler<'a, 'b> {
impl BlocklistHandler<'_, '_> {
handle_table_events!(
self,
blocklist,
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/sonarr_handlers/downloads/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(super) struct DownloadsHandler<'a, 'b> {
_context: Option<ActiveSonarrBlock>,
}

impl<'a, 'b> DownloadsHandler<'a, 'b> {
impl DownloadsHandler<'_, '_> {
handle_table_events!(
self,
downloads,
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/sonarr_handlers/history/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub(super) struct HistoryHandler<'a, 'b> {
_context: Option<ActiveSonarrBlock>,
}

impl<'a, 'b> HistoryHandler<'a, 'b> {
impl HistoryHandler<'_, '_> {
handle_table_events!(
self,
history,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(super) struct EditIndexerHandler<'a, 'b> {
_context: Option<ActiveSonarrBlock>,
}

impl<'a, 'b> EditIndexerHandler<'a, 'b> {
impl EditIndexerHandler<'_, '_> {
fn build_edit_indexer_params(&mut self) -> EditIndexerParams {
let edit_indexer_modal = self
.app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(super) struct IndexerSettingsHandler<'a, 'b> {
_context: Option<ActiveSonarrBlock>,
}

impl<'a, 'b> IndexerSettingsHandler<'a, 'b> {
impl IndexerSettingsHandler<'_, '_> {
fn build_edit_indexer_settings_params(&mut self) -> IndexerSettings {
self
.app
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/sonarr_handlers/indexers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub(super) struct IndexersHandler<'a, 'b> {
context: Option<ActiveSonarrBlock>,
}

impl<'a, 'b> IndexersHandler<'a, 'b> {
impl IndexersHandler<'_, '_> {
handle_table_events!(self, indexers, self.app.data.sonarr_data.indexers, Indexer);

fn extract_indexer_id(&self) -> i64 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub(super) struct TestAllIndexersHandler<'a, 'b> {
_context: Option<ActiveSonarrBlock>,
}

impl<'a, 'b> TestAllIndexersHandler<'a, 'b> {
impl TestAllIndexersHandler<'_, '_> {
handle_table_events!(
self,
indexer_test_all_results,
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/sonarr_handlers/library/add_series_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub(super) struct AddSeriesHandler<'a, 'b> {
_context: Option<ActiveSonarrBlock>,
}

impl<'a, 'b> AddSeriesHandler<'a, 'b> {
impl AddSeriesHandler<'_, '_> {
handle_table_events!(
self,
add_searched_series,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub(super) struct DeleteSeriesHandler<'a, 'b> {
_context: Option<ActiveSonarrBlock>,
}

impl<'a, 'b> DeleteSeriesHandler<'a, 'b> {
impl DeleteSeriesHandler<'_, '_> {
fn build_delete_series_params(&mut self) -> DeleteSeriesParams {
let id = self.app.data.sonarr_data.series.current_selection().id;
let delete_series_files = self.app.data.sonarr_data.delete_series_files;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(super) struct EditSeriesHandler<'a, 'b> {
context: Option<ActiveSonarrBlock>,
}

impl<'a, 'b> EditSeriesHandler<'a, 'b> {
impl EditSeriesHandler<'_, '_> {
fn build_edit_series_params(&mut self) -> EditSeriesParams {
let edit_series_modal = self
.app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(super) struct EpisodeDetailsHandler<'a, 'b> {
_context: Option<ActiveSonarrBlock>,
}

impl<'a, 'b> EpisodeDetailsHandler<'a, 'b> {
impl EpisodeDetailsHandler<'_, '_> {
handle_table_events!(
self,
episode_history,
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/sonarr_handlers/library/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub(super) struct LibraryHandler<'a, 'b> {
context: Option<ActiveSonarrBlock>,
}

impl<'a, 'b> LibraryHandler<'a, 'b> {
impl LibraryHandler<'_, '_> {
handle_table_events!(self, series, self.app.data.sonarr_data.series, Series);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub(super) struct SeasonDetailsHandler<'a, 'b> {
_context: Option<ActiveSonarrBlock>,
}

impl<'a, 'b> SeasonDetailsHandler<'a, 'b> {
impl SeasonDetailsHandler<'_, '_> {
handle_table_events!(
self,
episodes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub(super) struct SeriesDetailsHandler<'a, 'b> {
_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,
Expand Down
Loading

0 comments on commit 8d450de

Please sign in to comment.