From 5f1d5a24ce8a04b78c8619eabd018c3e5fb01d77 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Tue, 24 Feb 2026 10:06:02 -0600 Subject: [PATCH] feat(ui): add album cover context menu in AlbumDetailView Right-click on album artwork shows context menu with: - Add/Change/Remove custom album cover - Open in browser - Save as... Also adds v2_save_image_url_to_file backend command. cc --- src-tauri/src/commands_v2.rs | 17 ++ src-tauri/src/lib.rs | 1 + .../components/views/AlbumDetailView.svelte | 184 +++++++++++++++++- 3 files changed, 199 insertions(+), 3 deletions(-) diff --git a/src-tauri/src/commands_v2.rs b/src-tauri/src/commands_v2.rs index 133c58211..557e5ca38 100644 --- a/src-tauri/src/commands_v2.rs +++ b/src-tauri/src/commands_v2.rs @@ -4830,6 +4830,23 @@ pub async fn v2_library_get_all_custom_album_covers( db.get_all_custom_album_covers().map_err(|e| e.to_string()) } +#[tauri::command] +pub async fn v2_save_image_url_to_file( + url: String, + dest_path: String, +) -> Result<(), String> { + let response = reqwest::get(&url) + .await + .map_err(|e| format!("Failed to download image: {}", e))?; + let bytes = response + .bytes() + .await + .map_err(|e| format!("Failed to read image data: {}", e))?; + std::fs::write(&dest_path, &bytes) + .map_err(|e| format!("Failed to save image: {}", e))?; + Ok(()) +} + #[tauri::command] pub async fn v2_create_artist_radio( artist_id: u64, diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index fd6072138..cd345323a 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1205,6 +1205,7 @@ pub fn run() { commands_v2::v2_library_set_custom_album_cover, commands_v2::v2_library_remove_custom_album_cover, commands_v2::v2_library_get_all_custom_album_covers, + commands_v2::v2_save_image_url_to_file, commands_v2::v2_show_track_notification, commands_v2::v2_subscribe_playlist, commands_v2::v2_cache_track_for_offline, diff --git a/src/lib/components/views/AlbumDetailView.svelte b/src/lib/components/views/AlbumDetailView.svelte index 58cdcad55..9887ad8e3 100644 --- a/src/lib/components/views/AlbumDetailView.svelte +++ b/src/lib/components/views/AlbumDetailView.svelte @@ -1,7 +1,15 @@