From f5e90a1aa4d3383b98ba33574df1ea177bd8d81b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 8 Mar 2023 12:31:24 +0100 Subject: [PATCH 01/10] =?UTF-8?q?=F0=9F=90=9B=20Fix=20saving=20of=20extrud?= =?UTF-8?q?er=20count=20in=20printer=20profiles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simple copy-paste error. Closes #4754 --- src/octoprint/static/js/app/viewmodels/printerprofiles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/static/js/app/viewmodels/printerprofiles.js b/src/octoprint/static/js/app/viewmodels/printerprofiles.js index bc79621f4..d55fd99ef 100644 --- a/src/octoprint/static/js/app/viewmodels/printerprofiles.js +++ b/src/octoprint/static/js/app/viewmodels/printerprofiles.js @@ -290,7 +290,7 @@ $(function () { } } if (checks.lt !== undefined) { - if (!(value < checks.gt)) { + if (!(value < checks.lt)) { return def; } } From 0ce7930653d75848b4d1d28aa9506335f9b19dc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 9 Mar 2023 10:42:21 +0100 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=90=9B=20Add=20CSRF=20cookie=20on?= =?UTF-8?q?=20standalone=20appkeys=20dialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #4755 --- src/octoprint/plugins/appkeys/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/octoprint/plugins/appkeys/__init__.py b/src/octoprint/plugins/appkeys/__init__.py index bc3a396cc..e4f275734 100644 --- a/src/octoprint/plugins/appkeys/__init__.py +++ b/src/octoprint/plugins/appkeys/__init__.py @@ -218,6 +218,8 @@ class AppKeysPlugin( @octoprint.plugin.BlueprintPlugin.route("/auth/", methods=["GET"]) @no_firstrun_access def handle_auth_dialog(self, app_token): + from octoprint.server.util.csrf import add_csrf_cookie + user_id = current_user.get_name() required_user = flask.request.args.get("user", None) @@ -256,7 +258,7 @@ class AppKeysPlugin( ).replace("%(app)s", app_id), ) ) - return add_non_caching_response_headers(response) + return add_csrf_cookie(add_non_caching_response_headers(response)) @octoprint.plugin.BlueprintPlugin.route("/decision/", methods=["POST"]) @restricted_access From ba54bd30061e8808ecac116dfe5a28e13b27e13b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 13 Mar 2023 14:24:16 +0100 Subject: [PATCH 03/10] =?UTF-8?q?=F0=9F=90=9B=20Make=20sure=20label=20is?= =?UTF-8?q?=20always=20defined=20to=20read=20background=20color=20from?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #4761 --- .../static/js/app/viewmodels/temperature.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/octoprint/static/js/app/viewmodels/temperature.js b/src/octoprint/static/js/app/viewmodels/temperature.js index 538d1de71..4d0814fb8 100644 --- a/src/octoprint/static/js/app/viewmodels/temperature.js +++ b/src/octoprint/static/js/app/viewmodels/temperature.js @@ -466,12 +466,15 @@ $(function () { if (mark.label) { markLabel = gettext(mark.label); } - if (o.left > yAxisLabelWidth) { - var label = $("
"); - label.html(markLabel); - label.addClass("temperature-mark-label"); - label.addClass("temperature-mark-type-" + mark.type); + // we create the label even if we don't show it so that we can query its + // background color (see #4761) + var label = $("
"); + label.html(markLabel); + label.addClass("temperature-mark-label"); + label.addClass("temperature-mark-type-" + mark.type); + + if (o.left > yAxisLabelWidth) { graph.append(label); // draw markings label on the left if doesn't fit on the right From 658c5578e2bf76753d8616c9320d634b05bf0f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 13 Mar 2023 15:31:57 +0100 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20a=20typo=20in=20a=20?= =?UTF-8?q?var=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/server/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index d88cc672e..b2913603b 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -1430,14 +1430,14 @@ class Server: if l10n: # canonicalize and get rid of invalid language codes - l10n_canoicalized = [] + l10n_canonicalized = [] for x in l10n: try: - l10n_canoicalized.append(str(Locale.parse(x))) + l10n_canonicalized.append(str(Locale.parse(x))) except Exception: # invalid language code, ignore continue - return Locale.negotiate(l10n_canoicalized, LANGUAGES) + return Locale.negotiate(l10n_canonicalized, LANGUAGES) # request: preference return Locale.parse(request.accept_languages.best_match(LANGUAGES, default="en")) From 65f53f3d860d3788cbbc11b617e3081b3cb816ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 13 Mar 2023 15:45:17 +0100 Subject: [PATCH 05/10] =?UTF-8?q?=F0=9F=90=9B=20Fix=20logic=20for=20langua?= =?UTF-8?q?ge=20selection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4762 --- src/octoprint/server/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index b2913603b..f0da8dc83 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -1420,8 +1420,9 @@ class Server: except octoprint.access.users.UnknownUser: pass - elif ( - default_language is not None + if ( + not l10n + and default_language is not None and not default_language == "_default" and default_language in LANGUAGES ): From 4cc41b05eabe11dc49998f67d79b4d41833d1e95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20W=C3=BCrthner?= Date: Mon, 13 Mar 2023 17:09:57 +0100 Subject: [PATCH 06/10] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=20Use=20webcam=20co?= =?UTF-8?q?ntainer=20for=20intersection=20instead=20of=20controls=20(#4759?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use webcam container for intersection instead of controls * Removed check for tab visibility, fully rely on control.js logic * Allow intersection observers to be recreated * Use onStartupComplete as callback to defer intersection initialization --- .../classicwebcam/static/js/classicwebcam.js | 11 ++--------- src/octoprint/static/js/app/viewmodels/control.js | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/octoprint/plugins/classicwebcam/static/js/classicwebcam.js b/src/octoprint/plugins/classicwebcam/static/js/classicwebcam.js index 5e4d82446..f1b99522a 100644 --- a/src/octoprint/plugins/classicwebcam/static/js/classicwebcam.js +++ b/src/octoprint/plugins/classicwebcam/static/js/classicwebcam.js @@ -117,18 +117,11 @@ $(function () { }; self._enableWebcam = function () { - if ( - OctoPrint.coreui.selectedTab != "#control" || - !OctoPrint.coreui.browserTabVisible - ) { - return; - } - if (self.webcamDisableTimeout != undefined) { clearTimeout(self.webcamDisableTimeout); } - // IF disabled then we dont need to do anything + // If disabled then we dont need to do anything if (self.settings.webcamEnabled() == false) { console.log("Webcam not enabled"); return; @@ -156,7 +149,7 @@ $(function () { }; self.onWebcamErrored = function () { - log.debug("Webcam stream failed to load/disabled"); + log.debug("Webcam stream failed to load/was unloaded"); self.webcamLoaded(false); self.webcamError(true); }; diff --git a/src/octoprint/static/js/app/viewmodels/control.js b/src/octoprint/static/js/app/viewmodels/control.js index 2e3de6d19..84e7c3615 100644 --- a/src/octoprint/static/js/app/viewmodels/control.js +++ b/src/octoprint/static/js/app/viewmodels/control.js @@ -37,6 +37,7 @@ $(function () { self.controlsFromServer = []; self.additionalControls = []; + self.intersectionObservers = []; self.keycontrolActive = ko.observable(false); self.keycontrolHelpActive = ko.observable(false); @@ -74,18 +75,27 @@ $(function () { } }; - self.onAfterBinding = function () { + self.onStartupComplete = function () { + self.recreateIntersectionObservers(); + }; + + self.recreateIntersectionObservers = function () { // We are using the IntersectionObserver API to determine whether a webcam is visible or not. // A webcam will not intersect with the control tab if the control tab is invisible because another tab // is selected or if the webcam isn't shown because another webcam is active. // // Whenever the webacam changes visibility we will call onWebcamVisbilityChange() which the webcam's // VM can use to start or stop the stream. + self.intersectionObservers.forEach(function (observer) { + observer.disconnect(); + }); + self.intersectionObservers = []; + document .querySelectorAll("#webcam-group .tab-pane") .forEach(function (target) { var options = { - root: document.querySelector("#control"), + root: document.querySelector("#webcam_plugins_container"), rootMargin: "0px", threshold: 1.0 }; @@ -103,6 +113,7 @@ $(function () { var observer = new IntersectionObserver(callback, options); observer.observe(target); + self.intersectionObservers.push(observer); }); }; From bb519ae88b043e6a41e1b765453212358bebe956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 20 Mar 2023 14:14:25 +0100 Subject: [PATCH 07/10] =?UTF-8?q?=F0=9F=90=9B=20Fix=20login=20dialog=20whe?= =?UTF-8?q?n=20appkeys=20plugin=20is=20disabled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4763 --- src/octoprint/server/views.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/octoprint/server/views.py b/src/octoprint/server/views.py index 92211021e..025fcb231 100644 --- a/src/octoprint/server/views.py +++ b/src/octoprint/server/views.py @@ -20,6 +20,7 @@ from flask import ( send_from_directory, url_for, ) +from werkzeug.routing import BuildError import octoprint.plugin from octoprint.access.permissions import OctoPrintPermission, Permissions @@ -195,8 +196,14 @@ def login(): allowed_paths = [ url_for("index"), url_for("recovery"), - url_for("plugin.appkeys.handle_auth_dialog", app_token="*"), - ] + configured_allowed_paths + ] + try: + allowed_paths += [ + url_for("plugin.appkeys.handle_auth_dialog", app_token="*"), + ] + except BuildError: + pass # no appkeys plugin enabled, see #4763 + allowed_paths += configured_allowed_paths if not validate_local_redirect(redirect_url, allowed_paths): _logger.warning( From fe73d0d93cfb3cb98633b53bbdd7b7e4ae76fd8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 22 Mar 2023 12:40:30 +0100 Subject: [PATCH 08/10] =?UTF-8?q?=F0=9F=90=9B=20Fix=20scan=5Fdeps=20breaki?= =?UTF-8?q?ng=20on=20non=20pep440=20version=20numbers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index b49350cc8..cfc192667 100644 --- a/setup.py +++ b/setup.py @@ -201,11 +201,17 @@ class ScanDepsCommand(setuptools.Command): ) resp.raise_for_status() + def safe_parse_version(version): + try: + return parse_version(version) + except ValueError: + return None + data = resp.json() versions = list( filter( - lambda x: not x.is_prerelease and not x.is_devrelease, - map(lambda x: parse_version(x), data.get("versions", [])), + lambda x: x and not x.is_prerelease and not x.is_devrelease, + map(lambda x: safe_parse_version(x), data.get("versions", [])), ) ) if not versions: From ed798e4c6f473ed15bfd8ff583f3913b18ab716c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 22 Mar 2023 12:44:38 +0100 Subject: [PATCH 09/10] =?UTF-8?q?=F0=9F=94=96=20Preparing=20release=20of?= =?UTF-8?q?=201.9.0rc3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/plugins/errortracking/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/octoprint/plugins/errortracking/__init__.py b/src/octoprint/plugins/errortracking/__init__.py index 9008c9b9f..dcd59658b 100644 --- a/src/octoprint/plugins/errortracking/__init__.py +++ b/src/octoprint/plugins/errortracking/__init__.py @@ -18,10 +18,10 @@ from octoprint.util.version import ( ) SENTRY_URL_SERVER = ( - "https://11f9235bf2ac4f5d97f7e8bcb5be3783@o118517.ingest.sentry.io/1373987" + "https://cb1ee590a2f34baca47dd207d7f294d5@o118517.ingest.sentry.io/1373987" ) SENTRY_URL_COREUI = ( - "https://22fe071cb60c4dfcb8245a3712739f6e@o118517.ingest.sentry.io/1374096" + "https://a32c80a4a282468d8d41fc2accb77088@o118517.ingest.sentry.io/1374096" ) SETTINGS_DEFAULTS = { From 9487e4d0b25dcc48fa11cb58f07115c0b55ad93f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 23 Mar 2023 09:46:09 +0100 Subject: [PATCH 10/10] =?UTF-8?q?=F0=9F=94=96=20staging/maintenance=20is?= =?UTF-8?q?=20now=201.9.0rc4.dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .versioneer-lookup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.versioneer-lookup b/.versioneer-lookup index bf60ed7a4..1d4796eb2 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -29,10 +29,10 @@ improve/.* 1.9.0 fa2c4680cca0d1d6b46e6c1ed68ceea4d9b79afb pep440-dev staging/bugfix 1.8.8 8e4c1f5246c4245b839ccdcdabf2beee671b08d7 pep440-dev bug/.* 1.8.8 8e4c1f5246c4245b839ccdcdabf2beee671b08d7 pep440-dev -# staging/maintenance is currently the branch for preparation of 1.9.0rc3 +# staging/maintenance is currently the branch for preparation of 1.9.0rc4 # so is regressionfix/... -staging/maintenance 1.9.0rc3 95e87eb1970d8e322738f9698c9d665d78f2d74e pep440-dev -regressionfix/.* 1.9.0rc3 95e87eb1970d8e322738f9698c9d665d78f2d74e pep440-dev +staging/maintenance 1.9.0rc4 ed798e4c6f473ed15bfd8ff583f3913b18ab716c pep440-dev +regressionfix/.* 1.9.0rc4 ed798e4c6f473ed15bfd8ff583f3913b18ab716c pep440-dev # staging/devel is currently inactive (but has the 1.4.1rc4 namespace) staging/devel 1.4.1rc4 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev