🐛 Fix snapshotTimeout & SSL validation settings

Wasn't properly ported over to Classic Webcam plugin, that has
now been rectified.

Closes #4885
This commit is contained in:
Gina Häußge committed 2023-11-30 17:06:55 +01:00
1 parent 9da4b35ee6
commit 172b962673
8 files changed
+33 -20

No files matched your search

@@ -159,6 +159,19 @@ class ClassicWebcamPlugin(
def get_settings_version(self):
return 1
def on_settings_save(self, data):
dirty = False
if "streamTimeout" in data:
self._settings.set_int(["streamTimeout"], data.pop("streamTimeout"))
dirty = True
if "snapshotTimeout" in data:
self._settings.set_int(["snapshotTimeout"], data.pop("snapshotTimeout"))
dirty = True
if dirty:
self._settings.save()
return super().on_settings_save(data)
def on_settings_migrate(self, target, current):
if current is None:
config = self._settings.global_get(["webcam"])
@@ -18,6 +18,10 @@ $(function () {
self.onBeforeBinding = function () {
self.snapshotUrl = self.settings.settings.plugins.classicwebcam.snapshot;
self.snapshotTimeout =
self.settings.settings.plugins.classicwebcam.snapshotTimeout;
self.snapshotSslValidation =
self.settings.settings.plugins.classicwebcam.snapshotSslValidation;
self.flipH = self.settings.settings.plugins.classicwebcam.flipH;
self.flipV = self.settings.settings.plugins.classicwebcam.flipV;
self.rotate90 = self.settings.settings.plugins.classicwebcam.rotate90;
@@ -19,5 +19,13 @@
<form class="form-horizontal" onsubmit="return false;">
{% include "snippets/classicwebcamSnapshotUrl.jinja2" %}
<div>
<div><small><a href="#" class="muted" data-bind="toggleContent: { class: 'fa-caret-right fa-caret-down', parent: '.form-horizontal', container: '.hide' }"><i class="fas fa-caret-right"></i> {{ _('Advanced options') }}</a></small></div>
<div class="hide">
{% include "snippets/classicwebcamSnapshotTimeout.jinja2" %}
{% include "snippets/classicwebcamSnapshotSslValidation.jinja2" %}
</div>
</div>
</form>
</div>
@@ -0,0 +1,7 @@
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: snapshotSslValidation" id="webcamSnapshotSslValidation"> {{ _('Validate SSL on snapshot URL (if applicable)') }}
</label>
</div>
</div>
@@ -2,7 +2,7 @@
<label class="control-label" for="settings-webcamSnapshotTimeout">{{ _('Snapshot timeout') }}</label>
<div class="controls">
<div class="input-append">
<input type="number" min="1" class="input-mini text-right" data-bind="value: webcam_snapshotTimeout" id="settings-webcamSnapshotTimeout">
<input type="number" min="1" class="input-mini text-right" data-bind="value: snapshotTimeout" id="settings-webcamSnapshotTimeout">
<span class="add-on">sec</span>
</div>
</div>
@@ -22,8 +22,6 @@
{% include "snippets/settings/webcam/ffmpegCommandline.jinja2" %}
{% include "snippets/settings/webcam/ffmpegBitrate.jinja2" %}
{% include "snippets/settings/webcam/ffmpegThreads.jinja2" %}
{% include "snippets/settings/webcam/webcamSnapshotTimeout.jinja2" %}
{% include "snippets/settings/webcam/webcamSnapshotSslValidation.jinja2" %}
{% include "snippets/settings/webcam/ffmpegVideoCodec.jinja2" %}
</div>
</div>
@@ -1,7 +0,0 @@
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: webcam_snapshotSslValidation" id="settings-webcamSnapshotSslValidation"> {{ _('Validate SSL on snapshot URL (if applicable)') }}
</label>
</div>
</div>
@@ -1,10 +0,0 @@
<div class="control-group" title="{{ _('URL to use for retrieving webcam snapshot images for timelapse creation')|edq }}">
<label class="control-label" for="settings-webcamSnapshotUrl">{{ _('Snapshot URL') }}</label>
<div class="controls">
<div class="input-append">
<input type="text" class="input-block-level" data-bind="value: webcam_snapshotUrl, valueUpdate: 'afterkeydown'" id="settings-webcamSnapshotUrl">
<button class="btn" type="button" data-bind="click: testWebcamSnapshotUrl, enable: webcam_snapshotUrl() && !testWebcamSnapshotUrlBusy(), css: {disabled: !webcam_snapshotUrl() || testWebcamSnapshotUrlBusy()}"><i class="fas fa-spinner fa-spin" data-bind="visible: testWebcamSnapshotUrlBusy"></i> {{ _('Test') }}</button>
</div>
<span class="help-inline">{% trans %}Fully qualified URL, needs to be reachable by OctoPrint's server{% endtrans %}</span>
</div>
</div>