From a51245eb7600c3b233140c8edb06bed5f63c2e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 1 Mar 2022 15:22:45 +0100 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=9A=B8=20Heads-up=20that=20webrtc=20i?= =?UTF-8?q?s=20still=20considered=20beta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After a discussion on discord, better warn users that they might have to expect disruption here down the line while things are getting figured out. --- src/octoprint/static/js/app/viewmodels/settings.js | 5 ++++- .../snippets/settings/webcam/webcamStreamUrl.jinja2 | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/octoprint/static/js/app/viewmodels/settings.js b/src/octoprint/static/js/app/viewmodels/settings.js index 5ae24af21..fcde5d057 100644 --- a/src/octoprint/static/js/app/viewmodels/settings.js +++ b/src/octoprint/static/js/app/viewmodels/settings.js @@ -311,6 +311,9 @@ $(function () { self.webcam_ffmpegPathOk(false); self.webcam_ffmpegPathBroken(false); }; + self.webcam_streamType = ko.pureComputed(function () { + return determineWebcamStreamType(self.webcam_streamUrl()); + }); self.server_onlineCheckText = ko.observable(); self.server_onlineCheckOk = ko.observable(false); @@ -442,7 +445,7 @@ $(function () { var text = gettext( "If you see your webcam stream below, the entered stream URL is ok." ); - var streamType = determineWebcamStreamType(self.webcam_streamUrl()); + var streamType = self.webcam_streamType(); var webcam_element; var webrtc_peer_connection; if (streamType == "mjpg") { diff --git a/src/octoprint/templates/snippets/settings/webcam/webcamStreamUrl.jinja2 b/src/octoprint/templates/snippets/settings/webcam/webcamStreamUrl.jinja2 index 5bb9b25c3..3839d826e 100644 --- a/src/octoprint/templates/snippets/settings/webcam/webcamStreamUrl.jinja2 +++ b/src/octoprint/templates/snippets/settings/webcam/webcamStreamUrl.jinja2 @@ -5,6 +5,9 @@ - {% trans %}Needs to be reachable from the browser displaying the OctoPrint UI, used to embed the webcam stream into the page.{% endtrans %} + +

{% trans %}Needs to be reachable from the browser displaying the OctoPrint UI, used to embed the webcam stream into the page.{% endtrans %}

+

{% trans %}Heads-up! WebRTC support is still in beta and subject to change, monitor the changelog of future versions closely for heads-ups regarding the WebRTC support in OctoPrint.{% endtrans %}

+
From 29c4a1b3c8c7b7436216c4849bdcb3b7c41adb4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 1 Mar 2022 15:28:15 +0100 Subject: [PATCH 2/5] =?UTF-8?q?=E2=9C=A8=20tracking:=20Include=20octopiupt?= =?UTF-8?q?odate=5Fbuild?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gives us a better overview on what specific environments to test against. --- src/octoprint/plugins/tracking/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/octoprint/plugins/tracking/__init__.py b/src/octoprint/plugins/tracking/__init__.py index 5ec5872bf..b19b8bbde 100644 --- a/src/octoprint/plugins/tracking/__init__.py +++ b/src/octoprint/plugins/tracking/__init__.py @@ -553,6 +553,10 @@ class TrackingPlugin( payload["octopi_version"] = self._environment["plugins"]["pi_support"][ "octopi_version" ] + if "octopiuptodate_build" in self._environment["plugins"]["pi_support"]: + payload["octopiuptodate_build"] = self._environment["plugins"][ + "pi_support" + ]["octopiuptodate_build"] return payload From cd0a96827ba1c73a44aabc4c11e9cdbf14c771e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 1 Mar 2022 16:23:23 +0100 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=90=9B=20Gracefully=20handle=20emptry?= =?UTF-8?q?=20webcam=20stream=20url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/static/js/app/viewmodels/settings.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/octoprint/static/js/app/viewmodels/settings.js b/src/octoprint/static/js/app/viewmodels/settings.js index fcde5d057..71338c048 100644 --- a/src/octoprint/static/js/app/viewmodels/settings.js +++ b/src/octoprint/static/js/app/viewmodels/settings.js @@ -312,7 +312,11 @@ $(function () { self.webcam_ffmpegPathBroken(false); }; self.webcam_streamType = ko.pureComputed(function () { - return determineWebcamStreamType(self.webcam_streamUrl()); + try { + return determineWebcamStreamType(self.webcam_streamUrl()); + } catch (e) { + return ""; + } }); self.server_onlineCheckText = ko.observable(); From 42d3084bb8661d8bbecc140619ae774c7a74b640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 1 Mar 2022 16:34:52 +0100 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=90=9B=20Prevent=20"no=20port=20found?= =?UTF-8?q?"=20flicker=20on=20initial=20load?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only show the warning if we have fetched the port options and they are empty. --- src/octoprint/static/js/app/viewmodels/connection.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/octoprint/static/js/app/viewmodels/connection.js b/src/octoprint/static/js/app/viewmodels/connection.js index 4f17bca4a..1bd6b0d98 100644 --- a/src/octoprint/static/js/app/viewmodels/connection.js +++ b/src/octoprint/static/js/app/viewmodels/connection.js @@ -21,6 +21,7 @@ $(function () { self.selectedPrinter(self.printerProfiles.currentProfile()); }); + self.portOptionsFetched = ko.observable(false); self.portOptions = ko.observableArray(undefined); self.baudrateOptions = ko.observableArray(undefined); self.printerOptions = ko.observableArray(undefined); @@ -53,6 +54,7 @@ $(function () { self.validPort = ko.pureComputed(function () { return ( + !self.portOptionsFetched() || self.portOptions().length > 0 || self.settings.settings.serial.ignoreEmptyPorts() ); @@ -119,6 +121,7 @@ $(function () { } self.saveSettings(false); + self.portOptionsFetched(true); }; self.fromHistoryData = function (data) { From 15d7dae3ae3af9170eb5e4ab7a8f98ccd25d5ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 1 Mar 2022 19:32:16 +0100 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=90=9B=20Fix=20deleting=20prefix=20fr?= =?UTF-8?q?om=20settings=20map?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/settings.py | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index f6098e5f6..abfd3d1ce 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -662,13 +662,7 @@ class HierarchicalChainMap: key = self._path_to_key(path) # delete any subkeys - subkeys_start = key + _CHAINMAP_SEP - to_delete = [] - for k in current.keys(): - if k.startswith(subkeys_start): - to_delete.append(k) - for k in to_delete: - del current[k] + self._del_prefix(current, key) if isinstance(value, dict): current.update(self._flatten(value, key)) @@ -687,19 +681,11 @@ class HierarchicalChainMap: if not path: raise ValueError("Invalid path") - current = self._chainmap + current = self._chainmap.maps[0] - # used to check if we've deleted anything - deleted_any = False - - # we delete recursively: the path that we got, and any subpaths + # delete any subkeys delete_key = self._path_to_key(path) - for key in self._chainmap.keys(): - if key.startswith(delete_key): - del current[key] - deleted_any = True - - if not deleted_any: + if not self._del_prefix(current, delete_key): raise KeyError("Could not find entry for " + str(path)) # create a placeholder object above if needed @@ -711,6 +697,15 @@ class HierarchicalChainMap: if not any(map(lambda k: k.startswith(up_one_path_prefix), current.keys())): current[up_one_path] = {} + def _del_prefix(self, current, key): + prefix = key + _CHAINMAP_SEP + + to_delete = [k for k in current if k.startswith(prefix)] + for k in to_delete: + del current[k] + + return len(to_delete) > 0 + def with_config_defaults(self, config=None, defaults=None): """ Builds a new map with the following layers: provided config + any intermediary