From 5fd8ea61e6ce3ab5451e29a394f062c2e5d2e304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 6 Mar 2023 17:22:07 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20settings.webcam=20on=20fir?= =?UTF-8?q?st=20run?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And make sure it's always available, albeit empty without permissions. --- src/octoprint/server/api/settings.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index 5b039984c..4139a3de7 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -340,7 +340,10 @@ def getSettings(): if len(plugin_settings): data["plugins"] = plugin_settings - if Permissions.WEBCAM.can() is True: + if Permissions.WEBCAM.can() or ( + settings().getBoolean(["server", "firstRun"]) + and not userManager.has_been_customized() + ): webcamsDict = get_webcams_as_dicts() data["webcam"] = { "webcamEnabled": s.getBoolean(["webcam", "webcamEnabled"]), @@ -393,6 +396,8 @@ def getSettings(): "snapshotWebcam": snapshotWebcam.config.name, } ) + else: + data["webcam"] = {} return jsonify(data)