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
@@ -12,15 +12,13 @@ import octoprint.plugin.core
|
||||
|
||||
from octoprint.settings import valid_boolean_trues
|
||||
from octoprint.server.util.flask import restricted_access, with_revalidation_checking, check_etag
|
||||
from octoprint.server import VERSION
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.util.pip import LocalPipCaller, UnknownPip
|
||||
from octoprint.util.pip import LocalPipCaller
|
||||
from octoprint.util.version import get_octoprint_version_string, get_octoprint_version, is_octoprint_compatible
|
||||
from octoprint.util.platform import get_os
|
||||
|
||||
from flask import jsonify, make_response
|
||||
from flask_babel import gettext
|
||||
from collections import OrderedDict
|
||||
|
||||
import logging
|
||||
import sarge
|
||||
@@ -28,7 +26,6 @@ import sys
|
||||
import requests
|
||||
import re
|
||||
import os
|
||||
import pkg_resources
|
||||
import copy
|
||||
import dateutil.parser
|
||||
import time
|
||||
@@ -62,6 +59,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
|
||||
RECONNECT_HOOKS = ["octoprint.comm.protocol.*",]
|
||||
|
||||
# noinspection PyMissingConstructor
|
||||
def __init__(self):
|
||||
self._pending_enable = set()
|
||||
self._pending_disable = set()
|
||||
@@ -134,9 +132,9 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
|
||||
def get_settings_defaults(self):
|
||||
return dict(
|
||||
repository="http://plugins.octoprint.org/plugins.json",
|
||||
repository="https://plugins.octoprint.org/plugins.json",
|
||||
repository_ttl=24*60,
|
||||
notices="http://plugins.octoprint.org/notices.json",
|
||||
notices="https://plugins.octoprint.org/notices.json",
|
||||
notices_ttl=6*60,
|
||||
pip_args=None,
|
||||
pip_force_user=False,
|
||||
|
||||
@@ -197,8 +197,8 @@ $(function() {
|
||||
return;
|
||||
}
|
||||
|
||||
var restartSpec = _.filter(lastResponse.core, function(spec) { return spec.action === "restart" });
|
||||
self.restartCommandSpec = restartSpec !== undefined && restartSpec.length > 0 ? restartSpec[0] : undefined;
|
||||
var restartSpec = _.filter(lastResponse.core, function(spec) { return spec.action == "restart" });
|
||||
self.restartCommandSpec = restartSpec != undefined && restartSpec.length > 0 ? restartSpec[0] : undefined;
|
||||
});
|
||||
|
||||
self.notifications = [];
|
||||
@@ -208,9 +208,9 @@ $(function() {
|
||||
|
||||
self.noticeCountText = ko.pureComputed(function() {
|
||||
var count = self.noticeCount();
|
||||
if (count === 0) {
|
||||
if (count == 0) {
|
||||
return gettext("There are no plugin notices. Great!");
|
||||
} else if (count === 1) {
|
||||
} else if (count == 1) {
|
||||
return gettext("There is a plugin notice for one of your installed plugins.");
|
||||
} else {
|
||||
return _.sprintf(gettext("There are %(count)d plugin notices for one or more of your installed plugins."), {count: count});
|
||||
@@ -225,15 +225,15 @@ $(function() {
|
||||
var command = self._getToggleCommand(data);
|
||||
var not_safemode_victim = !data.safe_mode_victim || data.safe_mode_enabled;
|
||||
var not_blacklisted = !data.blacklisted;
|
||||
return self.enableManagement() && (command === "disable" || (not_safemode_victim && not_blacklisted)) && data.key !== 'pluginmanager';
|
||||
return self.enableManagement() && (command == "disable" || (not_safemode_victim && not_blacklisted)) && data.key != 'pluginmanager';
|
||||
};
|
||||
|
||||
self.enableUninstall = function(data) {
|
||||
return self.enableManagement()
|
||||
&& (data.origin !== "entry_point" || self.pipAvailable())
|
||||
&& (data.origin != "entry_point" || self.pipAvailable())
|
||||
&& data.managable
|
||||
&& !data.bundled
|
||||
&& data.key !== 'pluginmanager'
|
||||
&& data.key != 'pluginmanager'
|
||||
&& !data.pending_uninstall;
|
||||
};
|
||||
|
||||
@@ -300,7 +300,7 @@ $(function() {
|
||||
maxNumberOfFiles: 1,
|
||||
autoUpload: false,
|
||||
add: function(e, data) {
|
||||
if (data.files.length === 0) {
|
||||
if (data.files.length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ $(function() {
|
||||
|
||||
self.performRepositorySearch = function() {
|
||||
var query = self.repositorySearchQuery();
|
||||
if (query !== undefined && query.trim() !== "") {
|
||||
if (query !== undefined && query.trim() != "") {
|
||||
query = query.toLocaleLowerCase();
|
||||
self.repositoryplugins.changeSearchFunction(function(entry) {
|
||||
return entry && (entry["title"].toLocaleLowerCase().indexOf(query) > -1 || entry["description"].toLocaleLowerCase().indexOf(query) > -1);
|
||||
@@ -448,7 +448,7 @@ $(function() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.key === "pluginmanager") return;
|
||||
if (data.key == "pluginmanager") return;
|
||||
|
||||
var onSuccess = function() {
|
||||
self.requestData();
|
||||
@@ -462,7 +462,7 @@ $(function() {
|
||||
})
|
||||
};
|
||||
|
||||
if (self._getToggleCommand(data) === "enable") {
|
||||
if (self._getToggleCommand(data) == "enable") {
|
||||
if (data.safe_mode_victim && !data.safe_mode_enabled) return;
|
||||
OctoPrint.plugins.pluginmanager.enable(data.key)
|
||||
.done(onSuccess)
|
||||
@@ -583,7 +583,7 @@ $(function() {
|
||||
}
|
||||
|
||||
if (data.bundled) return;
|
||||
if (data.key === "pluginmanager") return;
|
||||
if (data.key == "pluginmanager") return;
|
||||
|
||||
self._markWorking(gettext("Uninstalling plugin..."), _.sprintf(gettext("Uninstalling plugin \"%(name)s\""), {name: data.name}));
|
||||
|
||||
@@ -634,7 +634,7 @@ $(function() {
|
||||
|
||||
self.savePluginSettings = function() {
|
||||
var repository = self.config_repositoryUrl();
|
||||
if (repository !== undefined && repository.trim() === "") {
|
||||
if (repository != undefined && repository.trim() == "") {
|
||||
repository = null;
|
||||
}
|
||||
|
||||
@@ -646,7 +646,7 @@ $(function() {
|
||||
}
|
||||
|
||||
var notices = self.config_noticesUrl();
|
||||
if (notices !== undefined && notices.trim() === "") {
|
||||
if (notices != undefined && notices.trim() == "") {
|
||||
notices = null;
|
||||
}
|
||||
|
||||
@@ -658,7 +658,7 @@ $(function() {
|
||||
}
|
||||
|
||||
var pipArgs = self.config_pipAdditionalArgs();
|
||||
if (pipArgs !== undefined && pipArgs.trim() === "") {
|
||||
if (pipArgs != undefined && pipArgs.trim() == "") {
|
||||
pipArgs = null;
|
||||
}
|
||||
|
||||
@@ -710,7 +710,7 @@ $(function() {
|
||||
};
|
||||
|
||||
if (response.result) {
|
||||
if (action === "install" && response.plugin && response.plugin.blacklisted) {
|
||||
if (action == "install" && response.plugin && response.plugin.blacklisted) {
|
||||
notification = new PNotify({
|
||||
title: titleSuccess,
|
||||
text: textSuccess,
|
||||
@@ -863,7 +863,7 @@ $(function() {
|
||||
};
|
||||
|
||||
self.toggleButtonCss = function(data) {
|
||||
var icon = self._getToggleCommand(data) === "enable" ? "fa fa-toggle-off" : "fa fa-toggle-on";
|
||||
var icon = self._getToggleCommand(data) == "enable" ? "fa fa-toggle-off" : "fa fa-toggle-on";
|
||||
var disabled = (self.enableToggle(data)) ? "" : " disabled";
|
||||
|
||||
return icon + disabled;
|
||||
@@ -871,7 +871,7 @@ $(function() {
|
||||
|
||||
self.toggleButtonTitle = function(data) {
|
||||
var command = self._getToggleCommand(data);
|
||||
if (command === "enable") {
|
||||
if (command == "enable") {
|
||||
if (data.blacklisted) {
|
||||
return gettext("Blacklisted");
|
||||
} else if (data.safe_mode_victim && !data.safe_mode_enabled) {
|
||||
@@ -885,7 +885,7 @@ $(function() {
|
||||
};
|
||||
|
||||
self.showPluginNotifications = function(plugin) {
|
||||
if (!plugin.notifications || plugin.notifications.length === 0) return;
|
||||
if (!plugin.notifications || plugin.notifications.length == 0) return;
|
||||
|
||||
self._removeAllNoticeNotificationsForPlugin(plugin.key);
|
||||
_.each(plugin.notifications, function(notification) {
|
||||
@@ -894,7 +894,7 @@ $(function() {
|
||||
};
|
||||
|
||||
self.showPluginNotificationsLinkText = function(plugins) {
|
||||
if (!plugins.notifications || plugins.notifications.length === 0) return;
|
||||
if (!plugins.notifications || plugins.notifications.length == 0) return;
|
||||
|
||||
var count = plugins.notifications.length;
|
||||
var importantCount = _.filter(plugins.notifications, function(notification) { return notification.important }).length;
|
||||
@@ -930,7 +930,7 @@ $(function() {
|
||||
var text = "";
|
||||
|
||||
if (notification.versions && notification.versions.length > 0) {
|
||||
var versions = _.map(notification.versions, function(v) { return (v === version) ? "<strong>" + v + "</strong>" : v; }).join(", ");
|
||||
var versions = _.map(notification.versions, function(v) { return (v == version) ? "<strong>" + v + "</strong>" : v; }).join(", ");
|
||||
text += "<small>" + _.sprintf(gettext("Affected versions: %(versions)s"), {versions: versions}) + "</small>";
|
||||
} else {
|
||||
text += "<small>" + gettext("Affected versions: all") + "</small>";
|
||||
@@ -1006,7 +1006,7 @@ $(function() {
|
||||
|
||||
self._isNoticeNotificationHidden = function(key, date) {
|
||||
if (!self.hiddenNoticeNotifications[key]) return false;
|
||||
return _.any(_.map(self.hiddenNoticeNotifications[key], function(d) { return date === d; }));
|
||||
return _.any(_.map(self.hiddenNoticeNotifications[key], function(d) { return date == d; }));
|
||||
};
|
||||
|
||||
var noticeLocalStorageKey = "plugin.pluginmanager.seen_notices";
|
||||
@@ -1040,7 +1040,7 @@ $(function() {
|
||||
if (!Modernizr.localstorage)
|
||||
return false;
|
||||
|
||||
if (localStorage[noticeLocalStorageKey] === undefined)
|
||||
if (localStorage[noticeLocalStorageKey] == undefined)
|
||||
return false;
|
||||
|
||||
var knownData = JSON.parse(localStorage[noticeLocalStorageKey]);
|
||||
@@ -1095,7 +1095,7 @@ $(function() {
|
||||
};
|
||||
|
||||
self.onDataUpdaterPluginMessage = function(plugin, data) {
|
||||
if (plugin !== "pluginmanager") {
|
||||
if (plugin != "pluginmanager") {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1109,21 +1109,21 @@ $(function() {
|
||||
|
||||
var messageType = data.type;
|
||||
|
||||
if (messageType === "loglines" && self.working()) {
|
||||
if (messageType == "loglines" && self.working()) {
|
||||
_.each(data.loglines, function(line) {
|
||||
self.loglines.push(self._preprocessLine(line));
|
||||
});
|
||||
self._scrollWorkingOutputToEnd();
|
||||
} else if (messageType === "result") {
|
||||
} else if (messageType == "result") {
|
||||
var titleSuccess, textSuccess, textRestart, textReload, textReconnect, titleError, textError;
|
||||
var action = data.action;
|
||||
|
||||
var name = "Unknown";
|
||||
if (action === "install") {
|
||||
if (action == "install") {
|
||||
var unknown = false;
|
||||
|
||||
if (data.hasOwnProperty("plugin")) {
|
||||
if (data.plugin === "unknown") {
|
||||
if (data.plugin == "unknown") {
|
||||
unknown = true;
|
||||
} else {
|
||||
name = data.plugin.name;
|
||||
@@ -1173,13 +1173,13 @@ $(function() {
|
||||
|
||||
if (data.hasOwnProperty("reason")) {
|
||||
if (data.was_reinstalled) {
|
||||
if (sourceType === "path") {
|
||||
if (sourceType == "path") {
|
||||
textError = _.sprintf(gettext("Reinstalling the plugin from file failed: %(reason)s"), {reason: data.reason});
|
||||
} else {
|
||||
textError = _.sprintf(gettext("Reinstalling the plugin from \"%(source)s\" failed: %(reason)s"), {reason: data.reason, source: source});
|
||||
}
|
||||
} else {
|
||||
if (sourceType === "path") {
|
||||
if (sourceType == "path") {
|
||||
textError = _.sprintf(gettext("Installing the plugin from file failed: %(reason)s"), {reason: data.reason});
|
||||
} else {
|
||||
textError = _.sprintf(gettext("Installing the plugin from \"%(source)s\" failed: %(reason)s"), {reason: data.reason, source: source});
|
||||
@@ -1187,13 +1187,13 @@ $(function() {
|
||||
}
|
||||
} else {
|
||||
if (data.was_reinstalled) {
|
||||
if (sourceType === "path") {
|
||||
if (sourceType == "path") {
|
||||
textError = gettext("Reinstalling the plugin from file failed, please see the log for details.");
|
||||
} else {
|
||||
textError = _.sprintf(gettext("Reinstalling the plugin from \"%(source)s\" failed, please see the log for details."), {source: source});
|
||||
}
|
||||
} else {
|
||||
if (sourceType === "path") {
|
||||
if (sourceType == "path") {
|
||||
textError = gettext("Installing the plugin from file failed, please see the log for details.");
|
||||
} else {
|
||||
textError = _.sprintf(gettext("Installing the plugin from \"%(source)s\" failed, please see the log for details."), {source: source});
|
||||
@@ -1201,7 +1201,7 @@ $(function() {
|
||||
}
|
||||
}
|
||||
|
||||
} else if (action === "uninstall") {
|
||||
} else if (action == "uninstall") {
|
||||
if (data.hasOwnProperty("plugin")) {
|
||||
name = data.plugin.name;
|
||||
}
|
||||
@@ -1219,7 +1219,7 @@ $(function() {
|
||||
textError = gettext("Uninstalling the plugin failed, please see the log for details.");
|
||||
}
|
||||
|
||||
} else if (action === "enable") {
|
||||
} else if (action == "enable") {
|
||||
if (data.hasOwnProperty("plugin")) {
|
||||
name = data.plugin.name;
|
||||
}
|
||||
@@ -1237,7 +1237,7 @@ $(function() {
|
||||
textError = gettext("Toggling the plugin failed, please see the log for details.");
|
||||
}
|
||||
|
||||
} else if (action === "disable") {
|
||||
} else if (action == "disable") {
|
||||
if (data.hasOwnProperty("plugin")) {
|
||||
name = data.plugin.name;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
{{ pluginmanager_safemode() }}
|
||||
{{ pluginmanager_offline() }}
|
||||
<h4 style="position: relative">
|
||||
{{ _('... from the <a href="%(url)s" target="_blank">Plugin Repository</a>', url='http://plugins.octoprint.org') }}
|
||||
{{ _('... from the <a href="%(url)s" target="_blank">Plugin Repository</a>', url='https://plugins.octoprint.org') }}
|
||||
<div class="dropdown pull-right">
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<span class="fa fa-wrench"></span>
|
||||
|
||||
Reference in new issue
Block a user