Merge branch 'devel' into dev/permission
# Conflicts: # src/octoprint/plugins/corewizard/__init__.py # src/octoprint/plugins/pluginmanager/__init__.py # src/octoprint/plugins/softwareupdate/__init__.py # src/octoprint/printer/standard.py # src/octoprint/server/__init__.py # src/octoprint/server/api/job.py # src/octoprint/server/api/log.py # src/octoprint/server/util/__init__.py # src/octoprint/server/views.py # src/octoprint/static/css/octoprint.css # src/octoprint/static/js/app/main.js # src/octoprint/static/js/app/viewmodels/log.js # src/octoprint/static/js/app/viewmodels/loginstate.js # src/octoprint/static/js/app/viewmodels/printerstate.js # src/octoprint/static/js/app/viewmodels/users.js # src/octoprint/static/less/octoprint.less # src/octoprint/templates/dialogs/settings/logs.jinja2 # src/octoprint/templates/tabs/control.jinja2 # src/octoprint/util/__init__.py
This commit is contained in:
commit
b9a5e1db69
115 files changed
+7946
-6501
No files matched your search
@@ -16,7 +16,7 @@ import octoprint.server
|
||||
import octoprint.plugin
|
||||
from octoprint.server import NO_CONTENT
|
||||
from octoprint.settings import settings as s, valid_boolean_trues
|
||||
from octoprint.server.util import noCachingExceptGetResponseHandler, enforceApiKeyRequestHandler, loginFromApiKeyRequestHandler, corsRequestHandler, corsResponseHandler
|
||||
from octoprint.server.util import noCachingExceptGetResponseHandler, enforceApiKeyRequestHandler, loginFromApiKeyRequestHandler, loginFromAuthorizationHeaderRequestHandler, corsRequestHandler, corsResponseHandler
|
||||
from octoprint.server.util.flask import restricted_access, get_json_command_from_request, passive_login
|
||||
from octoprint.access.permissions import Permissions
|
||||
|
||||
@@ -33,7 +33,6 @@ from . import settings as api_settings
|
||||
from . import timelapse as api_timelapse
|
||||
from . import access as api_access
|
||||
from . import users as api_users
|
||||
from . import log as api_logs
|
||||
from . import slicing as api_slicing
|
||||
from . import printer_profiles as api_printer_profiles
|
||||
from . import languages as api_languages
|
||||
@@ -46,6 +45,7 @@ api.after_request(noCachingExceptGetResponseHandler)
|
||||
|
||||
api.before_request(corsRequestHandler)
|
||||
api.before_request(enforceApiKeyRequestHandler)
|
||||
api.before_request(loginFromAuthorizationHeaderRequestHandler)
|
||||
api.before_request(loginFromApiKeyRequestHandler)
|
||||
api.after_request(corsResponseHandler)
|
||||
|
||||
@@ -243,6 +243,9 @@ def _logout(user):
|
||||
octoprint.server.userManager.logout_user(user)
|
||||
|
||||
|
||||
#~~ Test utils
|
||||
|
||||
|
||||
@api.route("/util/test", methods=["POST"])
|
||||
@restricted_access
|
||||
@Permissions.ADMIN.require(403)
|
||||
|
||||
@@ -330,7 +330,7 @@ def uploadGcodeFile(target):
|
||||
"""
|
||||
|
||||
if destination == FileDestinations.SDCARD and octoprint.filemanager.valid_file_type(filename, "machinecode"):
|
||||
return filename, printer.add_sd_file(filename, absFilename, selectAndOrPrint)
|
||||
return filename, printer.add_sd_file(filename, absFilename, selectAndOrPrint, tags={"source:api", "api:files.sd"})
|
||||
else:
|
||||
selectAndOrPrint(filename, absFilename, destination)
|
||||
return filename
|
||||
@@ -758,7 +758,7 @@ def deleteGcodeFile(filename, target):
|
||||
|
||||
# delete it
|
||||
if target == FileDestinations.SDCARD:
|
||||
printer.delete_sd_file(filename)
|
||||
printer.delete_sd_file(filename, tags={"source:api", "api:files.sd"})
|
||||
else:
|
||||
fileManager.remove_file(target, filename)
|
||||
|
||||
|
||||
@@ -32,25 +32,27 @@ def controlJob():
|
||||
|
||||
activePrintjob = printer.is_printing() or printer.is_paused()
|
||||
|
||||
tags = {"source:api", "api:job"}
|
||||
|
||||
with Permissions.PRINT.require(403):
|
||||
if command == "start":
|
||||
if activePrintjob:
|
||||
return make_response("Printer already has an active print job, did you mean 'restart'?", 409)
|
||||
printer.start_print()
|
||||
printer.start_print(tags=tags)
|
||||
elif command == "restart":
|
||||
if not printer.is_paused():
|
||||
return make_response("Printer does not have an active print job or is not paused", 409)
|
||||
printer.start_print()
|
||||
printer.start_print(tags=tags)
|
||||
elif command == "pause":
|
||||
if not activePrintjob:
|
||||
return make_response("Printer is neither printing nor paused, 'pause' command cannot be performed", 409)
|
||||
action = data.get("action", "toggle")
|
||||
if action == "toggle":
|
||||
printer.toggle_pause_print()
|
||||
printer.toggle_pause_print(tags=tags)
|
||||
elif action == "pause":
|
||||
printer.pause_print()
|
||||
printer.pause_print(tags=tags)
|
||||
elif action == "resume":
|
||||
printer.resume_print()
|
||||
printer.resume_print(tags=tags)
|
||||
else:
|
||||
return make_response("Unknown action '{}', allowed values for action parameter are 'pause', 'resume' and 'toggle'".format(action), 400)
|
||||
|
||||
@@ -59,7 +61,7 @@ def controlJob():
|
||||
if command == "cancel":
|
||||
if not activePrintjob:
|
||||
return make_response("Printer is neither printing nor paused, 'cancel' command cannot be performed", 409)
|
||||
printer.cancel_print()
|
||||
printer.cancel_print(tags=tags)
|
||||
return NO_CONTENT
|
||||
|
||||
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
# coding=utf-8
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
__author__ = "Marc Hannappel Salandora"
|
||||
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
|
||||
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
|
||||
import os
|
||||
try:
|
||||
from os import scandir
|
||||
except ImportError:
|
||||
from scandir import scandir
|
||||
|
||||
from flask import request, jsonify, url_for, make_response
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
from octoprint.settings import settings
|
||||
|
||||
from octoprint.server import NO_CONTENT
|
||||
from octoprint.server.util.flask import redirect_to_tornado, restricted_access
|
||||
from octoprint.server.api import api
|
||||
|
||||
from octoprint.access.permissions import Permissions
|
||||
|
||||
|
||||
@api.route("/logs", methods=["GET"])
|
||||
@restricted_access
|
||||
@Permissions.LOGS.require(403)
|
||||
def getLogFiles():
|
||||
import psutil
|
||||
usage = psutil.disk_usage(settings().getBaseFolder("logs"))
|
||||
|
||||
files = _getLogFiles()
|
||||
|
||||
return jsonify(files=files, free=usage.free, total=usage.total)
|
||||
|
||||
|
||||
@api.route("/logs/<path:filename>", methods=["GET"])
|
||||
@restricted_access
|
||||
@Permissions.LOGS.require(403)
|
||||
def downloadLog(filename):
|
||||
return redirect_to_tornado(request, url_for("index") + "downloads/logs/" + filename)
|
||||
|
||||
|
||||
@api.route("/logs/<path:filename>", methods=["DELETE"])
|
||||
@restricted_access
|
||||
@Permissions.LOGS.require(403)
|
||||
def deleteLog(filename):
|
||||
secure = os.path.join(settings().getBaseFolder("logs"), secure_filename(filename))
|
||||
if not os.path.exists(secure):
|
||||
return make_response("File not found: %s" % filename, 404)
|
||||
|
||||
os.remove(secure)
|
||||
|
||||
return NO_CONTENT
|
||||
|
||||
|
||||
def _getLogFiles():
|
||||
files = []
|
||||
basedir = settings().getBaseFolder("logs")
|
||||
for entry in scandir(basedir):
|
||||
files.append({
|
||||
"name": entry.name,
|
||||
"date": int(entry.stat().st_mtime),
|
||||
"size": entry.stat().st_size,
|
||||
"refs": {
|
||||
"resource": url_for(".downloadLog", filename=entry.name, _external=True),
|
||||
"download": url_for("index", _external=True) + "downloads/logs/" + entry.name
|
||||
}
|
||||
})
|
||||
|
||||
return files
|
||||
|
||||
@@ -79,6 +79,8 @@ def printerToolCommand():
|
||||
|
||||
validation_regex = re.compile("tool\d+")
|
||||
|
||||
tags = {"source:api", "api:printer.tool"}
|
||||
|
||||
##~~ tool selection
|
||||
if command == "select":
|
||||
tool = data["tool"]
|
||||
@@ -87,7 +89,7 @@ def printerToolCommand():
|
||||
if not tool.startswith("tool"):
|
||||
return make_response("Invalid tool for selection: %s" % tool, 400)
|
||||
|
||||
printer.change_tool(tool)
|
||||
printer.change_tool(tool, tags=tags)
|
||||
|
||||
##~~ temperature
|
||||
elif command == "target":
|
||||
@@ -104,7 +106,7 @@ def printerToolCommand():
|
||||
|
||||
# perform the actual temperature commands
|
||||
for tool in validated_values.keys():
|
||||
printer.set_temperature(tool, validated_values[tool])
|
||||
printer.set_temperature(tool, validated_values[tool], tags=tags)
|
||||
|
||||
##~~ temperature offset
|
||||
elif command == "offset":
|
||||
@@ -133,14 +135,14 @@ def printerToolCommand():
|
||||
amount = data["amount"]
|
||||
if not isinstance(amount, (int, long, float)):
|
||||
return make_response("Not a number for extrusion amount: %r" % amount, 400)
|
||||
printer.extrude(amount)
|
||||
printer.extrude(amount, tags=tags)
|
||||
|
||||
elif command == "flowrate":
|
||||
factor = data["factor"]
|
||||
if not isinstance(factor, (int, long, float)):
|
||||
return make_response("Not a number for flow rate: %r" % factor, 400)
|
||||
try:
|
||||
printer.flow_rate(factor)
|
||||
printer.flow_rate(factor, tags=tags)
|
||||
except ValueError as e:
|
||||
return make_response("Invalid value for flow rate: %s" % str(e), 400)
|
||||
|
||||
@@ -177,6 +179,8 @@ def printerBedCommand():
|
||||
if response is not None:
|
||||
return response
|
||||
|
||||
tags = {"source:api", "api:printer.bed"}
|
||||
|
||||
##~~ temperature
|
||||
if command == "target":
|
||||
target = data["target"]
|
||||
@@ -186,7 +190,7 @@ def printerBedCommand():
|
||||
return make_response("Not a number: %r" % target, 400)
|
||||
|
||||
# perform the actual temperature command
|
||||
printer.set_temperature("bed", target)
|
||||
printer.set_temperature("bed", target, tags=tags)
|
||||
|
||||
##~~ temperature offset
|
||||
elif command == "offset":
|
||||
@@ -240,6 +244,8 @@ def printerPrintheadCommand():
|
||||
# do not jog when a print job is running or we don't have a connection
|
||||
return make_response("Printer is not operational or currently printing", 409)
|
||||
|
||||
tags = {"source:api", "api:printer.printhead"}
|
||||
|
||||
valid_axes = ["x", "y", "z"]
|
||||
##~~ jog command
|
||||
if command == "jog":
|
||||
@@ -256,7 +262,7 @@ def printerPrintheadCommand():
|
||||
speed = data.get("speed", None)
|
||||
|
||||
# execute the jog commands
|
||||
printer.jog(validated_values, relative=not absolute, speed=speed)
|
||||
printer.jog(validated_values, relative=not absolute, speed=speed, tags=tags)
|
||||
|
||||
##~~ home command
|
||||
elif command == "home":
|
||||
@@ -268,14 +274,14 @@ def printerPrintheadCommand():
|
||||
validated_values.append(axis)
|
||||
|
||||
# execute the home command
|
||||
printer.home(validated_values)
|
||||
printer.home(validated_values, tags=tags)
|
||||
|
||||
elif command == "feedrate":
|
||||
factor = data["factor"]
|
||||
if not isinstance(factor, (int, long, float)):
|
||||
return make_response("Not a number for feed rate: %r" % factor, 400)
|
||||
try:
|
||||
printer.feed_rate(factor)
|
||||
printer.feed_rate(factor, tags=tags)
|
||||
except ValueError as e:
|
||||
return make_response("Invalid value for feed rate: %s" % str(e), 400)
|
||||
|
||||
@@ -304,12 +310,14 @@ def printerSdCommand():
|
||||
if response is not None:
|
||||
return response
|
||||
|
||||
tags = {"source:api", "api:printer.sd"}
|
||||
|
||||
if command == "init":
|
||||
printer.init_sd_card()
|
||||
printer.init_sd_card(tags=tags)
|
||||
elif command == "refresh":
|
||||
printer.refresh_sd_files()
|
||||
printer.refresh_sd_files(tags=tags)
|
||||
elif command == "release":
|
||||
printer.release_sd_card()
|
||||
printer.release_sd_card(tags=tags)
|
||||
|
||||
return NO_CONTENT
|
||||
|
||||
@@ -355,6 +363,8 @@ def printerCommand():
|
||||
if "parameters" in data:
|
||||
parameters = data["parameters"]
|
||||
|
||||
tags = {"source:api", "api:printer.command"}
|
||||
|
||||
if "command" in data or "commands" in data:
|
||||
if "command" in data:
|
||||
commands = [data["command"]]
|
||||
@@ -370,7 +380,7 @@ def printerCommand():
|
||||
commandToSend = command % parameters
|
||||
commandsToSend.append(commandToSend)
|
||||
|
||||
printer.commands(commandsToSend)
|
||||
printer.commands(commandsToSend, tags=tags)
|
||||
|
||||
elif "script" in data:
|
||||
script_name = data["script"]
|
||||
@@ -379,7 +389,7 @@ def printerCommand():
|
||||
context["context"] = data["context"]
|
||||
|
||||
try:
|
||||
printer.script(script_name, context=context)
|
||||
printer.script(script_name, context=context, tags=tags)
|
||||
except UnknownScript:
|
||||
return make_response("Unknown script: {script_name}".format(**locals()), 404)
|
||||
|
||||
|
||||
@@ -116,23 +116,14 @@ def getSettings():
|
||||
"sizeThreshold": s.getInt(["gcodeViewer", "sizeThreshold"]),
|
||||
"mobileSizeThreshold": s.getInt(["gcodeViewer", "mobileSizeThreshold"]),
|
||||
"temperatureGraph": s.getBoolean(["feature", "temperatureGraph"]),
|
||||
"waitForStart": s.getBoolean(["feature", "waitForStartOnConnect"]),
|
||||
"alwaysSendChecksum": s.getBoolean(["feature", "alwaysSendChecksum"]),
|
||||
"neverSendChecksum": s.getBoolean(["feature", "neverSendChecksum"]),
|
||||
"sdSupport": s.getBoolean(["feature", "sdSupport"]),
|
||||
"sdRelativePath": s.getBoolean(["feature", "sdRelativePath"]),
|
||||
"sdAlwaysAvailable": s.getBoolean(["feature", "sdAlwaysAvailable"]),
|
||||
"swallowOkAfterResend": s.getBoolean(["feature", "swallowOkAfterResend"]),
|
||||
"repetierTargetTemp": s.getBoolean(["feature", "repetierTargetTemp"]),
|
||||
"externalHeatupDetection": s.getBoolean(["feature", "externalHeatupDetection"]),
|
||||
"keyboardControl": s.getBoolean(["feature", "keyboardControl"]),
|
||||
"pollWatched": s.getBoolean(["feature", "pollWatched"]),
|
||||
"ignoreIdenticalResends": s.getBoolean(["feature", "ignoreIdenticalResends"]),
|
||||
"modelSizeDetection": s.getBoolean(["feature", "modelSizeDetection"]),
|
||||
"firmwareDetection": s.getBoolean(["feature", "firmwareDetection"]),
|
||||
"printCancelConfirmation": s.getBoolean(["feature", "printCancelConfirmation"]),
|
||||
"blockWhileDwelling": s.getBoolean(["feature", "blockWhileDwelling"]),
|
||||
"g90InfluencesExtruder": s.getBoolean(["feature", "g90InfluencesExtruder"])
|
||||
"g90InfluencesExtruder": s.getBoolean(["feature", "g90InfluencesExtruder"]),
|
||||
"autoUppercaseBlacklist": s.get(["feature", "autoUppercaseBlacklist"]),
|
||||
"legacyPluginAssets": s.getBoolean(["feature", "legacyPluginAssets"])
|
||||
},
|
||||
"serial": {
|
||||
"port": connectionOptions["portPreference"],
|
||||
@@ -143,6 +134,7 @@ def getSettings():
|
||||
"timeoutConnection": s.getFloat(["serial", "timeout", "connection"]),
|
||||
"timeoutDetection": s.getFloat(["serial", "timeout", "detection"]),
|
||||
"timeoutCommunication": s.getFloat(["serial", "timeout", "communication"]),
|
||||
"timeoutCommunicationBusy": s.getFloat(["serial", "timeout", "communicationBusy"]),
|
||||
"timeoutTemperature": s.getFloat(["serial", "timeout", "temperature"]),
|
||||
"timeoutTemperatureTargetSet": s.getFloat(["serial", "timeout", "temperatureTargetSet"]),
|
||||
"timeoutTemperatureAutoreport": s.getFloat(["serial", "timeout", "temperatureAutoreport"]),
|
||||
@@ -156,13 +148,25 @@ def getSettings():
|
||||
"ignoreErrorsFromFirmware": s.getBoolean(["serial", "ignoreErrorsFromFirmware"]),
|
||||
"disconnectOnErrors": s.getBoolean(["serial", "disconnectOnErrors"]),
|
||||
"triggerOkForM29": s.getBoolean(["serial", "triggerOkForM29"]),
|
||||
"autoUppercaseBlacklist": s.get(["serial", "autoUppercaseBlacklist"]),
|
||||
"logPositionOnPause": s.getBoolean(["serial", "logPositionOnPause"]),
|
||||
"logPositionOnCancel": s.getBoolean(["serial", "logPositionOnCancel"]),
|
||||
"supportResendsWithoutOk": s.getBoolean(["serial", "supportResendsWithoutOk"]),
|
||||
"waitForStart": s.getBoolean(["serial", "waitForStartOnConnect"]),
|
||||
"alwaysSendChecksum": s.getBoolean(["serial", "alwaysSendChecksum"]),
|
||||
"neverSendChecksum": s.getBoolean(["serial", "neverSendChecksum"]),
|
||||
"sdRelativePath": s.getBoolean(["serial", "sdRelativePath"]),
|
||||
"sdAlwaysAvailable": s.getBoolean(["serial", "sdAlwaysAvailable"]),
|
||||
"swallowOkAfterResend": s.getBoolean(["serial", "swallowOkAfterResend"]),
|
||||
"repetierTargetTemp": s.getBoolean(["serial", "repetierTargetTemp"]),
|
||||
"externalHeatupDetection": s.getBoolean(["serial", "externalHeatupDetection"]),
|
||||
"ignoreIdenticalResends": s.getBoolean(["serial", "ignoreIdenticalResends"]),
|
||||
"firmwareDetection": s.getBoolean(["serial", "firmwareDetection"]),
|
||||
"blockWhileDwelling": s.getBoolean(["serial", "blockWhileDwelling"]),
|
||||
"maxTimeoutsIdle": s.getInt(["serial", "maxCommunicationTimeouts", "idle"]),
|
||||
"maxTimeoutsPrinting": s.getInt(["serial", "maxCommunicationTimeouts", "printing"]),
|
||||
"maxTimeoutsLong": s.getInt(["serial", "maxCommunicationTimeouts", "long"])
|
||||
"maxTimeoutsLong": s.getInt(["serial", "maxCommunicationTimeouts", "long"]),
|
||||
"capAutoreportTemp": s.getBoolean(["serial", "capabilities", "autoreport_temp"]),
|
||||
"capBusyProtocol": s.getBoolean(["serial", "capabilities", "busy_protocol"])
|
||||
},
|
||||
"folder": {
|
||||
"uploads": s.getBaseFolder("uploads"),
|
||||
@@ -347,23 +351,14 @@ def _saveSettings(data):
|
||||
if "sizeThreshold" in data["feature"]: s.setInt(["gcodeViewer", "sizeThreshold"], data["feature"]["sizeThreshold"])
|
||||
if "mobileSizeThreshold" in data["feature"]: s.setInt(["gcodeViewer", "mobileSizeThreshold"], data["feature"]["mobileSizeThreshold"])
|
||||
if "temperatureGraph" in data["feature"]: s.setBoolean(["feature", "temperatureGraph"], data["feature"]["temperatureGraph"])
|
||||
if "waitForStart" in data["feature"]: s.setBoolean(["feature", "waitForStartOnConnect"], data["feature"]["waitForStart"])
|
||||
if "alwaysSendChecksum" in data["feature"]: s.setBoolean(["feature", "alwaysSendChecksum"], data["feature"]["alwaysSendChecksum"])
|
||||
if "neverSendChecksum" in data["feature"]: s.setBoolean(["feature", "neverSendChecksum"], data["feature"]["neverSendChecksum"])
|
||||
if "sdSupport" in data["feature"]: s.setBoolean(["feature", "sdSupport"], data["feature"]["sdSupport"])
|
||||
if "sdRelativePath" in data["feature"]: s.setBoolean(["feature", "sdRelativePath"], data["feature"]["sdRelativePath"])
|
||||
if "sdAlwaysAvailable" in data["feature"]: s.setBoolean(["feature", "sdAlwaysAvailable"], data["feature"]["sdAlwaysAvailable"])
|
||||
if "swallowOkAfterResend" in data["feature"]: s.setBoolean(["feature", "swallowOkAfterResend"], data["feature"]["swallowOkAfterResend"])
|
||||
if "repetierTargetTemp" in data["feature"]: s.setBoolean(["feature", "repetierTargetTemp"], data["feature"]["repetierTargetTemp"])
|
||||
if "externalHeatupDetection" in data["feature"]: s.setBoolean(["feature", "externalHeatupDetection"], data["feature"]["externalHeatupDetection"])
|
||||
if "keyboardControl" in data["feature"]: s.setBoolean(["feature", "keyboardControl"], data["feature"]["keyboardControl"])
|
||||
if "pollWatched" in data["feature"]: s.setBoolean(["feature", "pollWatched"], data["feature"]["pollWatched"])
|
||||
if "ignoreIdenticalResends" in data["feature"]: s.setBoolean(["feature", "ignoreIdenticalResends"], data["feature"]["ignoreIdenticalResends"])
|
||||
if "modelSizeDetection" in data["feature"]: s.setBoolean(["feature", "modelSizeDetection"], data["feature"]["modelSizeDetection"])
|
||||
if "firmwareDetection" in data["feature"]: s.setBoolean(["feature", "firmwareDetection"], data["feature"]["firmwareDetection"])
|
||||
if "printCancelConfirmation" in data["feature"]: s.setBoolean(["feature", "printCancelConfirmation"], data["feature"]["printCancelConfirmation"])
|
||||
if "blockWhileDwelling" in data["feature"]: s.setBoolean(["feature", "blockWhileDwelling"], data["feature"]["blockWhileDwelling"])
|
||||
if "g90InfluencesExtruder" in data["feature"]: s.setBoolean(["feature", "g90InfluencesExtruder"], data["feature"]["g90InfluencesExtruder"])
|
||||
if "legacyPluginAssets" in data["feature"]: s.setBoolean(["feature", "legacyPluginAssets"], data["feature"]["legacyPluginAssets"])
|
||||
if "autoUppercaseBlacklist" in data["feature"] and isinstance(data["feature"]["autoUppercaseBlacklist"], (list, tuple)): s.set(["feature", "autoUppercaseBlacklist"], data["feature"]["autoUppercaseBlacklist"])
|
||||
|
||||
if "serial" in data.keys():
|
||||
if "autoconnect" in data["serial"]: s.setBoolean(["serial", "autoconnect"], data["serial"]["autoconnect"])
|
||||
@@ -372,6 +367,7 @@ def _saveSettings(data):
|
||||
if "timeoutConnection" in data["serial"]: s.setFloat(["serial", "timeout", "connection"], data["serial"]["timeoutConnection"])
|
||||
if "timeoutDetection" in data["serial"]: s.setFloat(["serial", "timeout", "detection"], data["serial"]["timeoutDetection"])
|
||||
if "timeoutCommunication" in data["serial"]: s.setFloat(["serial", "timeout", "communication"], data["serial"]["timeoutCommunication"])
|
||||
if "timeoutCommunicationBusy" in data["serial"]: s.setFloat(["serial", "timeout", "communicationBusy"], data["serial"]["timeoutCommunicationBusy"])
|
||||
if "timeoutTemperature" in data["serial"]: s.setFloat(["serial", "timeout", "temperature"], data["serial"]["timeoutTemperature"])
|
||||
if "timeoutTemperatureTargetSet" in data["serial"]: s.setFloat(["serial", "timeout", "temperatureTargetSet"], data["serial"]["timeoutTemperatureTargetSet"])
|
||||
if "timeoutTemperatureAutoreport" in data["serial"]: s.setFloat(["serial", "timeout", "temperatureAutoreport"], data["serial"]["timeoutTemperatureAutoreport"])
|
||||
@@ -384,13 +380,25 @@ def _saveSettings(data):
|
||||
if "ignoreErrorsFromFirmware" in data["serial"]: s.setBoolean(["serial", "ignoreErrorsFromFirmware"], data["serial"]["ignoreErrorsFromFirmware"])
|
||||
if "disconnectOnErrors" in data["serial"]: s.setBoolean(["serial", "disconnectOnErrors"], data["serial"]["disconnectOnErrors"])
|
||||
if "triggerOkForM29" in data["serial"]: s.setBoolean(["serial", "triggerOkForM29"], data["serial"]["triggerOkForM29"])
|
||||
if "autoUppercaseBlacklist" in data["serial"] and isinstance(data["serial"]["autoUppercaseBlacklist"], (list, tuple)): s.set(["serial", "autoUppercaseBlacklist"], data["serial"]["autoUppercaseBlacklist"])
|
||||
if "supportResendsWithoutOk" in data["serial"]: s.setBoolean(["serial", "supportResendsWithoutOk"], data["serial"]["supportResendsWithoutOk"])
|
||||
if "waitForStart" in data["serial"]: s.setBoolean(["serial", "waitForStartOnConnect"], data["serial"]["waitForStart"])
|
||||
if "alwaysSendChecksum" in data["serial"]: s.setBoolean(["serial", "alwaysSendChecksum"], data["serial"]["alwaysSendChecksum"])
|
||||
if "neverSendChecksum" in data["serial"]: s.setBoolean(["serial", "neverSendChecksum"], data["serial"]["neverSendChecksum"])
|
||||
if "sdRelativePath" in data["serial"]: s.setBoolean(["serial", "sdRelativePath"], data["serial"]["sdRelativePath"])
|
||||
if "sdAlwaysAvailable" in data["serial"]: s.setBoolean(["serial", "sdAlwaysAvailable"], data["serial"]["sdAlwaysAvailable"])
|
||||
if "swallowOkAfterResend" in data["serial"]: s.setBoolean(["serial", "swallowOkAfterResend"], data["serial"]["swallowOkAfterResend"])
|
||||
if "repetierTargetTemp" in data["serial"]: s.setBoolean(["serial", "repetierTargetTemp"], data["serial"]["repetierTargetTemp"])
|
||||
if "externalHeatupDetection" in data["serial"]: s.setBoolean(["serial", "externalHeatupDetection"], data["serial"]["externalHeatupDetection"])
|
||||
if "ignoreIdenticalResends" in data["serial"]: s.setBoolean(["serial", "ignoreIdenticalResends"], data["serial"]["ignoreIdenticalResends"])
|
||||
if "firmwareDetection" in data["serial"]: s.setBoolean(["serial", "firmwareDetection"], data["serial"]["firmwareDetection"])
|
||||
if "blockWhileDwelling" in data["serial"]: s.setBoolean(["serial", "blockWhileDwelling"], data["serial"]["blockWhileDwelling"])
|
||||
if "logPositionOnPause" in data["serial"]: s.setBoolean(["serial", "logPositionOnPause"], data["serial"]["logPositionOnPause"])
|
||||
if "logPositionOnCancel" in data["serial"]: s.setBoolean(["serial", "logPositionOnCancel"], data["serial"]["logPositionOnCancel"])
|
||||
if "maxTimeoutsIdle" in data["serial"]: s.setInt(["serial", "maxCommunicationTimeouts", "idle"], data["serial"]["maxTimeoutsIdle"])
|
||||
if "maxTimeoutsPrinting" in data["serial"]: s.setInt(["serial", "maxCommunicationTimeouts", "printing"], data["serial"]["maxTimeoutsPrinting"])
|
||||
if "maxTimeoutsLong" in data["serial"]: s.setInt(["serial", "maxCommunicationTimeouts", "long"], data["serial"]["maxTimeoutsLong"])
|
||||
if "capAutoreportTemp" in data["serial"]: s.setBoolean(["serial", "capabilities", "autoreport_temp"], data["serial"]["capAutoreportTemp"])
|
||||
if "capBusyProtocol" in data["serial"]: s.setBoolean(["serial", "capabilities", "busy_protocol"], data["serial"]["capBusyProtocol"])
|
||||
|
||||
oldLog = s.getBoolean(["serial", "log"])
|
||||
if "log" in data["serial"]: s.setBoolean(["serial", "log"], data["serial"]["log"])
|
||||
@@ -412,7 +420,13 @@ def _saveSettings(data):
|
||||
|
||||
if "temperature" in data.keys():
|
||||
if "profiles" in data["temperature"]: s.set(["temperature", "profiles"], data["temperature"]["profiles"])
|
||||
if "cutoff" in data["temperature"]: s.setInt(["temperature", "cutoff"], data["temperature"]["cutoff"])
|
||||
if "cutoff" in data["temperature"]:
|
||||
try:
|
||||
cutoff = int(data["temperature"]["cutoff"])
|
||||
if cutoff > 1:
|
||||
s.setInt(["temperature", "cutoff"], cutoff)
|
||||
except ValueError:
|
||||
pass
|
||||
if "sendAutomatically" in data["temperature"]: s.setBoolean(["temperature", "sendAutomatically"], data["temperature"]["sendAutomatically"])
|
||||
if "sendAutomaticallyAfter" in data["temperature"]: s.setInt(["temperature", "sendAutomaticallyAfter"], data["temperature"]["sendAutomaticallyAfter"], min=0, max=30)
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ def downloadTimelapse(filename):
|
||||
@restricted_access
|
||||
@Permissions.TIMELAPSE_ADMIN.require(403)
|
||||
def deleteTimelapse(filename):
|
||||
if util.is_allowed_file(filename, ["mpg", "mpeg", "mp4"]):
|
||||
if util.is_allowed_file(filename, ["mpg", "mpeg", "mp4", "m4v", "mkv"]):
|
||||
timelapse_folder = settings().getBaseFolder("timelapse")
|
||||
full_path = os.path.realpath(os.path.join(timelapse_folder, filename))
|
||||
if full_path.startswith(timelapse_folder) and os.path.exists(full_path):
|
||||
|
||||
Reference in new issue
Block a user