Merge branch 'maintenance' into devel
This commit is contained in:
commit
d2452c007e
12 files changed
+95
-63
No files matched your search
@@ -23,11 +23,11 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: 🔀 Merge maintenance into devel
|
||||
uses: robotology/gh-action-nightly-merge@v1.3.2
|
||||
with:
|
||||
stable_branch: "maintenance"
|
||||
development_branch: "devel"
|
||||
allow_ff: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
#- name: 🔀 Merge maintenance into devel
|
||||
# uses: robotology/gh-action-nightly-merge@v1.3.2
|
||||
# with:
|
||||
# stable_branch: "maintenance"
|
||||
# development_branch: "devel"
|
||||
# allow_ff: false
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -139,6 +139,8 @@ date of first contribution):
|
||||
* [Miroslav Šedivý](https://github.com/eumiro)
|
||||
* [Costas Basdekis](https://github.com/costas-basdekis)
|
||||
* [Joe Martella](https://github.com/martellaj)
|
||||
* [Scott Lahteine](https://github.com/thinkyhead)
|
||||
* [Karthikeyan Singaravelan](https://github.com/tirkarthi)
|
||||
|
||||
OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by
|
||||
[Daid Braam](https://github.com/daid). Parts of its communication layer and
|
||||
|
||||
@@ -1132,9 +1132,9 @@ Use `Javascript regular expressions <https://developer.mozilla.org/en/docs/Web/J
|
||||
# A list of filters to display in the terminal tab. Defaults to the filters shown below
|
||||
terminalFilters:
|
||||
- name: Suppress temperature messages
|
||||
regex: '(Send: (N\d+\s+)?M105)|(Recv:\s+(ok\s+)?.*(B|T\d*):\d+)'
|
||||
regex: '(Send: (N\d+\s+)?M105)|(Recv:\s+(ok\s+([PBN]\d+\s+)*)?([BCLPR]|T\d*):-?\d+)'
|
||||
- name: Suppress SD status messages
|
||||
regex: '(Send: (N\d+\s+)?M27)|(Recv: SD printing byte)'
|
||||
regex: '(Send: (N\d+\s+)?M27)|(Recv: SD printing byte)|(Recv: Not SD printing)'
|
||||
- name: Suppress wait responses
|
||||
regex: 'Recv: wait'
|
||||
- name: Suppress processing responses
|
||||
|
||||
@@ -71,7 +71,7 @@ If you also want to be able to build the documentation that resides in the ``doc
|
||||
the *Python 3* environment and install the docs dependencies as well:
|
||||
|
||||
* ``source venv3/bin/activate`` (Linux, macOS) or ``source venv3/Scripts/activate`` (Git Bash under Windows, see below)
|
||||
* ``pip install -e .[develop,plugins,docs]``
|
||||
* ``pip install -e '.[develop,plugins,docs]'``
|
||||
|
||||
Go to the directory `docs` and you can then build the documentation:
|
||||
|
||||
@@ -112,7 +112,7 @@ Then:
|
||||
virtualenv --python=python3 venv
|
||||
source ./venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip install -e .[develop,plugins,docs]
|
||||
pip install -e '.[develop,plugins,docs]'
|
||||
pre-commit install
|
||||
git config blame.ignoreRevsFile .git-blame-ignore-revs
|
||||
|
||||
@@ -153,7 +153,7 @@ Open the Git Bash you just installed and in that:
|
||||
virtualenv --python=C:\Python38\python.exe venv
|
||||
source ./venv/Scripts/activate
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -e .[develop,plugins,docs]
|
||||
python -m pip install -e '.[develop,plugins,docs]'
|
||||
pre-commit install
|
||||
git config blame.ignoreRevsFile .git-blame-ignore-revs
|
||||
|
||||
@@ -229,7 +229,7 @@ You'll need a user account with administrator privileges.
|
||||
virtualenv venv
|
||||
source venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip install -e .[develop,plugins]
|
||||
pip install -e '.[develop,plugins]'
|
||||
pre-commit install
|
||||
git config blame.ignoreRevsFile .git-blame-ignore-revs
|
||||
|
||||
@@ -277,7 +277,7 @@ PyCharm
|
||||
|
||||
* Name: Update OctoPrint dependencies
|
||||
* Program: ``$ModuleSdkPath$``
|
||||
* Parameters: ``-m pip install -e .[develop,plugins]``
|
||||
* Parameters: ``-m pip install -e '.[develop,plugins]'``
|
||||
* Working directory: ``$ProjectFileDir$``
|
||||
|
||||
Note that sadly that seems to cause some hiccups on current PyCharm versions due to ``$PyInterpreterDirectory$``
|
||||
@@ -306,7 +306,7 @@ PyCharm
|
||||
the documentation, see above on how to set this up.
|
||||
|
||||
Note that this requires you to also have installed the additional ``docs`` dependencies into the Python 3 venv as
|
||||
described above via ``pip install -e .[develop,plugins,docs]``.
|
||||
described above via ``pip install -e '.[develop,plugins,docs]'``.
|
||||
|
||||
- Settings > Tools > File Watchers (you might have to enable this, it's a bundled plugin), add new:
|
||||
|
||||
|
||||
@@ -1492,6 +1492,7 @@ class LocalFileStorage(StorageInterface):
|
||||
logtarget=__name__ + ".timings",
|
||||
message="{func}({func_args},{func_kwargs}) took {timing:.2f}ms",
|
||||
incl_func_args=True,
|
||||
log_enter=True,
|
||||
)
|
||||
def _list_folder(self, path, base="", force_refresh=False, **kwargs):
|
||||
def get_size(nodes):
|
||||
@@ -1519,11 +1520,8 @@ class LocalFileStorage(StorageInterface):
|
||||
try:
|
||||
with self._filelist_cache_mutex:
|
||||
cache = self._filelist_cache.get(path)
|
||||
if (
|
||||
not force_refresh
|
||||
and cache
|
||||
and cache[0] >= self.last_modified(path, recursive=True)
|
||||
):
|
||||
lm = self.last_modified(path, recursive=True)
|
||||
if not force_refresh and cache and cache[0] >= lm:
|
||||
return enrich_folders(cache[1])
|
||||
|
||||
metadata = self._get_metadata(path)
|
||||
@@ -1664,7 +1662,7 @@ class LocalFileStorage(StorageInterface):
|
||||
continue
|
||||
|
||||
self._filelist_cache[path] = (
|
||||
self.last_modified(path, recursive=True),
|
||||
lm,
|
||||
result,
|
||||
)
|
||||
return enrich_folders(result)
|
||||
|
||||
@@ -1076,10 +1076,14 @@ class SoftwareUpdatePlugin(
|
||||
and not self._settings.get_boolean(["ignore_throttled"])
|
||||
):
|
||||
# currently throttled, we refuse to run
|
||||
message = (
|
||||
"System is currently throttled, refusing to update "
|
||||
"anything due to possible stability issues"
|
||||
)
|
||||
self._logger.error(message)
|
||||
flask.abort(
|
||||
409,
|
||||
description="System is currently throttled, refusing to update "
|
||||
"anything due to possible stability issues",
|
||||
description=message,
|
||||
)
|
||||
|
||||
if self._printer.is_printing() or self._printer.is_paused():
|
||||
|
||||
@@ -680,13 +680,20 @@ $(function () {
|
||||
gettext("Updating, please wait.")
|
||||
);
|
||||
})
|
||||
.fail(function () {
|
||||
.fail(function (response) {
|
||||
self.updateInProgress = false;
|
||||
var message =
|
||||
"<p>" +
|
||||
gettext(
|
||||
"The update could not be started. Is it already active? Please consult octoprint.log for details."
|
||||
) +
|
||||
"</p><pre>" +
|
||||
_.escape(response.responseJSON.error) +
|
||||
"</pre>";
|
||||
|
||||
self._showPopup({
|
||||
title: gettext("Update not started!"),
|
||||
text: gettext(
|
||||
"The update could not be started. Is it already active? Please consult octoprint.log for details."
|
||||
),
|
||||
text: message,
|
||||
type: "error",
|
||||
hide: false,
|
||||
buttons: {
|
||||
|
||||
@@ -755,19 +755,17 @@ class Server:
|
||||
}
|
||||
timelapses_path_validator = {
|
||||
"path_validation": util.tornado.path_validation_factory(
|
||||
lambda path: not octoprint.util.is_hidden_path(path)
|
||||
and octoprint.timelapse.valid_timelapse(path),
|
||||
lambda path: valid_timelapse(path)
|
||||
and os.path.realpath(os.path.abspath(path)).startswith(
|
||||
settings().getBaseFolder("timelapse")
|
||||
),
|
||||
status_code=400,
|
||||
)
|
||||
}
|
||||
|
||||
valid_log = (
|
||||
lambda path: not octoprint.util.is_hidden_path(path)
|
||||
and path.endswith(".log")
|
||||
and os.path.realpath(os.path.abspath(path)).startswith(
|
||||
settings().getBaseFolder("logs")
|
||||
)
|
||||
)
|
||||
valid_log = lambda path: not octoprint.util.is_hidden_path(
|
||||
path
|
||||
) and path.endswith(".log")
|
||||
log_path_validator = {
|
||||
"path_validation": util.tornado.path_validation_factory(
|
||||
valid_log,
|
||||
@@ -776,7 +774,10 @@ class Server:
|
||||
}
|
||||
logs_path_validator = {
|
||||
"path_validation": util.tornado.path_validation_factory(
|
||||
valid_log,
|
||||
lambda path: valid_log(path)
|
||||
and os.path.realpath(os.path.abspath(path)).startswith(
|
||||
settings().getBaseFolder("logs")
|
||||
),
|
||||
status_code=400,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ def readGcodeFile(target, filename):
|
||||
if target not in [FileDestinations.LOCAL, FileDestinations.SDCARD]:
|
||||
abort(404)
|
||||
|
||||
if filename != fileManager.sanitize(target, filename):
|
||||
if not _validate(target, filename):
|
||||
abort(404)
|
||||
|
||||
recursive = False
|
||||
@@ -244,6 +244,8 @@ def _getFileDetails(origin, path, recursive=True):
|
||||
logtarget=__name__ + ".timings",
|
||||
message="{func}({func_args},{func_kwargs}) took {timing:.2f}ms",
|
||||
incl_func_args=True,
|
||||
log_enter=True,
|
||||
message_enter="Entering {func}({func_args},{func_kwargs})...",
|
||||
)
|
||||
def _getFileList(
|
||||
origin, path=None, filter=None, recursive=False, level=0, allow_from_cache=True
|
||||
@@ -730,7 +732,7 @@ def gcodeFileCommand(filename, target):
|
||||
if target not in [FileDestinations.LOCAL, FileDestinations.SDCARD]:
|
||||
abort(404)
|
||||
|
||||
if filename != fileManager.sanitize(target, filename):
|
||||
if not _validate(target, filename):
|
||||
abort(404)
|
||||
|
||||
# valid file commands, dict mapping command name to mandatory parameters
|
||||
@@ -1094,7 +1096,7 @@ def gcodeFileCommand(filename, target):
|
||||
@no_firstrun_access
|
||||
@Permissions.FILES_DELETE.require(403)
|
||||
def deleteGcodeFile(filename, target):
|
||||
if filename != fileManager.sanitize(target, filename):
|
||||
if not _validate(target, filename):
|
||||
abort(404)
|
||||
|
||||
if not _verifyFileExists(target, filename) and not _verifyFolderExists(
|
||||
@@ -1159,6 +1161,12 @@ def _getCurrentFile():
|
||||
return None, None
|
||||
|
||||
|
||||
def _validate(target, filename):
|
||||
return filename == "/".join(
|
||||
map(lambda x: fileManager.sanitize_name(target, x), filename.split("/"))
|
||||
)
|
||||
|
||||
|
||||
class WerkzeugFileWrapper(octoprint.filemanager.util.AbstractFileWrapper):
|
||||
"""
|
||||
A wrapper around a Werkzeug ``FileStorage`` object.
|
||||
|
||||
@@ -397,7 +397,7 @@ default_settings = {
|
||||
"terminalFilters": [
|
||||
{
|
||||
"name": "Suppress temperature messages",
|
||||
"regex": r"(Send: (N\d+\s+)?M105)|(Recv:\s+(ok\s+((P|B|N)\d+\s+)*)?(B|T\d*):\d+)",
|
||||
"regex": r"(Send: (N\d+\s+)?M105)|(Recv:\s+(ok\s+([PBN]\d+\s+)*)?([BCLPR]|T\d*):-?\d+)",
|
||||
},
|
||||
{
|
||||
"name": "Suppress SD status messages",
|
||||
|
||||
@@ -406,7 +406,8 @@ $(function () {
|
||||
self.addTerminalFilter = function () {
|
||||
self.terminalFilters.push({
|
||||
name: "New",
|
||||
regex: "(Send:\\s+(N\\d+\\s+)?M105)|(Recv:\\s+(ok\\s+)?.*(B|T\\d*):\\d+)"
|
||||
regex:
|
||||
"(Send:\\s+(N\\d+\\s+)?M105)|(Recv:\\s+(ok\\s+([PBN]\\d+\\s+)*)?.*([BCLPR]|T\\d*):-?\\d+)"
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -24,6 +24,13 @@ import warnings
|
||||
from functools import wraps
|
||||
from typing import Union
|
||||
|
||||
try:
|
||||
# Python 3.4+
|
||||
from collections.abc import Iterable, MutableMapping, Set
|
||||
except ImportError:
|
||||
# Python 2.7
|
||||
from collections import Iterable, MutableMapping, Set
|
||||
|
||||
import frozendict
|
||||
|
||||
from octoprint import UMASK
|
||||
@@ -970,7 +977,7 @@ def dict_flatten(dictionary, prefix="", separator="."):
|
||||
result = {}
|
||||
for k, v in dictionary.items():
|
||||
key = prefix + separator + k if prefix else k
|
||||
if isinstance(v, collections.MutableMapping):
|
||||
if isinstance(v, MutableMapping):
|
||||
result.update(dict_flatten(v, prefix=key, separator=separator))
|
||||
else:
|
||||
result[key] = v
|
||||
@@ -1677,7 +1684,6 @@ class CountedEvent:
|
||||
|
||||
class InvariantContainer:
|
||||
def __init__(self, initial_data=None, guarantee_invariant=None):
|
||||
from collections.abc import Iterable
|
||||
from threading import RLock
|
||||
|
||||
if guarantee_invariant is None:
|
||||
@@ -1798,7 +1804,7 @@ class TypeAlreadyInQueue(Exception):
|
||||
self.type = t
|
||||
|
||||
|
||||
class CaseInsensitiveSet(collections.Set):
|
||||
class CaseInsensitiveSet(Set):
|
||||
"""
|
||||
Basic case insensitive set
|
||||
|
||||
@@ -1849,33 +1855,38 @@ def time_this(
|
||||
expand_logtarget=False,
|
||||
message="{func} took {timing:.2f}ms",
|
||||
incl_func_args=False,
|
||||
log_enter=False,
|
||||
message_enter="Entering {func}...",
|
||||
):
|
||||
def decorator(f):
|
||||
func = fqfn(f)
|
||||
|
||||
lt = logtarget
|
||||
if expand_logtarget:
|
||||
lt += "." + func
|
||||
|
||||
logger = logging.getLogger(lt)
|
||||
|
||||
@wraps(f)
|
||||
def wrapper(*args, **kwargs):
|
||||
data = {"func": func, "func_args": "?", "func_kwargs": "?"}
|
||||
if incl_func_args and logger.isEnabledFor(logging.DEBUG):
|
||||
data.update(
|
||||
func_args=",".join(map(repr, args)),
|
||||
func_kwargs=",".join(
|
||||
map(lambda x: "{}={!r}".format(x[0], x[1]), kwargs.items())
|
||||
),
|
||||
)
|
||||
if log_enter:
|
||||
logger.debug(message_enter.format(**data), extra=data)
|
||||
|
||||
start = time.time()
|
||||
try:
|
||||
return f(*args, **kwargs)
|
||||
finally:
|
||||
timing = (time.time() - start) * 1000
|
||||
func = fqfn(f)
|
||||
|
||||
lt = logtarget
|
||||
if expand_logtarget:
|
||||
lt += "." + func
|
||||
|
||||
logger = logging.getLogger(lt)
|
||||
if logger.isEnabledFor(logging.DEBUG):
|
||||
data = {"func": func, "timing": timing}
|
||||
if incl_func_args:
|
||||
data.update(
|
||||
func_args=",".join(map(repr, args)),
|
||||
func_kwargs=",".join(
|
||||
map(
|
||||
lambda x: "{}={!r}".format(x[0], x[1]), kwargs.items()
|
||||
)
|
||||
),
|
||||
)
|
||||
data.update(timing=timing)
|
||||
logger.debug(message.format(**data), extra=data)
|
||||
|
||||
return wrapper
|
||||
|
||||
Reference in new issue
Block a user