Merge branch 'maintenance' into devel

This commit is contained in:
Gina Häußge committed 2017-05-24 14:53:40 +02:00
commit fcacf28c45
13 files changed
+2891 -1174

No files matched your search

+10 -2
View File
@@ -1378,6 +1378,14 @@ class SettingsPlugin(OctoPrintPlugin):
Of course, you are always free to completely override both :func:`on_settings_load` and :func:`on_settings_save` if the
default implementations do not fit your requirements.
.. warning::
Make sure to protect sensitive information stored by your plugin that only logged in administrators (or users)
should have access to via :meth:`~octoprint.plugin.SettingsPlugin.get_settings_restricted_paths`. OctoPrint will
return its settings on the REST API even to anonymous clients, but will filter out fields it know are restricted,
therefore you **must** make sure that you specify sensitive information accordingly to limit access as required!
.. attribute:: _settings
The :class:`~octoprint.plugin.PluginSettings` instance to use for accessing the plugin's settings. Injected by
@@ -1549,8 +1557,8 @@ class SettingsPlugin(OctoPrintPlugin):
field="field"),
path=dict(to=dict(never=dict(return="return"))))
def get_settings_restricted_path(self):
return dict(admin=[["some", "admin_only", "path"], ["another", "admin_only", "path"],
def get_settings_restricted_paths(self):
return dict(admin=[["some", "admin_only", "path"], ["another", "admin_only", "path"],],
user=[["some", "user_only", "path"],],
never=[["path", "to", "never", "return"],])
+4 -3
View File
@@ -1054,8 +1054,9 @@ var getQueryParameterByName = function(name, url) {
*
* E.g. turns a null byte in the string into "\x00".
*
* Only characters 0 to 31, 127 and 255 will be escaped, that
* should leave printable characters and unicode alone.
* Characters 0 to 31 excluding 9, 10 and 13 will be escaped, as will
* 127 and 255. That should leave printable characters and unicode
* alone.
*
* Originally based on
* https://gist.github.com/mathiasbynens/1243213#gistcomment-53590
@@ -1069,7 +1070,7 @@ var escapeUnprintableCharacters = function(str) {
var charCode;
while (!isNaN(charCode = str.charCodeAt(index))) {
if (charCode < 32 || charCode == 127 || charCode == 255) {
if ((charCode < 32 && charCode != 9 && charCode != 10 && charCode != 13) || charCode == 127 || charCode == 255) {
// special hex chars
result += "\\x" + (charCode > 15 ? "" : "0") + charCode.toString(16)
} else {
@@ -10,7 +10,7 @@ $(function() {
self.defaultPostRoll = 0;
self.defaultInterval = 10;
self.defaultRetractionZHop = 0;
self.defaultCapturePostroll = true;
self.defaultCapturePostRoll = true;
self.timelapseType = ko.observable(undefined);
self.timelapseTimedInterval = ko.observable(self.defaultInterval);
@@ -159,18 +159,20 @@ $(function() {
// timelapse config
self.timelapseType(config.type);
if (config.type == "timed") {
if (config.interval != undefined && config.interval > 0) {
self.timelapseTimedInterval(config.interval);
}
if (config.type == "timed" && config.interval != undefined && config.interval > 0) {
self.timelapseTimedInterval(config.interval);
} else {
self.timelapseTimedInterval(self.defaultInterval);
}
if (config.type == "zchange") {
if (config.retractionZHop != undefined && config.retractionZHop > 0) {
self.timelapseRetractionZHop(config.retractionZHop);
}
if (config.type == "timed" && config.capturePostRoll != undefined){
self.timelapseCapturePostRoll(config.capturePostRoll);
} else {
self.timelapseCapturePostRoll(self.defaultCapturePostRoll);
}
if (config.type == "zchange" && config.retractionZHop != undefined && config.retractionZHop > 0) {
self.timelapseRetractionZHop(config.retractionZHop);
} else {
self.timelapseRetractionZHop(self.defaultRetractionZHop);
}
@@ -187,12 +189,6 @@ $(function() {
self.timelapseFps(self.defaultFps);
}
if (config.capturePostRoll != undefined){
self.timelapseCapturePostRoll(config.capturePostRoll);
} else {
self.timelapseCapturePostRoll(self.defaultCapturePostRoll);
}
self.persist(false);
self.isDirty(false);
};
+2 -2
View File
@@ -6,8 +6,8 @@
</div>
<div class="text webcam_error" data-bind="visible: !webcamLoaded() && webcamError()">
<p><strong>{{ _('Webcam stream not loaded') }}</strong></p>
<p data-bind="visible: !loginState.isAdmin()"><small>{{ _('It might not be configured correctly. To have this fixed, get in touch with an administrator of this OctoPrint instance.') }}</small></p>
<p data-bind="visible: loginState.isAdmin"><small>{{ _('It might not be configured correctly. You can change the URL of the stream under "Settings" > "Webcam & Timelapse" > "Stream URL". If you don\'t have a webcam just set the URL to an empty value.') }}</small></p>
<p data-bind="visible: !loginState.isAdmin()"><small>{{ _('It might not be configured correctly or require authentication. To have this fixed, get in touch with an administrator of this OctoPrint instance.') }}</small></p>
<p data-bind="visible: loginState.isAdmin"><small>{{ _('It might not be configured correctly or require authentication. You can change the URL of the stream under "Settings" > "Webcam & Timelapse" > "Stream URL". If you don\'t have a webcam just set the URL to an empty value.') }}</small></p>
<p data-bind="visible: loginState.isUser"><small>{{ _('Currently configured stream URL') }}: <a target="_blank" rel="noreferrer" data-bind="attr: {href: settings.webcam_streamUrl}, text: settings.webcam_streamUrl"></a></small></p>
</div>
</div>
+4 -5
View File
@@ -308,7 +308,7 @@ def configure_timelapse(config=None, persist=False):
if "options" in config and "interval" in config["options"] and config["options"]["interval"] > 0:
interval = config["options"]["interval"]
capture_post_roll = False
capture_post_roll = True
if "options" in config and "capturePostRoll" in config["options"] and isinstance(config["options"]["capturePostRoll"], bool):
capture_post_roll = config["options"]["capturePostRoll"]
@@ -730,10 +730,6 @@ class TimedTimelapse(Timelapse):
self._copying_postroll()
self.post_roll_finished()
def post_roll_finished(self):
Timelapse.post_roll_finished(self)
self._timer = None
def _timer_active(self):
return self._in_timelapse or self._postroll_captures > 0
@@ -746,6 +742,9 @@ class TimedTimelapse(Timelapse):
if self._capture_post_roll:
self.post_roll_finished()
# timer is done, delete it
self._timer = None
class TimelapseRenderJob(object):
File diff suppressed because it is too large. Load diff