mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-24 16:51:19 +01:00
Base the homePageURL for a feed from its feed URL when looking for its favicon. When necessary only.
This commit is contained in:
parent
3eb95ce63d
commit
b3ecf9cdba
@ -47,12 +47,20 @@ final class FaviconDownloader {
|
||||
return favicon(with: faviconURL)
|
||||
}
|
||||
|
||||
guard let homePageURL = feed.homePageURL else {
|
||||
return nil
|
||||
var homePageURL = feed.homePageURL
|
||||
if homePageURL == nil {
|
||||
// Base homePageURL off feedURL if needed. Won’t always be accurate, but is good enough.
|
||||
if let feedURL = URL(string: feed.url), let scheme = feedURL.scheme, let host = feedURL.host {
|
||||
homePageURL = scheme + "://" + host + "/"
|
||||
}
|
||||
}
|
||||
if let homePageURL = homePageURL {
|
||||
return favicon(withHomePageURL: homePageURL)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func favicon(with faviconURL: String) -> NSImage? {
|
||||
|
||||
let downloader = faviconDownloader(withURL: faviconURL)
|
||||
|
Loading…
Reference in New Issue
Block a user