From 27e9f565e404e30dd35b3fb4ecff362ffec29aa4 Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Tue, 15 Jul 2025 15:58:46 +0100 Subject: [PATCH] Display online stores favicon URLs via Google API --- lib/music_library/online_store_templates.ex | 5 +++++ .../live/online_store_template_live/index.html.heex | 7 ++++++- lib/music_library_web/live/wishlist_live/show.html.heex | 8 +++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/music_library/online_store_templates.ex b/lib/music_library/online_store_templates.ex index d7509f2c..65592916 100644 --- a/lib/music_library/online_store_templates.ex +++ b/lib/music_library/online_store_templates.ex @@ -75,4 +75,9 @@ defmodule MusicLibrary.OnlineStoreTemplates do |> String.replace("{title}", URI.encode_www_form(record.title)) |> String.replace("{format}", URI.encode_www_form(format_string)) end + + def favicon_url(template) do + uri = URI.parse(template.url_template) + "https://www.google.com/s2/favicons?domain=#{uri.host}&sz=16" + end end diff --git a/lib/music_library_web/live/online_store_template_live/index.html.heex b/lib/music_library_web/live/online_store_template_live/index.html.heex index 3963d5d3..cae1c96b 100644 --- a/lib/music_library_web/live/online_store_template_live/index.html.heex +++ b/lib/music_library_web/live/online_store_template_live/index.html.heex @@ -29,7 +29,12 @@ class="flex items-center justify-between py-5" >
-
+
+ {template.name}

{template.name}

diff --git a/lib/music_library_web/live/wishlist_live/show.html.heex b/lib/music_library_web/live/wishlist_live/show.html.heex index 30da7991..febdfeff 100644 --- a/lib/music_library_web/live/wishlist_live/show.html.heex +++ b/lib/music_library_web/live/wishlist_live/show.html.heex @@ -281,7 +281,13 @@ :for={template <- @online_store_templates} class="flex items-center justify-between py-2 px-3 bg-gray-50 dark:bg-gray-800 rounded-lg" > - + {template.name} + {template.name} <.button