Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f430257d70 | ||
|
|
d2a9aaceda | ||
|
|
8ca327669c | ||
|
|
d1fca86636 | ||
|
|
4d9e86ca0f | ||
|
|
6d259d7e6f | ||
|
|
5ef16773c8 | ||
|
|
8087528e4a | ||
|
|
700034d028 | ||
|
|
885ca31168 | ||
|
|
64c21ba8f0 | ||
|
|
53dbde2ef9 | ||
|
|
45598764e6 | ||
|
|
2ecc1c944f | ||
|
|
d81504c12e | ||
|
|
302ccc087b | ||
|
|
c5b095a8b9 | ||
|
|
f4b4f50cfd | ||
|
|
9faec6e982 | ||
|
|
3c478036ae | ||
|
|
76e87ba813 | ||
|
|
ad32bbfdb8 | ||
|
|
ccd5fa56a2 | ||
|
|
24b5b3a857 | ||
|
|
3be85646cd | ||
|
|
54207abbe1 | ||
|
|
4c4721518c | ||
|
|
772f9f95da | ||
|
|
6728a17448 | ||
|
|
7bc2a79642 | ||
|
|
8c9536f323 | ||
|
|
594b660bb6 | ||
|
|
23f90060c6 |
No files matched your search
@@ -15,7 +15,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: 🔀 Merge master into maintenance
|
||||
uses: robotology/gh-action-nightly-merge@v1.3.2
|
||||
uses: robotology/gh-action-nightly-merge@v1.3.3
|
||||
with:
|
||||
stable_branch: "master"
|
||||
development_branch: "maintenance"
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: 🔀 Merge maintenance into devel
|
||||
uses: robotology/gh-action-nightly-merge@v1.3.2
|
||||
uses: robotology/gh-action-nightly-merge@v1.3.3
|
||||
with:
|
||||
stable_branch: "maintenance"
|
||||
development_branch: "devel"
|
||||
|
||||
@@ -47,12 +47,14 @@ repos:
|
||||
hooks:
|
||||
- id: black
|
||||
args: ["--config", "black.toml"]
|
||||
additional_dependencies:
|
||||
- click==8.0.4
|
||||
- repo: https://gitlab.com/pycqa/flake8
|
||||
rev: 3.9.2
|
||||
hooks:
|
||||
- id: flake8
|
||||
additional_dependencies:
|
||||
- flake8-bugbear
|
||||
- flake8-bugbear==22.1.11
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v2.5.1
|
||||
hooks:
|
||||
|
||||
+3
-3
@@ -29,10 +29,10 @@ improve/.* 1.8.0 3fe45661cd79c5137d9d4f5f4adb4d9519bc2084 pep440-dev
|
||||
staging/bugfix 1.7.4 59cbfadf8922d85b9df40f8d0173e8c21724c3b8 pep440-dev
|
||||
bug/.* 1.7.4 59cbfadf8922d85b9df40f8d0173e8c21724c3b8 pep440-dev
|
||||
|
||||
# staging/maintenance is currently the branch for preparation of 1.8.0rc2
|
||||
# staging/maintenance is currently the branch for preparation of 1.8.0rc6
|
||||
# so is regressionfix/...
|
||||
staging/maintenance 1.8.0rc2 fa2c4680cca0d1d6b46e6c1ed68ceea4d9b79afb pep440-dev
|
||||
regressionfix/.* 1.8.0rc2 fa2c4680cca0d1d6b46e6c1ed68ceea4d9b79afb pep440-dev
|
||||
staging/maintenance 1.8.0rc6 45598764e6c7f6257de87a98d15964209ddc9e09 pep440-dev
|
||||
regressionfix/.* 1.8.0rc6 45598764e6c7f6257de87a98d15964209ddc9e09 pep440-dev
|
||||
|
||||
# staging/devel is currently inactive (but has the 1.4.1rc4 namespace)
|
||||
staging/devel 1.4.1rc4 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev
|
||||
|
||||
@@ -164,6 +164,7 @@ date of first contribution):
|
||||
* [Shell M. Shrader](https://github.com/synman)
|
||||
* [Johan Verrept](https://github.com/JoveToo)
|
||||
* [Nicu Surdu](https://github.com/surdu)
|
||||
* [Zack Lewis](https://github.com/lima3w)
|
||||
|
||||
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
|
||||
|
||||
+8
-4
@@ -8,6 +8,7 @@ thanks to everyone who contributed!
|
||||
|
||||
* 3D-TECH
|
||||
* 3DPrinterOS
|
||||
* Al Mucci
|
||||
* Arnljot Arntsen
|
||||
* Artillery 3D
|
||||
* Ash King
|
||||
@@ -20,6 +21,7 @@ thanks to everyone who contributed!
|
||||
* Christian Wolf
|
||||
* Christian Würthner
|
||||
* Christoph Sigrist
|
||||
* Craig Parker
|
||||
* Creality3D
|
||||
* David Bounds
|
||||
* DeltaMaker 3D Printers
|
||||
@@ -34,7 +36,9 @@ thanks to everyone who contributed!
|
||||
* Hog Duske
|
||||
* Itay Shem-tov
|
||||
* James Mackay
|
||||
* Jeff Green
|
||||
* Jeff Moe
|
||||
* jeffiel
|
||||
* Jeremy Cole
|
||||
* Joshua Wills
|
||||
* Julian Melo
|
||||
@@ -45,16 +49,15 @@ thanks to everyone who contributed!
|
||||
* Kurt Wubbels
|
||||
* Kyle Menigoz
|
||||
* Lachlan Bell
|
||||
* Lee Dohm
|
||||
* Lefteris Lertas
|
||||
* LulzBot
|
||||
* Makespace Madrid
|
||||
* Mark Walker
|
||||
* Matt Van Itallie
|
||||
* Michael Aumock
|
||||
* Mike Kershaw
|
||||
* Miles Flavel
|
||||
* Mosaic Manufacturing
|
||||
* Nat Friedman
|
||||
* Norman Jaffe
|
||||
* Peopoly
|
||||
* Pete Barnwell
|
||||
@@ -66,6 +69,7 @@ thanks to everyone who contributed!
|
||||
* Richard Stocks
|
||||
* Robert Gusek
|
||||
* Ronald Griehsler
|
||||
* Sean Jensen-Grey
|
||||
* Sebastien Andrivet
|
||||
* Stefan Krister
|
||||
* Steve Dougherty
|
||||
@@ -74,7 +78,7 @@ thanks to everyone who contributed!
|
||||
* The Spaghetti Detective
|
||||
* TJ Horner
|
||||
* Trent Shumay
|
||||
* Ulderico Cirello
|
||||
* Ulrich Kempken
|
||||
* Yehuda Katz
|
||||
|
||||
and 2298 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [GitHub Sponsors](https://github.com/users/foosel/sponsorship)!
|
||||
and 2279 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel) or via [GitHub Sponsors](https://github.com/users/foosel/sponsorship)!
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
[jinja2: src/octoprint/templates/**.jinja2]
|
||||
silent=false
|
||||
extensions=jinja2.ext.autoescape, jinja2.ext.with_, webassets.ext.jinja2.AssetsExtension, jinja2.ext.do, octoprint.util.jinja.trycatch
|
||||
extensions=webassets.ext.jinja2.AssetsExtension, jinja2.ext.do, octoprint.util.jinja.trycatch
|
||||
|
||||
[jinja2: src/octoprint/plugins/**.jinja2]
|
||||
silent=false
|
||||
extensions=jinja2.ext.autoescape, jinja2.ext.with_, webassets.ext.jinja2.AssetsExtension, jinja2.ext.do, octoprint.util.jinja.trycatch
|
||||
extensions=webassets.ext.jinja2.AssetsExtension, jinja2.ext.do, octoprint.util.jinja.trycatch
|
||||
|
||||
[javascript: src/octoprint/static/js/app/**.js]
|
||||
extract_messages = gettext, ngettext
|
||||
|
||||
@@ -649,7 +649,7 @@ Permission record
|
||||
* - ``dangerous``
|
||||
- 1
|
||||
- boolean
|
||||
- Whether the permission should be considered dangerous due to a high reponsibility (true) or not (false).
|
||||
- Whether the permission should be considered dangerous due to a high responsibility (true) or not (false).
|
||||
* - ``default_groups``
|
||||
- 1
|
||||
- List of string
|
||||
|
||||
@@ -560,7 +560,7 @@ Global credentials
|
||||
|
||||
.. versionadded:: 1.5.0
|
||||
|
||||
Starting with OctoPrint 1.5.0, the Software Update Plugin supports supplyting a GitHub
|
||||
Starting with OctoPrint 1.5.0, the Software Update Plugin supports supplying a GitHub
|
||||
API token to use for the ``github_release`` and ``github_commit`` version check types,
|
||||
to work around possible rate limit problems if a lot of checks are to be made from a single
|
||||
external IP. You may create a `personal access token <https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token>`_
|
||||
|
||||
@@ -451,6 +451,11 @@ Use the following settings to enable or disable OctoPrint features:
|
||||
|
||||
# whether G90/G91 also influence absolute/relative mode of extruders
|
||||
g90InfluencesExtruder: false
|
||||
|
||||
# Replace all special characters and spaces with text equivalent to make them universally compatible.
|
||||
# Most OS filesystems work fine with unicode characters, but just in case you can revert to the
|
||||
# older behaviour by setting this to true.
|
||||
enforceReallyUniversalFilenames: false
|
||||
|
||||
.. _sec-configuration-config_yaml-folder:
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ There many configuration options via ``config.yaml`` for the virtual printer tha
|
||||
|
||||
# Enable virtual EEPROM
|
||||
# If enabled, a file `eeprom.json` will be created in the plugin data folder
|
||||
# to enable settings persistence across connections. Enables M500/1/2/4 commmands
|
||||
# to enable settings persistence across connections. Enables M500/1/2/4 commands
|
||||
# And a selection of other settings commands. Responses modeled on Marlin 2.0
|
||||
enable_eeprom: true
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ Example: Your PC has an IP address of ``192.168.23.42`` and a subnet mask of
|
||||
The easy way: Using the OctoPrint-AutoLoginConfig plugin
|
||||
........................................................
|
||||
|
||||
The easist way to configure AutoLogin is to install the
|
||||
The easiest way to configure AutoLogin is to install the
|
||||
`OctoPrint-AutoLoginConfig plugin <https://plugins.octoprint.org/plugins/autologin_config/>`_
|
||||
via the plugin manager.
|
||||
|
||||
|
||||
@@ -1938,7 +1938,7 @@ octoprint.timelapse.capture.post
|
||||
Perform specific actions after capturing a timelapse frame.
|
||||
|
||||
``filename`` will be the path of the frame that should have been saved.
|
||||
``sucesss`` indicates whether the capture was successful or not.
|
||||
``success`` indicates whether the capture was successful or not.
|
||||
|
||||
:param str filename: The path of the frame that should have been saved.
|
||||
:param boolean success: Indicates whether the capture was successful or not.
|
||||
|
||||
@@ -336,7 +336,7 @@ As a summary, follow this checklist to migrate your plugin to be compatible to b
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
* Thorougly test your plugin under Python 3. Pay special attention to any kind of string handling issues, integer
|
||||
* Thoroughly test your plugin under Python 3. Pay special attention to any kind of string handling issues, integer
|
||||
division, relative imports from your plugin package and how the results of ``map``, ``filter`` and ``zip`` are
|
||||
used in your code, as those have proven to be the biggest issues during past migrations.
|
||||
* Once everything works under both Python versions and you've prepared a new release of your plugin (don't forget to
|
||||
|
||||
@@ -31,7 +31,7 @@ SETUP_REQUIRES = []
|
||||
bundled_plugins = [
|
||||
"OctoPrint-FileCheck>=2021.2.23",
|
||||
"OctoPrint-FirmwareCheck>=2021.10.11",
|
||||
"OctoPrint-PiSupport>=2022.3.1",
|
||||
"OctoPrint-PiSupport>=2022.3.28",
|
||||
]
|
||||
core_deps = [
|
||||
"cachelib>=0.2,<0.3",
|
||||
@@ -62,6 +62,7 @@ core_deps = [
|
||||
"tornado>=6.0.4,<7",
|
||||
"watchdog>=1,<2",
|
||||
"websocket-client>=1.2.1,<2",
|
||||
"werkzeug>=2.0,<2.1", # breaking changes can happen on minor version increases, flask-login 0.5 is incompatible with 2.1
|
||||
"wrapt>=1.13.3,<1.14",
|
||||
"zeroconf>=0.33,<0.34", # breaking changes can happen on minor version increases
|
||||
"zipstream-ng>=1.3.4,<2.0.0",
|
||||
|
||||
@@ -18,10 +18,10 @@ from octoprint.util.version import (
|
||||
)
|
||||
|
||||
SENTRY_URL_SERVER = (
|
||||
"https://a12e10f3ca4b418dba3ed99c1d220d14@o118517.ingest.sentry.io/1373987"
|
||||
"https://0d173c8b74b945e1bdc73443e543ddee@o118517.ingest.sentry.io/1373987"
|
||||
)
|
||||
SENTRY_URL_COREUI = (
|
||||
"https://988f6e4854ee49188df51642ab576346@o118517.ingest.sentry.io/1374096"
|
||||
"https://f38a3d0ad2694f7f8672b1a2485c3820@o118517.ingest.sentry.io/1374096"
|
||||
)
|
||||
|
||||
SETTINGS_DEFAULTS = {
|
||||
|
||||
@@ -709,12 +709,17 @@ var doParse = function () {
|
||||
}
|
||||
|
||||
if (sendMultiLayer.indexOf(sendLayer) === -1) {
|
||||
sendMultiLayer[sendMultiLayer.length] = sendLayer;
|
||||
sendMultiLayer.push(sendLayer);
|
||||
}
|
||||
|
||||
sendLayer = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
// we are done, send the final layer
|
||||
if (sendMultiLayer.indexOf(activeLayer) === -1) {
|
||||
sendMultiLayer.push(activeLayer);
|
||||
}
|
||||
sendLayersToParent(sendMultiLayer, 100);
|
||||
};
|
||||
|
||||
|
||||
@@ -1352,6 +1352,7 @@ class Server:
|
||||
|
||||
app.config["TEMPLATES_AUTO_RELOAD"] = True
|
||||
app.config["JSONIFY_PRETTYPRINT_REGULAR"] = False
|
||||
app.config["REMEMBER_COOKIE_HTTPONLY"] = True
|
||||
|
||||
# we must not set this before TEMPLATES_AUTO_RELOAD is set to True or that won't take
|
||||
app.debug = self._debug
|
||||
@@ -1944,6 +1945,8 @@ class Server:
|
||||
global assets
|
||||
global pluginManager
|
||||
|
||||
from octoprint.server.util.webassets import MemoryManifest # noqa: F401
|
||||
|
||||
util.flask.fix_webassets_filtertool()
|
||||
|
||||
base_folder = self._settings.getBaseFolder("generated")
|
||||
@@ -1955,7 +1958,8 @@ class Server:
|
||||
|
||||
for entry, recreate in (
|
||||
("webassets", True),
|
||||
(".webassets-cache", False), # no longer used, but clean up just in case
|
||||
# no longer used, but clean up just in case
|
||||
(".webassets-cache", False),
|
||||
(".webassets-manifest.json", False),
|
||||
):
|
||||
path = os.path.join(base_folder, entry)
|
||||
@@ -2042,7 +2046,7 @@ class Server:
|
||||
# few seconds for regeneration in development, if it means we can get rid of
|
||||
# a whole monkey patch and in internal use of pickle with non-tamperproof files
|
||||
assets.cache = False
|
||||
assets.manifest = "json:.webassets-manifest.json"
|
||||
assets.manifest = "memory"
|
||||
|
||||
UpdaterType = type(util.flask.SettingsCheckUpdater)(
|
||||
util.flask.SettingsCheckUpdater.__name__,
|
||||
|
||||
@@ -490,6 +490,7 @@ def _saveSettings(data):
|
||||
|
||||
s.setBaseFolder(folder, future[folder])
|
||||
except Exception:
|
||||
logger.exception("Something went wrong while saving a folder path")
|
||||
abort(400, description="At least one of the configured folders is invalid")
|
||||
|
||||
if "api" in data:
|
||||
|
||||
@@ -6,6 +6,7 @@ import gzip
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import threading
|
||||
from urllib import parse as urlparse
|
||||
|
||||
import webassets.filter.cssrewrite.urlpath as urlpath
|
||||
@@ -14,6 +15,7 @@ from webassets.filter import Filter
|
||||
from webassets.filter.cssrewrite.base import PatternRewriter
|
||||
from webassets.filter.rjsmin import rjsmin
|
||||
from webassets.merge import BaseHunk, MemoryHunk
|
||||
from webassets.version import Manifest
|
||||
|
||||
|
||||
def replace_url(source_url, output_url, url):
|
||||
@@ -207,3 +209,19 @@ class JsPluginBundle(Bundle):
|
||||
(hunk, lambda x: x.replace("\n", "\n ")),
|
||||
MemoryHunk(_PLUGIN_BUNDLE_WRAPPER_SUFFIX.format(plugin=self.plugin)),
|
||||
)
|
||||
|
||||
|
||||
class MemoryManifest(Manifest):
|
||||
id = "memory"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.manifest = {}
|
||||
self._lock = threading.RLock()
|
||||
|
||||
def remember(self, bundle, ctx, version):
|
||||
with self._lock:
|
||||
self.manifest[bundle.output] = version
|
||||
|
||||
def query(self, bundle, ctx):
|
||||
with self._lock:
|
||||
return self.manifest.get(bundle.output, None)
|
||||
@@ -8,6 +8,7 @@ import logging
|
||||
import os
|
||||
import re
|
||||
from collections import defaultdict
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from flask import (
|
||||
Response,
|
||||
@@ -170,7 +171,16 @@ def _add_additional_assets(hook):
|
||||
def login():
|
||||
from flask_login import current_user
|
||||
|
||||
redirect_url = request.args.get("redirect", request.script_root + url_for("index"))
|
||||
default_redirect_url = request.script_root + url_for("index")
|
||||
redirect_url = request.args.get("redirect", default_redirect_url)
|
||||
|
||||
parsed = urlparse(redirect_url) # check if redirect url is valid
|
||||
if parsed.scheme != "" or parsed.netloc != "":
|
||||
_logger.warning(
|
||||
f"Got an invalid redirect URL with the login attempt, misconfiguration or attack attempt: {redirect_url}"
|
||||
)
|
||||
redirect_url = default_redirect_url
|
||||
|
||||
permissions = sorted(
|
||||
filter(
|
||||
lambda x: x is not None and isinstance(x, OctoPrintPermission),
|
||||
|
||||
+56
-29
@@ -34,6 +34,7 @@ from yaml import YAMLError
|
||||
from octoprint.util import (
|
||||
CaseInsensitiveSet,
|
||||
atomic_write,
|
||||
deprecated,
|
||||
dict_merge,
|
||||
fast_deepcopy,
|
||||
generate_api_key,
|
||||
@@ -577,16 +578,30 @@ class HierarchicalChainMap:
|
||||
if d is None:
|
||||
return {}
|
||||
|
||||
result = dict()
|
||||
result = {}
|
||||
for key, value in d.items():
|
||||
if not key.startswith(prefix):
|
||||
continue
|
||||
subkeys = key[len(prefix) :].split(_CHAINMAP_SEP)
|
||||
current = result
|
||||
|
||||
path = []
|
||||
for subkey in subkeys[:-1]:
|
||||
if subkey not in current or current[subkey] is None:
|
||||
# we only need that for logging in case of data weirdness below
|
||||
path.append(subkey)
|
||||
|
||||
# make sure the subkey is in the current dict, and that it is a dict
|
||||
if subkey not in current:
|
||||
current[subkey] = {}
|
||||
elif not isinstance(current[subkey], dict):
|
||||
logging.getLogger(__name__).warning(
|
||||
f"There is a non-dict value on the path to {key} at {path!r}, ignoring."
|
||||
)
|
||||
current[subkey] = {}
|
||||
|
||||
# go down a level
|
||||
current = current[subkey]
|
||||
|
||||
current[subkeys[-1]] = value
|
||||
|
||||
return result
|
||||
@@ -848,7 +863,6 @@ class Settings:
|
||||
self._map = HierarchicalChainMap({}, default_settings)
|
||||
self.load_overlays(overlays)
|
||||
|
||||
self._config = None
|
||||
self._dirty = False
|
||||
self._dirty_time = 0
|
||||
self._last_config_hash = None
|
||||
@@ -1111,7 +1125,7 @@ class Settings:
|
||||
|
||||
@property
|
||||
def config_yaml(self):
|
||||
return yaml.dump(self._config)
|
||||
return yaml.dump(self.config)
|
||||
|
||||
@property
|
||||
def config_hash(self):
|
||||
@@ -1126,10 +1140,28 @@ class Settings:
|
||||
return self._last_config_hash
|
||||
|
||||
@property
|
||||
def _config(self):
|
||||
def config(self):
|
||||
"""
|
||||
A view of the local config as stored in config.yaml
|
||||
|
||||
Does not support modifications, they will be thrown away silently. If you need to
|
||||
modify anything in the settings, utilize the provided set and remove methods.
|
||||
"""
|
||||
return self._map.top_map
|
||||
|
||||
@property
|
||||
@deprecated(
|
||||
"Settings._config has been deprecated and is a read-only view. Please use Settings.config or the set & remove methods instead.",
|
||||
since="1.8.0",
|
||||
)
|
||||
def _config(self):
|
||||
return self.config
|
||||
|
||||
@_config.setter
|
||||
@deprecated(
|
||||
"Setting of Settings._config has been deprecated. Please use the set & remove methods instead and get in touch if you have a usecase they don't cover.",
|
||||
since="1.8.0",
|
||||
)
|
||||
def _config(self, value):
|
||||
self._map.top_map = value
|
||||
|
||||
@@ -1160,11 +1192,14 @@ class Settings:
|
||||
# ~~ load and save
|
||||
|
||||
def load(self, migrate=False):
|
||||
config = None
|
||||
mtime = None
|
||||
|
||||
if os.path.exists(self._configfile) and os.path.isfile(self._configfile):
|
||||
with open(self._configfile, encoding="utf-8", errors="replace") as f:
|
||||
try:
|
||||
self._config = yaml.load_from_file(file=f)
|
||||
self._mtime = self.last_modified
|
||||
config = yaml.load_from_file(file=f)
|
||||
mtime = self.last_modified
|
||||
|
||||
except YAMLError as e:
|
||||
details = str(e)
|
||||
@@ -1184,8 +1219,11 @@ class Settings:
|
||||
)
|
||||
|
||||
# changed from else to handle cases where the file exists, but is empty / 0 bytes
|
||||
if not self._config or not isinstance(self._config, dict):
|
||||
self._config = {}
|
||||
if not config or not isinstance(config, dict):
|
||||
config = {}
|
||||
|
||||
self._map.top_map = config
|
||||
self._mtime = mtime
|
||||
|
||||
if migrate:
|
||||
self._migrate_config()
|
||||
@@ -1279,7 +1317,7 @@ class Settings:
|
||||
|
||||
def _migrate_config(self, config=None, persist=False):
|
||||
if config is None:
|
||||
config = self._config
|
||||
config = self._map.top_map
|
||||
persist = True
|
||||
|
||||
dirty = False
|
||||
@@ -1301,6 +1339,9 @@ class Settings:
|
||||
dirty = migrate(config) or dirty
|
||||
|
||||
if dirty and persist:
|
||||
self._map.top_map = (
|
||||
config # we need to write it back here or the changes will be lost
|
||||
)
|
||||
self.save(force=True)
|
||||
|
||||
def _migrate_gcode_scripts(self, config):
|
||||
@@ -1819,7 +1860,7 @@ class Settings:
|
||||
permissions=0o600,
|
||||
max_permissions=0o666,
|
||||
) as configFile:
|
||||
yaml.save_to_file(self._config, file=configFile)
|
||||
yaml.save_to_file(self._map.top_map, file=configFile)
|
||||
self._dirty = False
|
||||
except Exception:
|
||||
self._logger.exception("Error while saving config.yaml!")
|
||||
@@ -2058,10 +2099,7 @@ class Settings:
|
||||
folder = default_folder
|
||||
|
||||
try:
|
||||
del self._config["folder"][type]
|
||||
if not len(self._config["folder"]):
|
||||
del self._config["folder"]
|
||||
self._mark_dirty()
|
||||
self.remove(["folder", type])
|
||||
self.save()
|
||||
except KeyError:
|
||||
pass
|
||||
@@ -2256,23 +2294,12 @@ class Settings:
|
||||
|
||||
currentPath = self.getBaseFolder(type)
|
||||
defaultPath = self._get_default_folder(type)
|
||||
if (
|
||||
(path is None or path == defaultPath)
|
||||
and "folder" in self._config
|
||||
and type in self._config["folder"]
|
||||
):
|
||||
del self._config["folder"][type]
|
||||
if not self._config["folder"]:
|
||||
del self._config["folder"]
|
||||
self._mark_dirty()
|
||||
if path is None or path == defaultPath:
|
||||
self.remove(["folder", type])
|
||||
elif (path != currentPath and path != defaultPath) or force:
|
||||
if validate:
|
||||
_validate_folder(path, check_writable=True, deep_check_writable=True)
|
||||
|
||||
if "folder" not in self._config:
|
||||
self._config["folder"] = {}
|
||||
self._config["folder"][type] = path
|
||||
self._mark_dirty()
|
||||
self.set(["folder", type], path, force=force)
|
||||
|
||||
def saveScript(self, script_type, name, script):
|
||||
script_folder = self.getBaseFolder("scripts")
|
||||
|
||||
@@ -1542,41 +1542,75 @@ var copyToClipboard = function (text) {
|
||||
temp.remove();
|
||||
};
|
||||
|
||||
var determineWebcamStreamType = function (streamUrl) {
|
||||
if (streamUrl) {
|
||||
if (streamUrl.startsWith("webrtc")) {
|
||||
return "webrtc";
|
||||
}
|
||||
var getExternalHostUrl = function () {
|
||||
var loc = window.location;
|
||||
var port = "";
|
||||
if (
|
||||
(loc.protocol === "http:" && loc.port !== "80") ||
|
||||
(loc.protocol === "https:" && loc.port !== "443")
|
||||
) {
|
||||
port = ":" + loc.port;
|
||||
}
|
||||
return loc.protocol + "//" + loc.hostname + port;
|
||||
};
|
||||
|
||||
var lastDotPosition = streamUrl.lastIndexOf(".");
|
||||
var firstQuotationSignPosition = streamUrl.indexOf("?");
|
||||
if (
|
||||
lastDotPosition != -1 &&
|
||||
firstQuotationSignPosition != -1 &&
|
||||
lastDotPosition >= firstQuotationSignPosition
|
||||
) {
|
||||
throw "Malformed URL. Cannot determine stream type.";
|
||||
}
|
||||
var validateWebcamUrl = function (streamUrl) {
|
||||
if (!streamUrl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we have found a dot, try to extract the extension.
|
||||
if (lastDotPosition > -1) {
|
||||
if (firstQuotationSignPosition > -1) {
|
||||
var extension = streamUrl.slice(
|
||||
lastDotPosition + 1,
|
||||
firstQuotationSignPosition - 1
|
||||
);
|
||||
} else {
|
||||
var extension = streamUrl.slice(lastDotPosition + 1);
|
||||
}
|
||||
if (extension.toLowerCase() == "m3u8") {
|
||||
return "hls";
|
||||
}
|
||||
}
|
||||
// By default, 'mjpg' is the stream type.
|
||||
return "mjpg";
|
||||
var lower = streamUrl.toLowerCase();
|
||||
var toParse = streamUrl;
|
||||
|
||||
if (lower.startsWith("//")) {
|
||||
// protocol relative
|
||||
toParse = window.location.protocol + streamUrl;
|
||||
} else if (lower.startsWith("/")) {
|
||||
// host relative
|
||||
toParse = getExternalHostUrl() + streamUrl;
|
||||
} else if (
|
||||
lower.startsWith("http:") ||
|
||||
lower.startsWith("https:") ||
|
||||
lower.startsWith("webrtc:") ||
|
||||
lower.startsWith("webrtcs:")
|
||||
) {
|
||||
// absolute & supported protocol
|
||||
toParse = streamUrl;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
return new URL(toParse);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
var determineWebcamStreamType = function (streamUrl) {
|
||||
if (!streamUrl) {
|
||||
throw "Empty streamUrl. Cannot determine stream type.";
|
||||
}
|
||||
|
||||
var parsed = validateWebcamUrl(streamUrl);
|
||||
if (!parsed) {
|
||||
throw "Invalid streamUrl. Cannot determine stream type.";
|
||||
}
|
||||
|
||||
if (parsed.protocol === "webrtc:" || parsed.protocol === "webrtcs:") {
|
||||
return "webrtc";
|
||||
}
|
||||
|
||||
var lastDotPosition = parsed.pathname.lastIndexOf(".");
|
||||
if (lastDotPosition !== -1) {
|
||||
var extension = parsed.pathname.substring(lastDotPosition + 1);
|
||||
if (extension.toLowerCase() === "m3u8") {
|
||||
return "hls";
|
||||
}
|
||||
}
|
||||
|
||||
// By default, 'mjpg' is the stream type.
|
||||
return "mjpg";
|
||||
};
|
||||
|
||||
var saveToLocalStorage = function (key, data) {
|
||||
|
||||
@@ -40,7 +40,8 @@ $(function () {
|
||||
self.isLoading = ko.observable(undefined);
|
||||
|
||||
self.enableConnect = ko.pureComputed(function () {
|
||||
return self.enablePort() || !self.isErrorOrClosed();
|
||||
//return self.enablePort() || !self.isErrorOrClosed();
|
||||
return true; // enable always for now, until we have an auto refresh in 1.9.0
|
||||
});
|
||||
|
||||
self.buttonText = ko.pureComputed(function () {
|
||||
|
||||
@@ -573,7 +573,7 @@ $(function () {
|
||||
}
|
||||
|
||||
// Determine stream type and switch to corresponding webcam.
|
||||
var streamType = determineWebcamStreamType(self.settings.webcam_streamUrl());
|
||||
var streamType = self.settings.webcam_streamType();
|
||||
if (streamType == "mjpg") {
|
||||
self._switchToMjpgWebcam();
|
||||
} else if (streamType == "hls") {
|
||||
@@ -760,7 +760,7 @@ $(function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var newSrc = self.settings.webcam_streamUrl();
|
||||
var newSrc = self.settings.webcam_streamUrlEscaped();
|
||||
if (currentSrc != newSrc) {
|
||||
if (self.settings.webcam_cacheBuster()) {
|
||||
if (newSrc.lastIndexOf("?") > -1) {
|
||||
@@ -797,10 +797,10 @@ $(function () {
|
||||
typeof video.canPlayType != undefined &&
|
||||
video.canPlayType("application/vnd.apple.mpegurl") == "probably"
|
||||
) {
|
||||
video.src = self.settings.webcam_streamUrl();
|
||||
video.src = self.settings.webcam_streamUrlEscaped();
|
||||
} else if (Hls.isSupported()) {
|
||||
self.hls = new Hls();
|
||||
self.hls.loadSource(self.settings.webcam_streamUrl());
|
||||
self.hls.loadSource(self.settings.webcam_streamUrlEscaped());
|
||||
self.hls.attachMedia(video);
|
||||
}
|
||||
|
||||
@@ -836,7 +836,7 @@ $(function () {
|
||||
if (self.webRTCPeerConnection == null) {
|
||||
self.webRTCPeerConnection = startWebRTC(
|
||||
video,
|
||||
self.settings.webcam_streamUrl(),
|
||||
self.settings.webcam_streamUrlEscaped(),
|
||||
self.settings.webcam_streamWebrtcIceServers()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -312,13 +312,20 @@ $(function () {
|
||||
self.webcam_ffmpegPathOk(false);
|
||||
self.webcam_ffmpegPathBroken(false);
|
||||
};
|
||||
self.webcam_streamUrlEscaped = ko.pureComputed(function () {
|
||||
return encodeURI(self.webcam_streamUrl());
|
||||
});
|
||||
self.webcam_streamType = ko.pureComputed(function () {
|
||||
try {
|
||||
return determineWebcamStreamType(self.webcam_streamUrl());
|
||||
return determineWebcamStreamType(self.webcam_streamUrlEscaped());
|
||||
} catch (e) {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
self.webcam_streamValid = ko.pureComputed(function () {
|
||||
var url = self.webcam_streamUrlEscaped();
|
||||
return !url || validateWebcamUrl(url);
|
||||
});
|
||||
|
||||
self.server_onlineCheckText = ko.observable();
|
||||
self.server_onlineCheckOk = ko.observable(false);
|
||||
@@ -439,7 +446,8 @@ $(function () {
|
||||
|
||||
self.testWebcamStreamUrlBusy = ko.observable(false);
|
||||
self.testWebcamStreamUrl = function () {
|
||||
if (!self.webcam_streamUrl()) {
|
||||
var url = self.webcam_streamUrlEscaped();
|
||||
if (!url) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -450,24 +458,31 @@ $(function () {
|
||||
var text = gettext(
|
||||
"If you see your webcam stream below, the entered stream URL is ok."
|
||||
);
|
||||
var streamType = self.webcam_streamType();
|
||||
|
||||
var streamType;
|
||||
try {
|
||||
streamType = self.webcam_streamType();
|
||||
} catch (e) {
|
||||
streamType = "";
|
||||
}
|
||||
|
||||
var webcam_element;
|
||||
var webrtc_peer_connection;
|
||||
if (streamType == "mjpg") {
|
||||
webcam_element = $('<img src="' + self.webcam_streamUrl() + '">');
|
||||
} else if (streamType == "hls") {
|
||||
if (streamType === "mjpg") {
|
||||
webcam_element = $('<img src="' + url + '">');
|
||||
} else if (streamType === "hls") {
|
||||
webcam_element = $(
|
||||
'<video id="webcam_hls" muted autoplay style="width: 100%"/>'
|
||||
);
|
||||
video_element = webcam_element[0];
|
||||
if (video_element.canPlayType("application/vnd.apple.mpegurl")) {
|
||||
video_element.src = self.webcam_streamUrl();
|
||||
video_element.src = url;
|
||||
} else if (Hls.isSupported()) {
|
||||
var hls = new Hls();
|
||||
hls.loadSource(self.webcam_streamUrl());
|
||||
hls.loadSource(url);
|
||||
hls.attachMedia(video_element);
|
||||
}
|
||||
} else if (isWebRTCAvailable() && streamType == "webrtc") {
|
||||
} else if (isWebRTCAvailable() && streamType === "webrtc") {
|
||||
webcam_element = $(
|
||||
'<video id="webcam_webrtc" muted autoplay playsinline controls style="width: 100%"/>'
|
||||
);
|
||||
@@ -475,7 +490,7 @@ $(function () {
|
||||
|
||||
webrtc_peer_connection = startWebRTC(
|
||||
video_element,
|
||||
self.webcam_streamUrl(),
|
||||
url,
|
||||
self.webcam_streamWebrtcIceServers()
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -69,12 +69,12 @@
|
||||
<div id="login-offline" class="alert alert-error">{{ _('Server is currently offline.') }} <a id="login-reconnect" href="javascript:void(0)">{{ _('Reconnect...') }}</a></div>
|
||||
|
||||
{% if user_id %}<p>
|
||||
{{ _('The following account is required:') }} {{ user_id }}
|
||||
{{ _('The following account is required:') }} {{ user_id|e }}
|
||||
</p>{% elif logged_in %}<p>
|
||||
{{ _('An account with the following permissions is required:') }} {{ permission_names|join(", ") }}
|
||||
</p>{% endif %}
|
||||
|
||||
<input type="text" id="login-user" data-test-id="login-username" class="input-block-level" placeholder="{{ _('Username')|edq }}" {% if user_id %}value="{{ user_id }}" disabled{% endif %} autofocus autocapitalize="none">
|
||||
<input type="text" id="login-user" data-test-id="login-username" class="input-block-level" placeholder="{{ _('Username')|edq }}" {% if user_id %}value="{{ user_id|edq }}" disabled{% endif %} autofocus autocapitalize="none">
|
||||
<input type="password" id="login-password" data-test-id="login-password" class="input-block-level" placeholder="{{ _('Password')|edq }}">
|
||||
<span class="pull-right"><small><a href="https://faq.octoprint.org/forgotten-password" id="login-forgotpassword" target="_blank" tabindex="-1">{{ _('Forgot password?') }}</a></small></span>
|
||||
<label class="checkbox">
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<div class="control-group" title="{{ _('URL to embed into the UI for live viewing of the webcam stream')|edq }}">
|
||||
<div class="control-group" title="{{ _('URL to embed into the UI for live viewing of the webcam stream')|edq }}" data-bind="css: { error: !webcam_streamValid() }">
|
||||
<label class="control-label" for="settings-webcamStreamUrl">{{ _('Stream URL') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="text" class="input-block-level" data-bind="value: webcam_streamUrl, valueUpdate: 'afterkeydown'" id="settings-webcamStreamUrl">
|
||||
<button class="btn" type="button" data-bind="click: testWebcamStreamUrl, enable: webcam_streamUrl() && !testWebcamStreamUrlBusy(), css: {disabled: !webcam_streamUrl() || testWebcamStreamUrlBusy()}"><i class="fas fa-spinner fa-spin" data-bind="visible: testWebcamStreamUrlBusy"></i> {{ _('Test') }}</button>
|
||||
<button class="btn" type="button" data-bind="click: testWebcamStreamUrl, enable: !testWebcamStreamUrlBusy() && webcam_streamValid(), css: {disabled: testWebcamStreamUrlBusy() || !webcam_streamValid()}"><i class="fas fa-spinner fa-spin" data-bind="visible: testWebcamStreamUrlBusy"></i> {{ _('Test') }}</button>
|
||||
</div>
|
||||
<span class="help-block">
|
||||
<p>{% trans %}Needs to be reachable from the browser displaying the OctoPrint UI, used to embed the webcam stream into the page.{% endtrans %}</p>
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large.
Load diff
@@ -6268,6 +6268,10 @@ def parse_temperature_line(line, current):
|
||||
for match in re.finditer(regex_temp, line):
|
||||
values = match.groupdict()
|
||||
sensor = values["sensor"]
|
||||
if sensor in result:
|
||||
# sensor already seen, let's not overwrite stuff
|
||||
continue
|
||||
|
||||
toolnum = values.get("toolnum", None)
|
||||
tool_number = int(toolnum) if toolnum is not None and len(toolnum) else None
|
||||
if tool_number and tool_number > max_tool_num:
|
||||
|
||||
@@ -791,6 +791,10 @@ class ChainmapTest(unittest.TestCase):
|
||||
{_key("a"): None, _key("a", "b"): "b"},
|
||||
{"a": {"b": "b"}},
|
||||
),
|
||||
(
|
||||
{_key("a"): "", _key("a", "b"): "b"},
|
||||
{"a": {"b": "b"}},
|
||||
),
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_unflatten(self, value, expected):
|
||||
|
||||
@@ -330,6 +330,16 @@ class TestCommHelpers(unittest.TestCase):
|
||||
},
|
||||
0,
|
||||
),
|
||||
(
|
||||
# Only first occurrence of a sensor should be used, second B gets ignored
|
||||
"T:210.04 /210.00 B:52.00 /52.00 @:85 B:1234.0 /1234.0",
|
||||
0,
|
||||
{
|
||||
"T0": (210.04, 210.0),
|
||||
"B": (52.00, 52.0),
|
||||
},
|
||||
0,
|
||||
),
|
||||
)
|
||||
@unpack
|
||||
def test_process_temperature_line(self, line, current, expected_result, expected_max):
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large.
Load diff
+541
-541
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user