-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace Google with DuckDuckGo as the optional fallback favicon fetcher #2309
Replace Google with DuckDuckGo as the optional fallback favicon fetcher #2309
Conversation
265d530
to
8f18515
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, just naming convention changes.
src/core/Config.cpp
Outdated
@@ -148,7 +148,7 @@ void Config::init(const QString& fileName) | |||
m_defaults.insert("security/passwordscleartext", false); | |||
m_defaults.insert("security/hidepassworddetails", true); | |||
m_defaults.insert("security/autotypeask", true); | |||
m_defaults.insert("security/IconDownloadFallbackToGoogle", false); | |||
m_defaults.insert("security/IconDownloadFallbackToDuckDuckGo", false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be best to name this "security/IconDownloadFallback" in case we change the service again in the future or allow for a choice in services.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea!
src/gui/EditWidgetIcons.cpp
Outdated
if (config()->get("security/IconDownloadFallbackToGoogle", false).toBool()) { | ||
QUrl urlGoogle = QUrl("https://www.google.com/s2/favicons"); | ||
// Try to use DuckDuckGo fallback, if enabled | ||
if (config()->get("security/IconDownloadFallbackToDuckDuckGo", false).toBool()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, let's keep this generic: "QUrl fallbackUrl = ..."
Modify the work initially done in keepassxreboot#36, and most recently modified in keepassxreboot#1786, to use DuckDuckGo's https://icons.duckduckgo.com/ip3/www.example.com.ico favicon endpoint. Fixes keepassxreboot#2258
Name the UrlFetchProgressDialog() with the corresponding URL in order to be identified by name by its parent when the failed request is handeled in EditWidgetIcons::fetchFinished(). fetchFinished() retrieves the relevant UrlFetchProgressDialog() and calls close() on it. Fixes: keepassxreboot#2265
54519fe
to
b4ae46f
Compare
Whoops, something crazy happened. I rebased your changes onto develop and lost your last commit. Please reapply your fixes to the current head, thanks. |
Change variables that reference the current external favicon fallback service, DuckDuckGo, to instead generically reference fallback URLs generically, to facilitate ease of any potential future service switch
Great work, looking forward to more PR's! |
Thanks! |
Description
Transition to DuckDuckGo as Fallback Favicon Fetcher
Modified the fallback HTTP request to use DuckDuckGo (which uses paths to specify the site whose favicon should be retrieved) instead of Google which used params to specify the target site). Additionally, changed references to "Google" to "DuckDuckGo" in ui elements and variables.
Close Failed Favicon Fetch Progress Bars
Prior to my fix, when a fetch failed, it was being hidden (and not ever closed) immediately after failing, only to be unhidden by the timeout specified by
setMinimumDuration()
being reached. InEditWidgetIcons::fetchFinished()
, the error state of the fetch is established, so it seemed like the correct place to close theUrlFetchProgressDialog
. The only issue is that the progress widget is only ever bound to a variable locally in a different function. TheEditWidgetIcons
object is the parent of the progress widget, so we can get a reference to the progress widget viafindChild()
, however we need a name to lookup to use it. Since the url being queried is known at widget create time and destroy time, that seemed like the ideal choice to uniquely name the object.Motivation and context
Transition to DuckDuckGo as fallback fetcher fixes #2258
Closing of progress bars of failed fetches fixes #2265
How has this been tested?
First, ran all existing unit test successfully. Then, manually tested functionality:
https://fedex.com
is a URL that I know will always fall through to the fallback fetcher if enabled, so I deleted it's icon, and tried to fetch:Screenshot shows that DuckDuckGo is the optional fallback that can be enabled according to the message.
/favicon.ico
file, and DuckDuckGo) fail and their progress bars disappear. An error message is correctly displayed:Types of changes
Checklist:
-DWITH_ASAN=ON
. [REQUIRED]