[shotwell] flickr: Catching load errors broke flickr auth
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell] flickr: Catching load errors broke flickr auth
- Date: Mon, 19 Aug 2019 14:52:39 +0000 (UTC)
commit 22ff61b72d4e38608a1fd47229f04117771f3dc7
Author: Jens Georg <mail jensge org>
Date: Mon Aug 19 16:42:55 2019 +0200
flickr: Catching load errors broke flickr auth
Turns out the real reason for #80 was that WebKit does not allow
redirection to custom uri schemes anymore from HTTPS
Without catching the load error, the LOAD_FINISHED signal was sent
anyway. Now we catche the signal and do not set the error if it is
caused by an uri with the custom scheme.
Ideally we could convince webkit to go to the custom scheme as before,
though
plugins/authenticator/shotwell/FlickrPublishingAuthenticator.vala | 4 ++++
plugins/common/WebAuthenticationPane.vala | 5 +++++
2 files changed, 9 insertions(+)
---
diff --git a/plugins/authenticator/shotwell/FlickrPublishingAuthenticator.vala
b/plugins/authenticator/shotwell/FlickrPublishingAuthenticator.vala
index ea4d9ce3..82448e26 100644
--- a/plugins/authenticator/shotwell/FlickrPublishingAuthenticator.vala
+++ b/plugins/authenticator/shotwell/FlickrPublishingAuthenticator.vala
@@ -51,6 +51,10 @@ namespace Publishing.Authenticator.Shotwell.Flickr {
var ctx = WebKit.WebContext.get_default();
ctx.register_uri_scheme("shotwell-auth", this.on_shotwell_auth_request_cb);
+
+ var mgr = ctx.get_security_manager();
+ mgr.register_uri_scheme_as_secure("shotwell-auth");
+ mgr.register_uri_scheme_as_cors_enabled("shotwell-auth");
}
public override void on_page_load() {
diff --git a/plugins/common/WebAuthenticationPane.vala b/plugins/common/WebAuthenticationPane.vala
index 1704780e..43afe651 100644
--- a/plugins/common/WebAuthenticationPane.vala
+++ b/plugins/common/WebAuthenticationPane.vala
@@ -43,6 +43,11 @@ namespace Shotwell.Plugins.Common {
}
private bool on_page_load_failed (WebKit.LoadEvent load_event, string uri, Error error) {
+ // OAuth call-back scheme. Produces a load error because it is not HTTP(S)
+ // Do not set the load_error, but continue the error handling
+ if (uri.has_prefix ("shotwell-auth://"))
+ return false;
+
critical ("Failed to load uri %s: %s", uri, error.message);
this.load_error = error;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]