Don't fetch favicon for Gemini protocol feeds
This commit is contained in:
parent
12bb742be9
commit
198ca0345b
|
@ -13,15 +13,17 @@ defmodule Frenzy.Task.FetchFavicon do
|
||||||
site_url =
|
site_url =
|
||||||
case feed.site_url do
|
case feed.site_url do
|
||||||
url when is_binary(url) ->
|
url when is_binary(url) ->
|
||||||
url
|
URI.parse(url)
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
%URI{URI.parse(feed.feed_url) | path: nil, query: nil, fragment: nil} |> URI.to_string()
|
%URI{URI.parse(feed.feed_url) | path: nil, query: nil, fragment: nil}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if site_url.scheme in ["http", "https"] do
|
||||||
Logger.debug("Fetching favicon for #{site_url}")
|
Logger.debug("Fetching favicon for #{site_url}")
|
||||||
|
|
||||||
favicon_url = fetch_favicon_url_from_webpage(site_url) || URI.merge(site_url, "/favicon.ico")
|
favicon_url =
|
||||||
|
fetch_favicon_url_from_webpage(site_url) || URI.merge(site_url, "/favicon.ico")
|
||||||
|
|
||||||
with %Feed{favicon_url: old_url} when old_url != favicon_url <- feed,
|
with %Feed{favicon_url: old_url} when old_url != favicon_url <- feed,
|
||||||
{:ok, favicon_data} <- fetch_favicon_data(favicon_url) do
|
{:ok, favicon_data} <- fetch_favicon_data(favicon_url) do
|
||||||
|
@ -37,6 +39,7 @@ defmodule Frenzy.Task.FetchFavicon do
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@spec fetch_favicon_url_from_webpage(url :: String.t()) :: String.t()
|
@spec fetch_favicon_url_from_webpage(url :: String.t()) :: String.t()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue