Update the favicon if available in the feed

This commit is contained in:
Fabio Manganiello 2023-01-20 23:35:28 +01:00
parent 897d12ed4e
commit dfd75221ca
2 changed files with 8 additions and 0 deletions

View file

@ -59,6 +59,7 @@ const parseAtomFeed = (feed: Element, url: string | null) => {
description: getNodeContent(feed, 'subtitle'), description: getNodeContent(feed, 'subtitle'),
feedUrl: url?.length ? url : window.location.href, feedUrl: url?.length ? url : window.location.href,
homeUrl: homeURL, homeUrl: homeURL,
iconUrl: iconURL,
image: { image: {
imageUrl: logoURL || iconURL, imageUrl: logoURL || iconURL,
targetUrl: homeURL, targetUrl: homeURL,

View file

@ -64,6 +64,13 @@ export default {
async mounted() { async mounted() {
this.feed = (await browser.storage.local.get('feedData'))?.feedData || {} this.feed = (await browser.storage.local.get('feedData'))?.feedData || {}
if (this.feed.iconUrl) {
const link = document.querySelector("link[rel*='icon']") || document.createElement('link')
link.type = 'image/x-icon'
link.rel = 'shortcut icon'
link.href = this.feed.iconUrl
document.getElementsByTagName('head')[0].appendChild(link)
}
}, },
} }
</script> </script>