[chrome-gnome-shell] connector: use POST request for update check



commit 37ba2ea9ec5408abecf80ee93087fb2722b57690
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Sun Jan 13 11:36:28 2019 +0400

    connector: use POST request for update check
    
    Bug: https://github.com/nE0sIghT/chrome-gnome-shell-mirror/issues/97
    See-Also: 
https://gitlab.gnome.org/Infrastructure/extensions-web/commit/0b38da1b2b440db1b4eb767cff74acf8f8de18e0

 README.md                       |  2 +-
 connector/chrome-gnome-shell.py | 13 ++++++-------
 2 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/README.md b/README.md
index b5dab12..4fd48dd 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ Requirements
  * GNOME Shell
  * Python 2.7+ or 3.x
  * PyGObject
- * Python Requests 2.x
+ * Python Requests >= 2.4.2
 
 Installation
 ------------
diff --git a/connector/chrome-gnome-shell.py b/connector/chrome-gnome-shell.py
index 1829726..607ea92 100755
--- a/connector/chrome-gnome-shell.py
+++ b/connector/chrome-gnome-shell.py
@@ -587,25 +587,23 @@ class ChromeGNOMEShell(Gio.Application):
 
         if extensions:
             http_request = {
-                'shell_version': self.shell_proxy.get_cached_property("ShellVersion").unpack(),
-                'installed': {}
+                'shell_version': self.shell_proxy.get_cached_property("ShellVersion").unpack()
             }
+            installed = {}
 
             for uuid in extensions:
                 # gnome-shell/js/misc/extensionUtils.js
                 # EXTENSION_TYPE.PER_USER = 2
                 if is_uuid(uuid) and extensions[uuid]['type'] == 2 and (not enabled_only or uuid in 
enabled_extensions):
                     try:
-                        http_request['installed'][uuid] = {
+                        installed[uuid] = {
                             'version': int(extensions[uuid]['version'])
                         }
                     except (ValueError, KeyError):
-                        http_request['installed'][uuid] = {
+                        installed[uuid] = {
                             'version': 1
                         }
 
-            http_request['installed'] = json.dumps(http_request['installed'])
-
             proxies = Gio.ProxyResolver.get_default().lookup(update_url)
             if proxies is not None:
                 proxy = proxies[0]
@@ -617,8 +615,9 @@ class ChromeGNOMEShell(Gio.Application):
                         proxies[scheme] = proxy
 
             try:
-                response = requests.get(
+                response = requests.post(
                     update_url,
+                    json=installed,
                     params=http_request,
                     proxies=proxies,
                     timeout=5


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