Skip to content
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

Fetch favicon from the root of the website and use Google as a fallback #36

Merged
merged 4 commits into from
Oct 11, 2016
Merged

Conversation

magkopian
Copy link
Contributor

* Replace favicon fetching using Google with fetching from the root of the website
* Follow up to 3 http redirects for the favicon
* Add download favicon from Google as fallback
Copy link
Member

@droidmonkey droidmonkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QNetworkRequest defines handling of redirects. That behavior should be used over coding a new method of detecting redirection.

http://doc.qt.io/qt-5/qnetworkrequest.html#setMaximumRedirectsAllowed

@magkopian
Copy link
Contributor Author

magkopian commented Oct 10, 2016

That feature of QNetworkRequest was introduced on the version 5.6 of Qt and using it will mean that we'll have to increase the minimum required version of Qt from 5.2 which currently is, to 5.6. And 5.6 is still not available on some distros such as Debian Jessie, which by the way is what I'm using.

@droidmonkey
Copy link
Member

Good point. I didn't know how "old" Qt 5.6 was.

Copy link
Member

@droidmonkey droidmonkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second code review changes requested.

@@ -74,6 +74,9 @@ private Q_SLOTS:
Database* m_database;
Uuid m_currentUuid;
QString m_url;
QUrl redirectUrl;
Copy link
Member

@droidmonkey droidmonkey Oct 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new member variables do not conform to the coding style. Member variables should be preceded with m_ to differentiate from local/stack variables.

@@ -141,30 +141,42 @@ void EditWidgetIcons::setUrl(const QString &url)
abortFaviconDownload();
}

void EditWidgetIcons::downloadFavicon()
void EditWidgetIcons::downloadFavicon(QUrl url)
Copy link
Member

@droidmonkey droidmonkey Oct 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reviewing the flow of the code I do not like how this function is used in very different contexts. For example, on first use (no url provided) it kicks off the favicon and redirection code block. On subsequent uses it either follows a redirect or uses the Google URL provided as a last resort. The main (and only) purpose of this function should be to kickstart the download process. Different functions (private) should be defined to handle the different behavior. Or just bake into the onRequestFinished call since it is just a single line of code.

@magkopian
Copy link
Contributor Author

magkopian commented Oct 11, 2016

Sorry for the last commit but I've noticed it after pushing, so I couldn't combine the commits together.

@droidmonkey
Copy link
Member

Excellent rewrite, the flow is MUCH clearer now when you read the code blocks. Thanks!

@droidmonkey droidmonkey merged commit 119af3d into keepassxreboot:develop Oct 11, 2016
@phoerious phoerious added this to the v2.1.0 milestone Jan 14, 2017
kneitinger added a commit to kneitinger/keepassxc that referenced this pull request Sep 19, 2018
kneitinger added a commit to kneitinger/keepassxc that referenced this pull request Sep 20, 2018
droidmonkey pushed a commit to kneitinger/keepassxc that referenced this pull request Sep 20, 2018
droidmonkey pushed a commit that referenced this pull request Sep 21, 2018
…er (#2309)

* Replace Google with DuckDuckGo for optional fallback favicon fetch URL
Modify the work initially done in #36, and most recently modified in #1786,
to use DuckDuckGo's https://icons.duckduckgo.com/ip3/www.example.com.ico
favicon endpoint.

Fixes #2258

* Close failed favicon fetch progress bars

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: #2265
@Germano0 Germano0 mentioned this pull request Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants