Hello community, here is the log from the commit of package syncthing-gtk for openSUSE:Factory checked in at 2016-06-29 15:10:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/syncthing-gtk (Old) and /work/SRC/openSUSE:Factory/.syncthing-gtk.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "syncthing-gtk" Changes: -------- --- /work/SRC/openSUSE:Factory/syncthing-gtk/syncthing-gtk.changes 2016-05-30 09:56:28.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.syncthing-gtk.new/syncthing-gtk.changes 2016-06-29 15:10:54.000000000 +0200 @@ -1,0 +2,7 @@ +Sat Jun 25 19:16:12 UTC 2016 - sor.alexei@meowr.ru + +- Update to version 0.9.0.3: + * Better cookie handling when no username nor API key is set. + * Update about dialog with link to author's Patreon page. + +------------------------------------------------------------------- Old: ---- syncthing-gtk-0.9.0.2.tar.gz New: ---- syncthing-gtk-0.9.0.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ syncthing-gtk.spec ++++++ --- /var/tmp/diff_new_pack.aw6a6R/_old 2016-06-29 15:10:55.000000000 +0200 +++ /var/tmp/diff_new_pack.aw6a6R/_new 2016-06-29 15:10:55.000000000 +0200 @@ -19,7 +19,7 @@ %global __requires_exclude typelib\\((Caja|Nautilus|Nemo)\\) %define _name syncthing_gtk Name: syncthing-gtk -Version: 0.9.0.2 +Version: 0.9.0.3 Release: 0 Summary: Syncthing Gtk-based graphical interface License: GPL-2.0+ ++++++ syncthing-gtk-0.9.0.2.tar.gz -> syncthing-gtk-0.9.0.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syncthing-gtk-0.9.0.2/README.md new/syncthing-gtk-0.9.0.3/README.md --- old/syncthing-gtk-0.9.0.2/README.md 2016-05-23 09:58:04.000000000 +0200 +++ new/syncthing-gtk-0.9.0.3/README.md 2016-06-13 13:59:40.000000000 +0200 @@ -5,14 +5,14 @@ [![screenshot1](http://i.imgur.com/N36wmBM.png)](http://i.imgur.com/eX250tQ.png) [![screenshot2](http://i.imgur.com/43mmnC7.png)](http://i.imgur.com/RTRgRdC.png) [![screenshot3](http://i.imgur.com/KDBYekd.png)](http://i.imgur.com/OZ4xEeH.jpg) -Supported Syncthing features: +##### Supported Syncthing features - Everything what WebUI can display - Adding / editing / deleting nodes - Adding / editing / deleting repositories - Restart / shutdown server - Editing daemon settings -Additional features: +##### Additional features - First run wizard for initial configuration - Running Syncthing daemon in background - Half-automatic setup for new nodes and repositories @@ -20,7 +20,11 @@ - Nautilus (a.k.a. Files), Nemo and Caja integration - Desktop notifications -Packages: +##### Like what I'm doing? +<a href="https://www.patreon.com/kozec">Help me become filthy rich on <img src="http://kozec.com/patreon-logo.png"></a> + + +##### Packages - Ubuntu (deb-based distros): in [Web Upd8 PPA](https://launchpad.net/~nilarimogard/+archive/ubuntu/webupd8/) (thanks!) or [DEBs](http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu/pool/main/s/syncthing-g...) - Arch Linux: In [[community] repository](https://www.archlinux.org/packages/community/any/syncthing-gtk/) - Fedora: [in decathorpe's copr repository](https://copr.fedoraproject.org/coprs/decathorpe/syncthing/) @@ -28,7 +32,7 @@ - Windows: Get [latest installer from here](https://github.com/kozec/syncthing-gui/releases/latest), or use [the Chocolatey package](https://chocolatey.org/packages/syncthing-gtk). - Or, in worst case scenario, download [latest tarball](https://github.com/kozec/syncthing-gui/releases/latest), extract it and run syncthing-gtk.py. -Dependencies: +##### Dependencies - python 2.7, GTK 3.8 or newer and [PyGObject](https://live.gnome.org/PyGObject) - [python-gi-cairo](https://packages.debian.org/sid/python-gi-cairo) and [gir1.2-rsvg-2.0](https://packages.debian.org/sid/gir1.2-rsvg-2.0) on debian based distros (included in PyGObject elsewhere) - [python-dateutil](http://labix.org/python-dateutil) (Python 2 version) @@ -36,12 +40,12 @@ - [psmisc](http://psmisc.sourceforge.net) (for the `killall` command) - [Syncthing][syncthing] v0.12 or newer -Optional Dependencies: +##### Optional Dependencies - [pyinotify](https://github.com/seb-m/pyinotify/wiki) for instant synchronization. - libnotify for desktop notifications. - nautilus-python, nemo-python or caja-python for filemanager integration -Windows Building Dependencies _(you don't need to install these just to **run** Syncthing-GTK)_ +##### Windows Building Dependencies _(you don't need to install these just to **run** Syncthing-GTK)_ - Python for Windows 2.7 - [PyGObject for Windows](http://sourceforge.net/projects/pygobjectwin32/) with GTK3 enabled (tested with version 3.14.0) - [python-dateutil](http://labix.org/python-dateutil) (Python 2 version) @@ -50,9 +54,7 @@ - [syncthing-inotify](https://github.com/syncthing/syncthing-inotify) (optional) - [NSIS2](http://nsis.sourceforge.net/NSIS_2) with NSISdl, [ZipDLL](http://nsis.sourceforge.net/ZipDLL_plug-in) and [FindProcDLL](http://forums.winamp.com/showpost.php?p=2777729&postcount=8) plugins (optional, for building installer) -Related links: -- http://syncthing.net +##### Related links +- https://syncthing.net - https://forum.syncthing.net/t/syncthing-gtk-gui-for-syncthing-now-with-inoti... - https://forum.syncthing.net/t/lxle-a-respin-of-lubuntu-now-has-syncthing-inc... - -[syncthing]: https://syncthing.net diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syncthing-gtk-0.9.0.2/about.glade new/syncthing-gtk-0.9.0.3/about.glade --- old/syncthing-gtk-0.9.0.2/about.glade 2016-05-23 09:58:04.000000000 +0200 +++ new/syncthing-gtk-0.9.0.3/about.glade 2016-06-13 13:59:40.000000000 +0200 @@ -1,39 +1,149 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.18.3 --> <interface> - <requires lib="gtk+" version="3.8"/> - <object class="GtkAboutDialog" id="dialog"> + <requires lib="gtk+" version="3.10"/> + <object class="GtkDialog" id="dialog"> <property name="can_focus">False</property> + <property name="title" translatable="yes">About SC-Controller</property> + <property name="icon">../images/sc-controller-small.svg</property> <property name="type_hint">dialog</property> - <property name="program_name">Syncthing-GTK</property> - <property name="copyright" translatable="yes">Code&UI © 2014 Kozec</property> - <property name="comments" translatable="yes">GTK GUI and notification area icon for Syncthing</property> - <property name="website">https://github.com/kozec/syncthing-gui</property> - <property name="website_label" translatable="yes">GitHub</property> - <property name="logo">icons/st-gtk-logo.png</property> - <property name="license_type">gpl-2-0</property> <signal name="response" handler="on_dialog_response" swapped="no"/> <child internal-child="vbox"> - <object class="GtkBox" id="aboutdialog-vbox1"> + <object class="GtkBox" id="vb1"> <property name="can_focus">False</property> <property name="orientation">vertical</property> <property name="spacing">2</property> <child internal-child="action_area"> - <object class="GtkButtonBox" id="aboutdialog-action_area1"> + <object class="GtkButtonBox" id="vb2"> <property name="can_focus">False</property> <property name="layout_style">end</property> <child> - <placeholder/> + <object class="GtkButton" id="btnClose"> + <property name="label">gtk-close</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + <signal name="clicked" handler="on_dialog_response" swapped="no"/> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="vb3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_left">50</property> + <property name="margin_right">50</property> + <property name="margin_top">10</property> + <property name="margin_bottom">10</property> + <property name="orientation">vertical</property> <child> - <placeholder/> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_bottom">10</property> + <property name="pixbuf">icons/st-gtk-logo.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><span size="large"><b>Syncthing-GTK</b></span></property> + <property name="use_markup">True</property> + <property name="justify">center</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="lblVersion"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_top">5</property> + <property name="margin_bottom">10</property> + <property name="label" translatable="yes">(version)</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_bottom">20</property> + <property name="label" translatable="yes">GUI and notification area icon for Syncthing</property> + <property name="use_markup">True</property> + <property name="justify">center</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="margin_bottom">50</property> + <property name="label" translatable="yes">Code&UI © 2016 Kozec +Source code available on <b><a href="http://github.com/kozec/syncthing-gtk">GitHub</a></b> +Saying thanks in monetary way available on <b><a href="https://www.patreon.com/kozec">Patreon</a></b></property> + <property name="use_markup">True</property> + <property name="justify">center</property> + <property name="yalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="margin_top">10</property> + <property name="label" translatable="yes"><small>This program comes with absolutely no warranty. +See the <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, version 2 or later</a> for details.</small></property> + <property name="use_markup">True</property> + <property name="justify">center</property> + <property name="yalign">1</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">5</property> + </packing> </child> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> - <property name="pack_type">end</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> </object> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syncthing-gtk-0.9.0.2/scripts/syncthing-gtk-exe.py new/syncthing-gtk-0.9.0.3/scripts/syncthing-gtk-exe.py --- old/syncthing-gtk-0.9.0.2/scripts/syncthing-gtk-exe.py 2016-05-23 09:58:04.000000000 +0200 +++ new/syncthing-gtk-0.9.0.3/scripts/syncthing-gtk-exe.py 2016-06-13 13:59:40.000000000 +0200 @@ -31,6 +31,8 @@ from syncthing_gtk.tools import get_install_path path = get_install_path() os.chdir(path) + print os.environ["PATH"] + os.environ["PATH"] = path from syncthing_gtk.tools import init_logging, init_locale from syncthing_gtk import windows diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syncthing-gtk-0.9.0.2/syncthing_gtk/aboutdialog.py new/syncthing-gtk-0.9.0.3/syncthing_gtk/aboutdialog.py --- old/syncthing-gtk-0.9.0.2/syncthing_gtk/aboutdialog.py 2016-05-23 09:58:04.000000000 +0200 +++ new/syncthing-gtk-0.9.0.3/syncthing_gtk/aboutdialog.py 2016-06-13 13:59:40.000000000 +0200 @@ -58,7 +58,7 @@ # App is None or daemon version is not yet known pass # Display versions in UI - self.dialog.set_version(app_ver) + self.builder.get_object("lblVersion").set_label(app_ver) def on_dialog_response(self, *a): self.close() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syncthing-gtk-0.9.0.2/syncthing_gtk/app.py new/syncthing-gtk-0.9.0.3/syncthing_gtk/app.py --- old/syncthing-gtk-0.9.0.2/syncthing_gtk/app.py 2016-05-23 09:58:04.000000000 +0200 +++ new/syncthing-gtk-0.9.0.3/syncthing_gtk/app.py 2016-06-13 13:59:40.000000000 +0200 @@ -258,7 +258,8 @@ add_simple_action('show_id', self.cb_menu_show_id) add_simple_action('daemon_shutdown', self.cb_menu_shutdown) add_simple_action('daemon_restart', self.cb_menu_restart) - + + def setup_widgets(self): self.builder = UIBuilder() # Set conditions for UIBuilder @@ -1169,6 +1170,11 @@ if not self["window"].is_visible(): self["window"].show() if IS_WINDOWS and not self.config["window_position"] is None: + scr = Gdk.Screen.get_default() + self.config["window_position"] = ( + min(self.config["window_position"][0], scr.width() - 300), + min(self.config["window_position"][1], scr.height() - 100) + ) self["window"].move(*self.config["window_position"] ) if self.connect_dialog != None: self.connect_dialog.show() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syncthing-gtk-0.9.0.2/syncthing_gtk/daemon.py new/syncthing-gtk-0.9.0.3/syncthing_gtk/daemon.py --- old/syncthing-gtk-0.9.0.2/syncthing_gtk/daemon.py 2016-05-23 09:58:04.000000000 +0200 +++ new/syncthing-gtk-0.9.0.3/syncthing_gtk/daemon.py 2016-06-13 13:59:40.000000000 +0200 @@ -419,13 +419,28 @@ # Too late, throw it away con.close(None) log.verbose("Discarded old connection for %s", command) - # Build GET request - get_str = "\r\n".join([ - "GET /rest/%s HTTP/1.0" % command, - (("X-API-Key: %s" % self._api_key) if not self._api_key is None else "X-nothing: x"), - "Connection: close", - "", "" - ]).encode("utf-8") + if self._CSRFtoken is None and self._api_key is None: + # Request CSRF token first + log.verbose("Requesting cookie") + get_str = "\r\n".join([ + "GET / HTTP/1.0", + "Host: %s" % self._address, + (("X-API-Key: %s" % self._api_key) if not self._api_key is None else "X-nothing: x"), + "Connection: close", + "", + "", + ]).encode("utf-8") + else: + # Build GET request + get_str = "\r\n".join([ + "GET /rest/%s HTTP/1.0" % command, + "Cookie: %s" % self._CSRFtoken, + (("X-%s" % self._CSRFtoken.replace("=", ": ")) if self._CSRFtoken else "X-nothing: x"), + (("X-API-Key: %s" % self._api_key) if not self._api_key is None else "X-nothing2: x"), + + "Connection: close", + "", "" + ]).encode("utf-8") # Send it out and wait for response try: con.get_output_stream().write_all(get_str, None) @@ -456,6 +471,20 @@ return con.close(None) response = "".join(buffer) + if self._CSRFtoken is None and self._api_key is None: + # I wanna cookie! + self._parse_csrf(response.split("\n")) + if self._CSRFtoken == None: + # This is pretty fatal and likely to fail again, + # so request is not repeated automaticaly + if error_callback == None: + log.error("Request '%s' failed: Error: failed to get CSRF cookie from daemon", command) + else: + self._rest_error(Exception("Failed to get CSRF cookie"), epoch, command, callback, error_callback, callback_data) + return + # Repeat request with acqiured cookie + self._rest_request(command, callback, error_callback, *callback_data) + return # Split headers from response try: headers, response = response.split("\r\n\r\n", 1) @@ -557,9 +586,9 @@ post_str = "\r\n".join([ "POST /rest/%s HTTP/1.0" % command, "Connection: close", - "Cookie: CSRF-Token=%s" % self._CSRFtoken, - "X-CSRF-Token: %s" % self._CSRFtoken, - (("X-API-Key: %s" % self._api_key) if not self._api_key is None else "X-nothing: x"), + "Cookie: %s" % self._CSRFtoken, + (("X-%s" % self._CSRFtoken.replace("=", ": ")) if self._CSRFtoken else "X-nothing: x"), + (("X-API-Key: %s" % self._api_key) if not self._api_key is None else "X-nothing2: x"), "Content-Length: %s" % len(json_str), "Content-Type: application/json", "", @@ -598,16 +627,7 @@ # Parse response if self._CSRFtoken is None and self._api_key is None: # I wanna cookie! - response = response.split("\n") - for d in response: - if d.startswith("Set-Cookie:"): - for c in d.split(":", 1)[1].split(";"): - if c.strip().startswith("CSRF-Token="): - self._CSRFtoken = c.split("=", 1)[1].strip(" \r\n") - log.verbose("Got new cookie: %s", self._CSRFtoken) - break - if self._CSRFtoken != None: - break + self._parse_csrf(response.split("\n")) if self._CSRFtoken == None: # This is pretty fatal and likely to fail again, # so request is not repeated automaticaly @@ -672,6 +692,17 @@ log.error("Post '%s' failed; Repeating...", command) self.timer(None, 1, self._rest_post, command, data, callback, error_callback, callback_data) + def _parse_csrf(self, response): + for d in response: + if d.startswith("Set-Cookie:"): + for c in d.split(":", 1)[1].split(";"): + if c.strip().startswith("CSRF-Token-"): + self._CSRFtoken = c.strip(" \r\n") + log.verbose("Got new cookie: %s", self._CSRFtoken) + break + if self._CSRFtoken != None: + break + def _request_config(self, *a): """ Request settings from syncthing daemon """ self._rest_request("system/config", self._syncthing_cb_config, self._syncthing_cb_config_error) @@ -984,7 +1015,7 @@ def _syncthing_cb_config_error(self, exception, command): self.cancel_all() if isinstance(exception, GLib.GError): - if exception.code in (0, 39, 34): # Connection Refused / Cannot connect to destination + if exception.code in (0, 39, 34, 45): # Connection Refused / Cannot connect to destination # It usualy means that daemon is not yet fully started or not running at all. epoch = self._epoch self.emit("connection-error", Daemon.REFUSED, exception.message, exception) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/syncthing-gtk-0.9.0.2/syncthing_gtk/windows.py new/syncthing-gtk-0.9.0.3/syncthing_gtk/windows.py --- old/syncthing-gtk-0.9.0.2/syncthing_gtk/windows.py 2016-05-23 09:58:04.000000000 +0200 +++ new/syncthing-gtk-0.9.0.3/syncthing_gtk/windows.py 2016-06-13 13:59:40.000000000 +0200 @@ -15,7 +15,7 @@ log = logging.getLogger("windows.py") SM_SHUTTINGDOWN = 0x2000 -ST_INOTIFY_EXE = "syncthing-inotify-v0.7.exe" +ST_INOTIFY_EXE = "syncthing-inotify-v0.8.2.exe" def fix_localized_system_error_messages(): """