From 18b0565ea636902d692677a4969f6e47bb997fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 28 Jun 2022 11:19:31 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20swu:=20Fix=20multiple=20cred?= =?UTF-8?q?entials=20saving?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We make sure to check if any of the credentials we support are contained in the incoming settings data and if so set that, and only that, on our plugin settings, instead of overwriting the stored credentials with just those that changed. See #4540 --- src/octoprint/plugins/softwareupdate/__init__.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index 8783720e8..0511eadbb 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -773,7 +773,9 @@ class SoftwareUpdatePlugin( def on_settings_save(self, data): # ~~ plugin settings - for key in self.get_settings_defaults(): + defaults = self.get_settings_defaults() + + for key in defaults: if key in ( "checks", "cache_ttl", @@ -783,6 +785,7 @@ class SoftwareUpdatePlugin( "octoprint_checkout_folder", "octoprint_type", "octoprint_release_channel", + "credentials", ): continue if key in data: @@ -912,6 +915,14 @@ class SoftwareUpdatePlugin( if update_pip_check_config: self._invalidate_version_cache("pip") + # ~~ credentials + + if "credentials" in data: + credentials = data["credentials"] + for key in defaults["credentials"]: + if key in credentials: + self._settings.set(["credentials", key], credentials[key]) + def get_settings_version(self): return 9 From 0af5972a285a516d960c97250b5b66bff76cb3a1 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 28 Jun 2022 13:35:37 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=90=9B=20Fix=20skip=20dialog=20in=20w?= =?UTF-8?q?izard=20popping=20up=20twice=20(#4561)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * remove show.bs.tab listener which triggered twice the innerTabShown * add myself in the authors files --- AUTHORS.md | 1 + .../static/js/lib/jquery/jquery.bootstrap.wizard.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index f09ba9bb7..4fe6c4cec 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -166,6 +166,7 @@ date of first contribution): * [Nicu Surdu](https://github.com/surdu) * [Zack Lewis](https://github.com/lima3w) * [Billy Richardson](https://github.com/richardsondev) + * [Christian Bianchini](https://github.com/max246) OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by [Daid Braam](https://github.com/daid). Parts of its communication layer and diff --git a/src/octoprint/static/js/lib/jquery/jquery.bootstrap.wizard.js b/src/octoprint/static/js/lib/jquery/jquery.bootstrap.wizard.js index fc9396fc5..93717ca49 100644 --- a/src/octoprint/static/js/lib/jquery/jquery.bootstrap.wizard.js +++ b/src/octoprint/static/js/lib/jquery/jquery.bootstrap.wizard.js @@ -270,7 +270,7 @@ var bootstrapWizardCreate = function(element, options) { // remove the existing handlers $('a[data-toggle="tab"]', $navigation).off('click', innerTabClick); - $('a[data-toggle="tab"]', $navigation).off('show show.bs.tab', innerTabShown); + $('a[data-toggle="tab"]', $navigation).off('show', innerTabShown); // reset elements based on current state of the DOM $navigation = element.find('ul:first', element); @@ -278,7 +278,7 @@ var bootstrapWizardCreate = function(element, options) { // re-add handlers $('a[data-toggle="tab"]', $navigation).on('click', innerTabClick); - $('a[data-toggle="tab"]', $navigation).on('show show.bs.tab', innerTabShown); + $('a[data-toggle="tab"]', $navigation).on('show', innerTabShown); obj.fixNavigationButtons(); }; @@ -303,7 +303,8 @@ var bootstrapWizardCreate = function(element, options) { $('a[data-toggle="tab"]', $navigation).on('click', innerTabClick); // attach to both show and show.bs.tab to support Bootstrap versions 2.3.2 and 3.0.0 - $('a[data-toggle="tab"]', $navigation).on('show show.bs.tab', innerTabShown); + // Note: removing show.bs.tab in the listener stops to trigger twice the method innerTabShown + $('a[data-toggle="tab"]', $navigation).on('show', innerTabShown); }; $.fn.bootstrapWizard = function(options) { //expose methods