diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aeb4bce3..c5b5e1899 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,7 +31,7 @@ - '(?i)\bHD\b' - '(?i)\bSD\b' ``` - - Trakt api config field `key` is now `api_key` + - Trakt api config field `key` is now `api_key`. Added `user_agent` field to Trakt api config ## 🌟 New Features - **Discord Notifications**: Support for Discord notifications via webhooks with optional Handlebars templates. diff --git a/backend/src/processing/input_cache.rs b/backend/src/processing/input_cache.rs index 7026ecb20..8fb271720 100644 --- a/backend/src/processing/input_cache.rs +++ b/backend/src/processing/input_cache.rs @@ -4,8 +4,7 @@ use std::path::{Path, PathBuf}; use serde::{Deserialize, Serialize}; use std::time::{SystemTime, UNIX_EPOCH}; use log::{error, warn}; -use shared::concat_string; -use crate::repository::storage::{get_input_storage_path, sanitize_name}; +use crate::repository::storage::{build_input_storage_path, get_input_storage_path}; pub const STATUS_FILE: &str = "status.json"; @@ -30,9 +29,7 @@ pub struct InputStatus { pub fn resolve_input_storage_path(working_dir: &str, input_name: &str) -> PathBuf { if let Ok(path) = get_input_storage_path(input_name, working_dir) { path } else { - let sanitized_name: String = sanitize_name(input_name); - let name = concat_string!(cap = 6 + sanitized_name.len(); "input_", &sanitized_name); - Path::new(working_dir).join(name) + build_input_storage_path(input_name, working_dir) } } diff --git a/backend/src/repository/storage.rs b/backend/src/repository/storage.rs index d4a663445..6d8e115c2 100644 --- a/backend/src/repository/storage.rs +++ b/backend/src/repository/storage.rs @@ -34,10 +34,14 @@ pub fn sanitize_name(name: &str) -> String { .collect() } -pub fn get_input_storage_path(input_name: &str, working_dir: &str) -> std::io::Result { +pub fn build_input_storage_path(input_name: &str, working_dir: &str) -> PathBuf { let sanitized_name: String = sanitize_name(input_name); let name = concat_string!(cap = 6 + sanitized_name.len(); "input_", &sanitized_name); - let path = Path::new(working_dir).join(name); + Path::new(working_dir).join(name) +} + +pub fn get_input_storage_path(input_name: &str, working_dir: &str) -> std::io::Result { + let path = build_input_storage_path(input_name, working_dir); // Create the directory and return the path or propagate the error std::fs::create_dir_all(&path).map(|()| path) } diff --git a/backend/src/utils/trakt/client.rs b/backend/src/utils/trakt/client.rs index d04e4c604..0c92eedb7 100644 --- a/backend/src/utils/trakt/client.rs +++ b/backend/src/utils/trakt/client.rs @@ -24,7 +24,7 @@ impl TraktClient { } } - fn create_headers(api_config: &TraktApiConfig) -> axum::http::HeaderMap { + fn create_headers(api_config: &TraktApiConfig) -> HeaderMap { let mut headers = HeaderMap::new(); headers.insert(reqwest::header::CONTENT_TYPE, HeaderValue::from_static(mime::APPLICATION_JSON.as_ref())); diff --git a/frontend/src/app/components/source_editor/output_xtream_form.rs b/frontend/src/app/components/source_editor/output_xtream_form.rs index af6f69515..ab6c198ef 100644 --- a/frontend/src/app/components/source_editor/output_xtream_form.rs +++ b/frontend/src/app/components/source_editor/output_xtream_form.rs @@ -219,7 +219,7 @@ pub fn XtreamTargetOutputView(props: &XtreamTargetOutputViewProps) -> Html { { edit_field_text!(trakt_api, translate.t(LABEL_TRAKT_API_KEY), api_key, TraktApiConfigFormAction::ApiKey) } { edit_field_text!(trakt_api, translate.t(LABEL_TRAKT_API_VERSION), version, TraktApiConfigFormAction::Version) } { edit_field_text!(trakt_api, translate.t(LABEL_TRAKT_API_URL), url, TraktApiConfigFormAction::Url) } - { edit_field_text!(trakt_api, translate.t(LABEL_USER_AGENT), url, TraktApiConfigFormAction::UserAgent) } + { edit_field_text!(trakt_api, translate.t(LABEL_USER_AGENT), user_agent, TraktApiConfigFormAction::UserAgent) } // Trakt Lists