From 0db80dc0c9d70f75c28588a2ebdd4f9c4d49a159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 12 Sep 2022 18:30:30 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=92=EF=B8=8F=20Limit=20folder=20config?= =?UTF-8?q?=20in=20UI=20to=20necessities?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit uploads, timelapse and watched folder should be configurable in the UI, but limiting anything else to the config.yaml file is fair considering it rarely should have to be touched. This reduces the likelihood of misconfiguration or abuse. --- src/octoprint/server/api/settings.py | 10 ++------ .../static/js/app/viewmodels/settings.js | 4 +-- .../templates/dialogs/settings/folders.jinja2 | 25 ++++--------------- 3 files changed, 8 insertions(+), 31 deletions(-) diff --git a/src/octoprint/server/api/settings.py b/src/octoprint/server/api/settings.py index 14d065804..ba01887ca 100644 --- a/src/octoprint/server/api/settings.py +++ b/src/octoprint/server/api/settings.py @@ -18,8 +18,7 @@ from octoprint.settings import settings, valid_boolean_trues # ~~ settings -FOLDER_TYPES = ("uploads", "timelapse", "timelapse_tmp", "logs", "watched") -FOLDER_MAPPING = {"timelapseTmp": "timelapse_tmp"} +FOLDER_TYPES = ("uploads", "timelapse", "watched") TIMELAPSE_BITRATE_PATTERN = re.compile(r"\d+[KMGTPEZY]?i?B?", flags=re.IGNORECASE) @@ -269,8 +268,6 @@ def getSettings(): "folder": { "uploads": s.getBaseFolder("uploads"), "timelapse": s.getBaseFolder("timelapse"), - "timelapseTmp": s.getBaseFolder("timelapse_tmp"), - "logs": s.getBaseFolder("logs"), "watched": s.getBaseFolder("watched"), }, "temperature": { @@ -464,10 +461,7 @@ def _saveSettings(data): if "folder" in data: try: - folders = { - FOLDER_MAPPING.get(folder, folder): path - for folder, path in data["folder"].items() - } + folders = data["folder"] future = {} for folder in FOLDER_TYPES: future[folder] = s.getBaseFolder(folder) diff --git a/src/octoprint/static/js/app/viewmodels/settings.js b/src/octoprint/static/js/app/viewmodels/settings.js index bf56727c3..4a4864164 100644 --- a/src/octoprint/static/js/app/viewmodels/settings.js +++ b/src/octoprint/static/js/app/viewmodels/settings.js @@ -255,8 +255,6 @@ $(function () { self.folder_uploads = ko.observable(undefined); self.folder_timelapse = ko.observable(undefined); - self.folder_timelapseTmp = ko.observable(undefined); - self.folder_logs = ko.observable(undefined); self.folder_watched = ko.observable(undefined); self.scripts_gcode_beforePrintStarted = ko.observable(undefined); @@ -344,7 +342,7 @@ $(function () { self.server_onlineCheckResolutionBroken(false); }; - var folderTypes = ["uploads", "timelapse", "timelapseTmp", "logs", "watched"]; + var folderTypes = ["uploads", "timelapse", "watched"]; var checkForDuplicateFolders = function () { _.each(folderTypes, function (folderType) { diff --git a/src/octoprint/templates/dialogs/settings/folders.jinja2 b/src/octoprint/templates/dialogs/settings/folders.jinja2 index 23f673812..4e5328510 100644 --- a/src/octoprint/templates/dialogs/settings/folders.jinja2 +++ b/src/octoprint/templates/dialogs/settings/folders.jinja2 @@ -20,26 +20,6 @@ -
- -
- - -
-
-
- -
- - -
-
@@ -65,6 +45,11 @@ {% endtrans %}
+

{% trans %} + Please note: Not all of the folders used by OctoPrint can be configured through the UI, only those most commonly moved to other places. If you need to configure other folders, + please do so by manually editing the configuration. See the docs for details. + {% endtrans %}

+

{{ _('Disk space thresholds') }}

{{ _('If the free disk space falls below these thresholds, OctoPrint will warn the user.') }}