navossoc / KeePass-Yet-Another-Favicon-Downloader

Yet Another Favicon Downloader for KeePass 2.x
MIT License
535 stars 29 forks source link

Option to use Google S2 API for fetching icon #62

Closed Henri-J-Norden closed 2 years ago

Henri-J-Norden commented 2 years ago

Changes

Relevant issues

Fix #60, fix #57, fix #53, fix #52, fix #51, fix #50, fix #49, fix #47, fix #45, fix #44, fix #37, fix #21

clipboard

Fixes partially #48, https://flightradar24.com/ works, but not https://www.flightradar24.com/

Partially implements #42 (16x16 icons only), but could also be done using the Google S2 API.

Fixes partially maybe(?) #26, if the icon is the same as for the "domain" as given by Google.

navossoc commented 2 years ago

Nice job!

I'll make a few minor changes and I let you now.

This week I will release the next version. with a few improvements, including your PR.

If I recall correctly, KeePass now display icons larger than 16x16 somewhere in the UI. I read that on the changelog I think. I need to search it.

[]'s

Hrxn commented 2 years ago

Yeah, always using 32x32 would be nice, in my opinion. Does this Google API provide that?

navossoc commented 2 years ago

Yeah, always using 32x32 would be nice, in my opinion. Does this Google API provide that?

Yes, it does... https://www.google.com/s2/favicons?domain_url=google.com&sz=32

4-FLOSS-Free-Libre-Open-Source-Software commented 2 years ago

wrong place? Just a note for the favicon fetching, there is other more "private" solution existing such as for example:

https://icons.duckduckgo.com/ip3/keepass.info.ico

https://icons.duckduckgo.com/ip3/keepass.info.ico https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion/ip3/keepass.info.ico https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion/ip3/keepass.info.ico

navossoc commented 2 years ago

TBH I'm thinking in ignore this and make a "custom provider" option. @Henri-J-Norden gave me the initial push I needed haha.

Since this favicon services return the image directly, they all should be compatible.

I made a small list so far:

Providers: https://icons.duckduckgo.com/ip3/{URL:HOST}.ico https://api.faviconkit.com/{URL:HOST}/{YAFD:ICON_SIZE} http://www.google.com/s2/favicons?domain={URL:HOST}&sz={YAFD:ICON_SIZE} https://favicon.yandex.net/favicon/{URL:HOST}

Placeholders: {URL:HOST} = www.domain.com {YAFD:ICON_SIZE} = 48

navossoc commented 2 years ago

I was thinking on something like this:

2021-10-19_12-58-46

Any thoughts?

Henri-J-Norden commented 2 years ago

Looks good for the first version!

If there are that many providers, then it might be nice to not be limited to selecting just one. Maybe something like this eventually:

clipboard

where you would have a list of all available (+custom) providers, can individually enable/disable them and reorder them.

The point would be that in case one provider is unable to return an icon it would automatically fall back and try the other ones. Unfortunately, this would be annoying to check... because at least Google and DuckDuckGo seem to always return some "default icon" when they don't have anything better.

Also, I'm not sure in how many cases this would actually be useful, but one such case would be: flightradar24.com on DuckDuckGo (returns default icon) vs flightradar24.com on Google (correct icon).

(It should be noted that www.flightradar24.com doesn't work with either of them, so maybe a feature to try the root domain without www or any other subdomain would instead/also be more useful?)

4-FLOSS-Free-Libre-Open-Source-Software commented 2 years ago

The fallback mechanism would be nice2have. Both by trying next opt-in Provider or direct fetch if fail to provide favicon and vice versa. This would increase user experience. With more successful icon downloads.

Is the default Placeholder icon always the same answer from them? That answer should be ignored\excluded in that case and threatened like an direct fetch fail is done currently.

Retry the root domain sounds not bad but could lead to false positive. Better than nothing? :) this would be last Retry Before give up?

navossoc commented 2 years ago

To be honest this would be great, but I think it's a little bit of engineering for a simple favicon grabber hahaha...

I was thinking about this and I think there is a simplification that may resolve most of the use cases.

Same as the picture as above, but the new option will be for select an "custom (extra)" downloader provider not the a "default one".

Something like this: 2021-10-19_20-26-25

Default (no custom provider selected): image

If you select a custom provider (enable it), you will get an extra item on the context menu list: image

I don't like the idea of trying the root domain, most of the times it may be the same owner of the site, but I'm sure there will be cases that the domain root is another totally different site. (It would also be necessary to maintain a TLD list, like Nager.PublicSuffix.)

@Henri-J-Norden flightradar24.com shows an icon on Google Chrome for me.

Also the fallback is kind of a problem, how much time do you want to wait for a icon to be retrieved? Which one has the best icon? Should we test it on 5 providers? Do I really want to sent my information to that third party? I'm not a conspiracy guy, but I know a few people are 😝 .

The default provider (local) are able to solve most of the cases (especially after the latest updates), so just an extra one I think it should be enough.

We could also create a submenu and put every provider there, but, let's think again is it really that necessary? Besides it will take two clicks for a single action.

navossoc commented 2 years ago

It can be tested right here: https://github.com/navossoc/KeePass-Yet-Another-Favicon-Downloader/releases/tag/v1.2.5.0-pre

Let me know...

[]'s

4-FLOSS-Free-Libre-Open-Source-Software commented 2 years ago

Do I really want to sent my information to that third party?

Nope.

I'm not a conspiracy guy, but I know a few people are 😝 .

🤔 Duck duck go TOS is fine so far, compared to other named providers. If you require 3rd party for icons but don't like to let them know who access which And all site, use their Official anonymous .onion address icon fetcher I posted above.

4-FLOSS-Free-Libre-Open-Source-Software commented 2 years ago

The default provider (local) are able to solve most of the cases (especially after the latest updates), so just an extra one I think it should be enough.

Having the alternative alone, in case of icon fetch fail is still nice addition and time saving while maintaining fancy entries! Actually I personaLly go to view-source:{URL} in that case it can't download automatically and copy the favicon URL manually into the explorer file path from icon chooser file picking dialog.

Hrxn commented 2 years ago

[..] Actually I personaLly go to view-source:{URL} in that case it can't download automatically and copy the favicon URL manually into the explorer file path from icon chooser file picking dialog.

Right.. I remember this. But what about current versions of Windows, what is actually handling the download in such a case? I sure hope it's not ActiveX/IE components.

navossoc commented 2 years ago

Well, well, well...

Is anyone using it? Any issues? Should we release it on the wild? hahaha I didn't use it too much in the last week, but as far I can tell it's working as expected.

navossoc commented 2 years ago

Release v1.2.5.0.

Thanks @Henri-J-Norden for the push we needed to make this feature happens ;)