SimonHalvdansson / Harmonic-HN

Modern Android client for Hacker News

Home Page:https://play.google.com/store/apps/details?id=com.simon.harmonichackernews

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Favicons sometimes incorrect

jonas-w opened this issue · comments

I don't know why exactly sometimes the favicons are weird, but for example minecraft.wiki shows the mastodon logo https://api.faviconkit.com/minecraft.wiki/80 but if you use a slightly lower resolution https://api.faviconkit.com/minecraft.wiki/76 it returns the correct one. Maybe use 76 instead of 80, as 76 is some kind of "standard" size and if you put in a size which does not exist, faviconkit will show you a larger size if that does exist. e.g. https://api.faviconkit.com/minecraft.wiki/80 returns 144 ⇾ https://api.faviconkit.com/minecraft.wiki/144

I also very often see the archive.org logo on entries that definitely have nothing to do with archive.org
You could also don't specify a size at all https://api.faviconkit.com/minecraft.wiki/ which would in this case also return the correct favicon.

Hmm interesting, yeah perhaps leaving the field blank is the best way to do things. When I Googled this a bit I realized there are some alternatives available also:

https://icons.duckduckgo.com/ip3/openculture.com.ico
https://www.google.com/s2/favicons?domain=openculture.com&sz=128

which perhaps are faster than the current API - although they both have GitHub favicons that look worse then the current one so it would hurt a bit to change. With the regards to the archive.org thing, I assume the Google one is the most "stable" option. I tried them all right now and faviconkit was the most up-to-date actually.

For now, I'll remove the /80 thing - let me know if you have any more input on this.

sounds good to me, I just found an example of the archive.org favicon https://api.faviconkit.com/pearl-hifi.com https://news.ycombinator.com/item?id=37731027

Yeah those things are unfortunate - for pearl.hifi.com both Google and DDG work properly for me right now. I'm thinking letting the user set this (with faviconkit as the default) maybe isn't so bad of a solution.

commented

For now, I'll remove the /80 thing - let me know if you have any more input on this.

Actually I'm curious why you're trying to load size 80 at all. Your imageview size is 17x17dp (which is already unusual, multiple of 4 is more common) so in px it will be one of 12.75, 17, 25.5, 34, 51, 68.

6ebd0fe

Is it intentional that the Google provider still uses 80 as the size?
The Google provider also yields the wrong favicon for minecraft.wiki regardless of size. Actually, the DuckDuckGo provider works the best for these two domains.

Google needed some size to not load the 16x16 icon (which is too small) but now I investigated it a bit more and Google needs you to indicate the exact correct size and therefore I changed it to 128x128 (which after 16x16 seems to be the most common one). Also the hardcoded 80x80 resizing is replaced by a dynamic 17dpx17dp in pixels.

Also the reason the favicon is 17dp is that I think it looked the best - I usually follow 4dp increments but with these precise layout things it is more about looking reasonable in size next to the text.