[gnome-maps/wip/mlundblad/osm-oauth2] WIP: Migrate to OAuth2 for OSM editing




commit 00bb67c553d4d5f166e60b48d115cc441419413a
Author: Marcus Lundblad <ml dfupdate se>
Date:   Sun Aug 21 00:57:33 2022 +0200

    WIP: Migrate to OAuth2 for OSM editing

 lib/maps-osm-oauth-proxy-call.c |  6 +++---
 lib/maps-osm-oauth-proxy-call.h | 10 +++++-----
 org.gnome.Maps.json             |  6 +++---
 src/osmConnection.js            |  8 +++++---
 4 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/lib/maps-osm-oauth-proxy-call.c b/lib/maps-osm-oauth-proxy-call.c
index 5e9e7544..47359c60 100644
--- a/lib/maps-osm-oauth-proxy-call.c
+++ b/lib/maps-osm-oauth-proxy-call.c
@@ -33,7 +33,7 @@ struct _MapsOSMOAuthProxyCallPrivate
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE(MapsOSMOAuthProxyCall, maps_osm_oauth_proxy_call,
-                           OAUTH_TYPE_PROXY_CALL);
+                           REST_TYPE_OAUTH2_PROXY_CALL);
 
 static gboolean
 maps_osm_oauth_proxy_call_serialize_params (RestProxyCall *call,
@@ -85,9 +85,9 @@ maps_osm_oauth_proxy_call_init (MapsOSMOAuthProxyCall *call)
 }
 
 MapsOSMOAuthProxyCall *
-maps_osm_oauth_proxy_call_new (OAuthProxy *proxy, const char *payload)
+maps_osm_oauth_proxy_call_new (RestOAuth2Proxy *proxy, const char *payload)
 {
-  g_return_val_if_fail (OAUTH_IS_PROXY (proxy), NULL);
+  g_return_val_if_fail (REST_IS_OAUTH2_PROXY (proxy), NULL);
   g_return_val_if_fail (payload != NULL, NULL);
 
   MapsOSMOAuthProxyCall *call =
diff --git a/lib/maps-osm-oauth-proxy-call.h b/lib/maps-osm-oauth-proxy-call.h
index e9c240d8..03c6a363 100644
--- a/lib/maps-osm-oauth-proxy-call.h
+++ b/lib/maps-osm-oauth-proxy-call.h
@@ -22,8 +22,8 @@
 
 #include <glib-object.h>
 
-#include <rest/oauth-proxy-call.h>
-#include <rest/oauth-proxy.h>
+#include <rest/rest-oauth2-proxy-call.h>
+#include <rest/rest-oauth2-proxy.h>
 
 G_BEGIN_DECLS
 
@@ -40,17 +40,17 @@ typedef struct _MapsOSMOAuthProxyCallClass MapsOSMOAuthProxyCallClass;
 
 struct _MapsOSMOAuthProxyCall
 {
-  OAuthProxyCall parent;
+  RestOAuth2ProxyCall parent;
   MapsOSMOAuthProxyCallPrivate *priv;
 };
 
 struct _MapsOSMOAuthProxyCallClass
 {
-  OAuthProxyCallClass parent_class;
+  RestOAuth2ProxyCallClass parent_class;
 };
 
 GType maps_osm_oauth_proxy_call_get_type(void);
-MapsOSMOAuthProxyCall *maps_osm_oauth_proxy_call_new (OAuthProxy *proxy,
+MapsOSMOAuthProxyCall *maps_osm_oauth_proxy_call_new (RestOAuth2Proxy *proxy,
                                                       const char *content);
 
 G_END_DECLS
diff --git a/org.gnome.Maps.json b/org.gnome.Maps.json
index 35a27a54..9558cf4e 100644
--- a/org.gnome.Maps.json
+++ b/org.gnome.Maps.json
@@ -90,9 +90,9 @@
             ],
             "sources" : [
                 {
-                    "type" : "archive",
-                    "url" : "https://gitlab.gnome.org/GNOME/librest/-/archive/1.0.0/librest-1.0.0.tar.gz";,
-                    "sha256" : "eeba5ddbf91a29decec01c3ccce64b922bd9bf52d631e307e185227295aea51d"
+                    "type" : "git",
+                    "url" : "https://gitlab.gnome.org/GNOME/librest.git";,
+                    "branch": "master"
                 }
             ]
         },
diff --git a/src/osmConnection.js b/src/osmConnection.js
index 5a18f350..02ffd376 100644
--- a/src/osmConnection.js
+++ b/src/osmConnection.js
@@ -38,8 +38,10 @@ const BASE_URL = 'https://api.openstreetmap.org/api';
 const API_VERSION = '0.6';
 
 /* OAuth constants */
-const CONSUMER_KEY = '2lbpDoED0ZspGssTBAJ8zOCtrtmUoX4KnmZUIWIK';
-const CONSUMER_SECRET = 'AO9BhDl9sJ33DjaZgQmYcNIuM3ZSml4xtugai6gE';
+const CLIENT_KEY = 'ATOMKAKOXQuAJXpFxkm__nDVRlJLYYmP-0P54UfDnZI';
+const CLIENT_SECRET = '9vda-8M_lt0cLJMLJlbTfJVRDGiS2-pPbeSNMRqBQ0k';
+//const CONSUMER_KEY = '2lbpDoED0ZspGssTBAJ8zOCtrtmUoX4KnmZUIWIK';
+//const CONSUMER_SECRET = 'AO9BhDl9sJ33DjaZgQmYcNIuM3ZSml4xtugai6gE';
 const OAUTH_ENDPOINT_URL = 'https://www.openstreetmap.org/oauth';
 const LOGIN_URL = 'https://www.openstreetmap.org/login';
 
@@ -55,7 +57,7 @@ export class OSMConnection {
         this._session = new Soup.Session({ user_agent : 'gnome-maps/' + pkg.version });
 
         /* OAuth proxy used for making OSM uploads */
-        this._callProxy = Rest.OAuthProxy.new(CONSUMER_KEY, CONSUMER_SECRET,
+        this._callProxy = Rest.OAuth2Proxy.new(CLIENT_KEY, CLIENT_SECRET,
                                               BASE_URL + '/' + API_VERSION,
                                               false);
         GnomeMaps.osm_init();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]