Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed798e4c6f | ||
|
|
fe73d0d93c | ||
|
|
bb519ae88b | ||
|
|
4cc41b05ea | ||
|
|
65f53f3d86 | ||
|
|
658c5578e2 | ||
|
|
ba54bd3006 | ||
|
|
0ce7930653 | ||
|
|
f5e90a1aa4 |
No files matched your search
@@ -201,11 +201,17 @@ class ScanDepsCommand(setuptools.Command):
|
||||
)
|
||||
resp.raise_for_status()
|
||||
|
||||
def safe_parse_version(version):
|
||||
try:
|
||||
return parse_version(version)
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
data = resp.json()
|
||||
versions = list(
|
||||
filter(
|
||||
lambda x: not x.is_prerelease and not x.is_devrelease,
|
||||
map(lambda x: parse_version(x), data.get("versions", [])),
|
||||
lambda x: x and not x.is_prerelease and not x.is_devrelease,
|
||||
map(lambda x: safe_parse_version(x), data.get("versions", [])),
|
||||
)
|
||||
)
|
||||
if not versions:
|
||||
|
||||
@@ -218,6 +218,8 @@ class AppKeysPlugin(
|
||||
@octoprint.plugin.BlueprintPlugin.route("/auth/<app_token>", methods=["GET"])
|
||||
@no_firstrun_access
|
||||
def handle_auth_dialog(self, app_token):
|
||||
from octoprint.server.util.csrf import add_csrf_cookie
|
||||
|
||||
user_id = current_user.get_name()
|
||||
required_user = flask.request.args.get("user", None)
|
||||
|
||||
@@ -256,7 +258,7 @@ class AppKeysPlugin(
|
||||
).replace("%(app)s", app_id),
|
||||
)
|
||||
)
|
||||
return add_non_caching_response_headers(response)
|
||||
return add_csrf_cookie(add_non_caching_response_headers(response))
|
||||
|
||||
@octoprint.plugin.BlueprintPlugin.route("/decision/<user_token>", methods=["POST"])
|
||||
@restricted_access
|
||||
|
||||
@@ -117,18 +117,11 @@ $(function () {
|
||||
};
|
||||
|
||||
self._enableWebcam = function () {
|
||||
if (
|
||||
OctoPrint.coreui.selectedTab != "#control" ||
|
||||
!OctoPrint.coreui.browserTabVisible
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.webcamDisableTimeout != undefined) {
|
||||
clearTimeout(self.webcamDisableTimeout);
|
||||
}
|
||||
|
||||
// IF disabled then we dont need to do anything
|
||||
// If disabled then we dont need to do anything
|
||||
if (self.settings.webcamEnabled() == false) {
|
||||
console.log("Webcam not enabled");
|
||||
return;
|
||||
@@ -156,7 +149,7 @@ $(function () {
|
||||
};
|
||||
|
||||
self.onWebcamErrored = function () {
|
||||
log.debug("Webcam stream failed to load/disabled");
|
||||
log.debug("Webcam stream failed to load/was unloaded");
|
||||
self.webcamLoaded(false);
|
||||
self.webcamError(true);
|
||||
};
|
||||
|
||||
@@ -18,10 +18,10 @@ from octoprint.util.version import (
|
||||
)
|
||||
|
||||
SENTRY_URL_SERVER = (
|
||||
"https://11f9235bf2ac4f5d97f7e8bcb5be3783@o118517.ingest.sentry.io/1373987"
|
||||
"https://cb1ee590a2f34baca47dd207d7f294d5@o118517.ingest.sentry.io/1373987"
|
||||
)
|
||||
SENTRY_URL_COREUI = (
|
||||
"https://22fe071cb60c4dfcb8245a3712739f6e@o118517.ingest.sentry.io/1374096"
|
||||
"https://a32c80a4a282468d8d41fc2accb77088@o118517.ingest.sentry.io/1374096"
|
||||
)
|
||||
|
||||
SETTINGS_DEFAULTS = {
|
||||
|
||||
@@ -1420,8 +1420,9 @@ class Server:
|
||||
except octoprint.access.users.UnknownUser:
|
||||
pass
|
||||
|
||||
elif (
|
||||
default_language is not None
|
||||
if (
|
||||
not l10n
|
||||
and default_language is not None
|
||||
and not default_language == "_default"
|
||||
and default_language in LANGUAGES
|
||||
):
|
||||
@@ -1430,14 +1431,14 @@ class Server:
|
||||
|
||||
if l10n:
|
||||
# canonicalize and get rid of invalid language codes
|
||||
l10n_canoicalized = []
|
||||
l10n_canonicalized = []
|
||||
for x in l10n:
|
||||
try:
|
||||
l10n_canoicalized.append(str(Locale.parse(x)))
|
||||
l10n_canonicalized.append(str(Locale.parse(x)))
|
||||
except Exception:
|
||||
# invalid language code, ignore
|
||||
continue
|
||||
return Locale.negotiate(l10n_canoicalized, LANGUAGES)
|
||||
return Locale.negotiate(l10n_canonicalized, LANGUAGES)
|
||||
|
||||
# request: preference
|
||||
return Locale.parse(request.accept_languages.best_match(LANGUAGES, default="en"))
|
||||
|
||||
@@ -20,6 +20,7 @@ from flask import (
|
||||
send_from_directory,
|
||||
url_for,
|
||||
)
|
||||
from werkzeug.routing import BuildError
|
||||
|
||||
import octoprint.plugin
|
||||
from octoprint.access.permissions import OctoPrintPermission, Permissions
|
||||
@@ -195,8 +196,14 @@ def login():
|
||||
allowed_paths = [
|
||||
url_for("index"),
|
||||
url_for("recovery"),
|
||||
url_for("plugin.appkeys.handle_auth_dialog", app_token="*"),
|
||||
] + configured_allowed_paths
|
||||
]
|
||||
try:
|
||||
allowed_paths += [
|
||||
url_for("plugin.appkeys.handle_auth_dialog", app_token="*"),
|
||||
]
|
||||
except BuildError:
|
||||
pass # no appkeys plugin enabled, see #4763
|
||||
allowed_paths += configured_allowed_paths
|
||||
|
||||
if not validate_local_redirect(redirect_url, allowed_paths):
|
||||
_logger.warning(
|
||||
|
||||
@@ -37,6 +37,7 @@ $(function () {
|
||||
|
||||
self.controlsFromServer = [];
|
||||
self.additionalControls = [];
|
||||
self.intersectionObservers = [];
|
||||
|
||||
self.keycontrolActive = ko.observable(false);
|
||||
self.keycontrolHelpActive = ko.observable(false);
|
||||
@@ -74,18 +75,27 @@ $(function () {
|
||||
}
|
||||
};
|
||||
|
||||
self.onAfterBinding = function () {
|
||||
self.onStartupComplete = function () {
|
||||
self.recreateIntersectionObservers();
|
||||
};
|
||||
|
||||
self.recreateIntersectionObservers = function () {
|
||||
// We are using the IntersectionObserver API to determine whether a webcam is visible or not.
|
||||
// A webcam will not intersect with the control tab if the control tab is invisible because another tab
|
||||
// is selected or if the webcam isn't shown because another webcam is active.
|
||||
//
|
||||
// Whenever the webacam changes visibility we will call onWebcamVisbilityChange() which the webcam's
|
||||
// VM can use to start or stop the stream.
|
||||
self.intersectionObservers.forEach(function (observer) {
|
||||
observer.disconnect();
|
||||
});
|
||||
self.intersectionObservers = [];
|
||||
|
||||
document
|
||||
.querySelectorAll("#webcam-group .tab-pane")
|
||||
.forEach(function (target) {
|
||||
var options = {
|
||||
root: document.querySelector("#control"),
|
||||
root: document.querySelector("#webcam_plugins_container"),
|
||||
rootMargin: "0px",
|
||||
threshold: 1.0
|
||||
};
|
||||
@@ -103,6 +113,7 @@ $(function () {
|
||||
|
||||
var observer = new IntersectionObserver(callback, options);
|
||||
observer.observe(target);
|
||||
self.intersectionObservers.push(observer);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ $(function () {
|
||||
}
|
||||
}
|
||||
if (checks.lt !== undefined) {
|
||||
if (!(value < checks.gt)) {
|
||||
if (!(value < checks.lt)) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,12 +466,15 @@ $(function () {
|
||||
if (mark.label) {
|
||||
markLabel = gettext(mark.label);
|
||||
}
|
||||
if (o.left > yAxisLabelWidth) {
|
||||
var label = $("<div></div>");
|
||||
label.html(markLabel);
|
||||
label.addClass("temperature-mark-label");
|
||||
label.addClass("temperature-mark-type-" + mark.type);
|
||||
|
||||
// we create the label even if we don't show it so that we can query its
|
||||
// background color (see #4761)
|
||||
var label = $("<div></div>");
|
||||
label.html(markLabel);
|
||||
label.addClass("temperature-mark-label");
|
||||
label.addClass("temperature-mark-type-" + mark.type);
|
||||
|
||||
if (o.left > yAxisLabelWidth) {
|
||||
graph.append(label);
|
||||
|
||||
// draw markings label on the left if doesn't fit on the right
|
||||
|
||||
Reference in new issue
Block a user