diff --git a/AUTHORS.md b/AUTHORS.md index 38730e8d6..17c8c7670 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -108,6 +108,8 @@ date of first contribution): * [Piotr Usewicz](https://github.com/pusewicz) * [Aliaksei Pilko](https://github.com/aliaksei135) * [Ben Yarmis](https://github.com/byarmis) + * [Florian Heilmann](https://github.com/FHeilmann) + * [Ludovico de Nittis](https://github.com/RyuzakiKK) 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 diff --git a/scripts/README.md b/scripts/README.md index 8fbc44621..51da00e50 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -13,5 +13,5 @@ octoprint.init => /etc/init.d/octoprint ## systemd ``` -octoprint.service => /etc/systemd/service/octoprint.service +octoprint.service => /etc/systemd/system/octoprint.service ``` diff --git a/src/octoprint/plugins/action_command_prompt/__init__.py b/src/octoprint/plugins/action_command_prompt/__init__.py index dc5f796e8..ca45ab689 100644 --- a/src/octoprint/plugins/action_command_prompt/__init__.py +++ b/src/octoprint/plugins/action_command_prompt/__init__.py @@ -207,8 +207,11 @@ class ActionCommandPromptPlugin(octoprint.plugin.AssetPlugin, return self._close_prompt() - self._printer.commands(["{command} S{choice}".format(command=self._command, - choice=choice)]) + if "{choice}" in self._command: + self._printer.commands([self._command.format(choice=choice)]) + else: + self._printer.commands(["{command} S{choice}".format(command=self._command, + choice=choice)]) __plugin_name__ = "Action Command Prompt Support" diff --git a/src/octoprint/plugins/appkeys/static/js/appkeys.js b/src/octoprint/plugins/appkeys/static/js/appkeys.js index bdd72e97b..bb5fdc822 100644 --- a/src/octoprint/plugins/appkeys/static/js/appkeys.js +++ b/src/octoprint/plugins/appkeys/static/js/appkeys.js @@ -52,7 +52,7 @@ $(function() { .done(self.requestData); }; - showConfirmationDialog(_.sprintf(gettext("You are about to revoke the application key \"%(key)s\"."), {key: key}), + showConfirmationDialog(_.sprintf(gettext("You are about to revoke the application key \"%(key)s\"."), {key: _.escape(key)}), perform); }; @@ -68,7 +68,7 @@ $(function() { self.promptForAccess = function(app, token) { var message = gettext("\"%(app)s\" has requested access to control OctoPrint through the API."); - message = _.sprintf(message, {app: app}); + message = _.sprintf(message, {app: _.escape(app)}); message = "
" + message + "
" + gettext("Do you want to allow access to this application with your user account?") + "
"; return new PNotify({ title: gettext("Access Request"), @@ -210,7 +210,7 @@ $(function() { .done(self.requestData); }; - showConfirmationDialog(_.sprintf(gettext("You are about to revoke the application key \"%(key)s\"."), {key: key}), + showConfirmationDialog(_.sprintf(gettext("You are about to revoke the application key \"%(key)s\"."), {key: _.escape(key)}), perform); }; @@ -258,11 +258,11 @@ $(function() { handler = function(key) { return OctoPrint.plugins.appkeys.revokeKey(key) .done(function() { - deferred.notify(_.sprintf(gettext("Revoked %(key)s..."), {key: key}), true); + deferred.notify(_.sprintf(gettext("Revoked %(key)s..."), {key: _.escape(key)}), true); }) .fail(function(jqXHR) { - var short = _.sprintf(gettext("Revocation of %(key)s failed, continuing..."), {key: key}); - var long = _.sprintf(gettext("Deletion of %(key)s failed: %(error)s"), {key: key, error: jqXHR.responseText}); + var short = _.sprintf(gettext("Revocation of %(key)s failed, continuing..."), {key: _.escape(key)}); + var long = _.sprintf(gettext("Deletion of %(key)s failed: %(error)s"), {key: _.escape(key), error: _.escape(jqXHR.responseText)}); deferred.notify(short, long, false); }); }; diff --git a/src/octoprint/plugins/backup/static/js/backup.js b/src/octoprint/plugins/backup/static/js/backup.js index 348860204..2414b3a53 100644 --- a/src/octoprint/plugins/backup/static/js/backup.js +++ b/src/octoprint/plugins/backup/static/js/backup.js @@ -85,7 +85,7 @@ $(function() { self.requestData(); }); }; - showConfirmationDialog(_.sprintf(gettext("You are about to delete backup file \"%(name)s\"."), {name: backup}), + showConfirmationDialog(_.sprintf(gettext("You are about to delete backup file \"%(name)s\"."), {name: _.escape(backup)}), perform); }; @@ -101,7 +101,7 @@ $(function() { OctoPrint.plugins.backup.restoreBackup(backup); }; - showConfirmationDialog(_.sprintf(gettext("You are about to restore the backup file \"%(name)s\". This cannot be undone."), {name: backup}), + showConfirmationDialog(_.sprintf(gettext("You are about to restore the backup file \"%(name)s\". This cannot be undone."), {name: _.escape(backup)}), perform); }; @@ -117,7 +117,7 @@ $(function() { self.backupUploadData.submit(); }; - showConfirmationDialog(_.sprintf(gettext("You are about to upload and restore the backup file \"%(name)s\". This cannot be undone."), {name: self.backupUploadName()}), + showConfirmationDialog(_.sprintf(gettext("You are about to upload and restore the backup file \"%(name)s\". This cannot be undone."), {name: _.escape(self.backupUploadName())}), perform); }; @@ -182,7 +182,7 @@ $(function() { self.backupInProgress(false); new PNotify({ title: gettext("Creating the backup failed"), - text: _.sprintf(gettext("OctoPrint could not create your backup. Please consultoctoprint.log for details. Error: %(error)s"), {error:data.error}),
+ text: _.sprintf(gettext("OctoPrint could not create your backup. Please consult octoprint.log for details. Error: %(error)s"), {error: _.escape(data.error)}),
type: "error",
hide: false
});
@@ -200,13 +200,13 @@ $(function() {
} else if (data.type === "installing_plugin") {
self.loglines.push({line: " ", stream: "message"});
self.loglines.push({
- line: _.sprintf(gettext("Installing plugin \"%(plugin)s\"..."), {plugin: data.plugin}),
+ line: _.sprintf(gettext("Installing plugin \"%(plugin)s\"..."), {plugin: _.escape(data.plugin)}),
stream: "message"
});
} else if (data.type === "plugin_incompatible") {
self.loglines.push({line: " ", stream: "message"});
self.loglines.push({
- line: _.sprintf(gettext("Cannot install plugin \"%(plugin)s\" due to it being incompatible to this OctoPrint version and/or underlying operating system"), {plugin: data.plugin.key}),
+ line: _.sprintf(gettext("Cannot install plugin \"%(plugin)s\" due to it being incompatible to this OctoPrint version and/or underlying operating system"), {plugin: _.escape(data.plugin.key)}),
stream: "stderr"
});
} else if (data.type === "unknown_plugins") {
@@ -245,11 +245,11 @@ $(function() {
handler = function(filename) {
return OctoPrint.plugins.backup.deleteBackup(filename)
.done(function() {
- deferred.notify(_.sprintf(gettext("Deleted %(filename)s..."), {filename: filename}), true);
+ deferred.notify(_.sprintf(gettext("Deleted %(filename)s..."), {filename: _.escape(filename)}), true);
})
.fail(function(jqXHR) {
- var short = _.sprintf(gettext("Deletion of %(filename)s failed, continuing..."), {filename: filename});
- var long = _.sprintf(gettext("Deletion of %(filename)s failed: %(error)s"), {filename: filename, error: jqXHR.responseText});
+ var short = _.sprintf(gettext("Deletion of %(filename)s failed, continuing..."), {filename: _.escape(filename)});
+ var long = _.sprintf(gettext("Deletion of %(filename)s failed: %(error)s"), {filename: _.escape(filename), error: _.escape(jqXHR.responseText)});
deferred.notify(short, long, false);
});
};
diff --git a/src/octoprint/plugins/logging/static/js/logging.js b/src/octoprint/plugins/logging/static/js/logging.js
index f465b5fe7..7a7978ac7 100644
--- a/src/octoprint/plugins/logging/static/js/logging.js
+++ b/src/octoprint/plugins/logging/static/js/logging.js
@@ -121,7 +121,7 @@ $(function() {
.done(self.requestData);
};
- showConfirmationDialog(_.sprintf(gettext("You are about to delete log file \"%(name)s\"."), {name: filename}),
+ showConfirmationDialog(_.sprintf(gettext("You are about to delete log file \"%(name)s\"."), {name: _.escape(filename)}),
perform);
};
@@ -172,11 +172,11 @@ $(function() {
var handler = function(filename) {
return OctoPrint.plugins.logging.deleteLog(filename)
.done(function() {
- deferred.notify(_.sprintf(gettext("Deleted %(filename)s..."), {filename: filename}), true);
+ deferred.notify(_.sprintf(gettext("Deleted %(filename)s..."), {filename: _.escape(filename)}), true);
})
.fail(function(jqXHR) {
- var short = _.sprintf(gettext("Deletion of %(filename)s failed, continuing..."), {filename: filename});
- var long = _.sprintf(gettext("Deletion of %(filename)s failed: %(error)s"), {filename: filename, error: jqXHR.responseText});
+ var short = _.sprintf(gettext("Deletion of %(filename)s failed, continuing..."), {filename: _.escape(filename)});
+ var long = _.sprintf(gettext("Deletion of %(filename)s failed: %(error)s"), {filename: _.escape(filename), error: _.escape(jqXHR.responseText)});
deferred.notify(short, long, false);
});
};
diff --git a/src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css b/src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css
index 3a37ccc85..24adf0b6e 100644
--- a/src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css
+++ b/src/octoprint/plugins/pluginmanager/static/css/pluginmanager.css
@@ -1 +1 @@
-#settings_plugin_pluginmanager_pluginlist{display:block;width:auto;height:400px;overflow-x:hidden;overflow-y:scroll;padding-right:2px;margin-bottom:1em}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_name,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_name{text-overflow:ellipsis;text-align:left}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions{text-align:center;width:80px}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions a,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions a{text-decoration:none;color:#000}#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions a.disabled,#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions a.disabled{color:#ccc;cursor:default}#settings_plugin_pluginmanager_repositorydialog h4{position:relative}#settings_plugin_pluginmanager_repositorydialog h4 a.dropdown-toggle{color:inherit;text-decoration:none;font-size:14px}#settings_plugin_pluginmanager_repositorydialog h4 ul.dropdown-menu{font-size:14px}#settings_plugin_pluginmanager_repositorydialog .form-search{text-align:center;margin-bottom:5px!important}#settings_plugin_pluginmanager_repositorydialog .form-inline{padding:5px 10px 5px 5px;margin-bottom:0}#settings_plugin_pluginmanager_repositorydialog .form-inline .help-block{margin-bottom:0;font-size:85%}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_unavailable{overflow:hidden;width:100%;height:300px;background-image:url(../img/repo_unavailable.png);text-align:center;display:table}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_unavailable div{display:table-cell;vertical-align:middle}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list{width:auto;height:300px;overflow-x:hidden;overflow-y:scroll;padding-right:2px}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list .entry{border-bottom:1px solid #ddd;padding:5px}#settings_plugin_pluginmanager_workingdialog_output .message{font-weight:700}#settings_plugin_pluginmanager_workingdialog_output .error{font-weight:700;color:#900}#settings_plugin_pluginmanager_workingdialog_output .stdout{color:#333}#settings_plugin_pluginmanager_workingdialog_output .stderr{color:#900}#settings_plugin_pluginmanager_workingdialog_output .call{color:#009}
\ No newline at end of file
+#settings_plugin_pluginmanager .form-search{text-align:center;margin-bottom:5px!important}#settings_plugin_pluginmanager_pluginlist{display:block;width:auto;height:400px;overflow-x:hidden;overflow-y:scroll;padding-right:2px;margin-bottom:1em}#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_name,#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_name{text-overflow:ellipsis;text-align:left}#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions,#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions{text-align:center;width:80px}#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions a,#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions a{text-decoration:none;color:#000}#settings_plugin_pluginmanager_pluginlist table th.settings_plugin_plugin_manager_plugins_actions a.disabled,#settings_plugin_pluginmanager_pluginlist table td.settings_plugin_plugin_manager_plugins_actions a.disabled{color:#ccc;cursor:default}#settings_plugin_pluginmanager_repositorydialog h4{position:relative}#settings_plugin_pluginmanager_repositorydialog h4 a.dropdown-toggle{color:inherit;text-decoration:none;font-size:14px}#settings_plugin_pluginmanager_repositorydialog h4 ul.dropdown-menu{font-size:14px}#settings_plugin_pluginmanager_repositorydialog .form-search{text-align:center;margin-bottom:5px!important}#settings_plugin_pluginmanager_repositorydialog .form-inline{padding:5px;padding-right:10px;margin-bottom:0}#settings_plugin_pluginmanager_repositorydialog .form-inline .help-block{margin-bottom:0;font-size:85%}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_unavailable{overflow:hidden;width:100%;height:300px;background-image:url(../img/repo_unavailable.png);text-align:center;display:table}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_unavailable div{display:table-cell;vertical-align:middle}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list{width:auto;height:300px;overflow-x:hidden;overflow-y:scroll;padding-right:2px}#settings_plugin_pluginmanager_repositorydialog #settings_plugin_pluginmanager_repositorydialog_list .entry{border-bottom:1px solid #ddd;padding:5px}#settings_plugin_pluginmanager_workingdialog_output .message{font-weight:700}#settings_plugin_pluginmanager_workingdialog_output .error{font-weight:700;color:#900}#settings_plugin_pluginmanager_workingdialog_output .stdout{color:#333}#settings_plugin_pluginmanager_workingdialog_output .stderr{color:#900}#settings_plugin_pluginmanager_workingdialog_output .call{color:#009}
\ No newline at end of file
diff --git a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js
index 9cd15c116..859375da3 100644
--- a/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js
+++ b/src/octoprint/plugins/pluginmanager/static/js/pluginmanager.js
@@ -93,6 +93,11 @@ $(function() {
self.performRepositorySearch();
});
+ self.listingSearchQuery = ko.observable();
+ self.listingSearchQuery.subscribe(function() {
+ self.performListingSearch();
+ });
+
self.installUrl = ko.observable();
self.uploadFilename = ko.observable();
@@ -291,9 +296,21 @@ $(function() {
}
});
+ self.performListingSearch = function() {
+ var query = self.listingSearchQuery();
+ if (query !== undefined && query.trim() !== "") {
+ query = query.toLocaleLowerCase();
+ self.plugins.changeSearchFunction(function (entry) {
+ return entry && (entry["name"].toLocaleLowerCase().indexOf(query) > -1 || (entry.description && entry.description.toLocaleLowerCase().indexOf(query) > -1));
+ });
+ } else {
+ self.plugins.resetSearch();
+ }
+ }
+
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);
@@ -427,7 +444,7 @@ $(function() {
// always warn if plugin is marked "disabling discouraged"
if (data.disabling_discouraged) {
- var message = _.sprintf(gettext("You are about to disable \"%(name)s\"."), {name: data.name})
+ var message = _.sprintf(gettext("You are about to disable \"%(name)s\"."), {name: _.escape(data.name)})
+ "" + data.disabling_discouraged; showConfirmationDialog({ title: gettext("This is not recommended"), @@ -441,7 +458,7 @@ $(function() { // warn if global "warn disabling" setting is set" else if (self.settingsViewModel.settings.plugins.pluginmanager.confirm_disable()) { showConfirmationDialog({ - message: _.sprintf(gettext("You are about to disable \"%(name)s\""), {name: data.name}), + message: _.sprintf(gettext("You are about to disable \"%(name)s\""), {name: _.escape(data.name)}), cancel: gettext("Keep enabled"), proceed: gettext("Disable plugin"), onproceed: performDisabling, @@ -500,13 +517,13 @@ $(function() { if (!reinstall) { workTitle = gettext("Installing plugin..."); if (name) { - workText = _.sprintf(gettext("Installing plugin \"%(name)s\" from %(url)s..."), {url: url, name: name}); + workText = _.sprintf(gettext("Installing plugin \"%(name)s\" from %(url)s..."), {url: _.escape(url), name: _.escape(name)}); } else { - workText = _.sprintf(gettext("Installing plugin from %(url)s..."), {url: url}); + workText = _.sprintf(gettext("Installing plugin from %(url)s..."), {url: _.escape(url)}); } } else { workTitle = gettext("Reinstalling plugin..."); - workText = _.sprintf(gettext("Reinstalling plugin \"%(name)s\" from %(url)s..."), {url: url, name: name}); + workText = _.sprintf(gettext("Reinstalling plugin \"%(name)s\" from %(url)s..."), {url: _.escape(url), name: _.escape(name)}); } self._markWorking(workTitle, workText); @@ -555,7 +572,7 @@ $(function() { // defining actual uninstall logic as functor in order to handle // the confirm/no-confirm logic without duplication of logic var performUninstall = function() { - self._markWorking(gettext("Uninstalling plugin..."), _.sprintf(gettext("Uninstalling plugin \"%(name)s\""), {name: data.name})); + self._markWorking(gettext("Uninstalling plugin..."), _.sprintf(gettext("Uninstalling plugin \"%(name)s\""), {name: _.escape(data.name)})); OctoPrint.plugins.pluginmanager.uninstall(data.key) .done(function() { @@ -577,7 +594,7 @@ $(function() { if (self.settingsViewModel.settings.plugins.pluginmanager.confirm_uninstall()) { // confirmation needed. Show confirmation dialog and call performUninstall if user clicks Yes showConfirmationDialog({ - message: _.sprintf(gettext("You are about to uninstall the plugin \"%(name)s\""), {name: data.name}), + message: _.sprintf(gettext("You are about to uninstall the plugin \"%(name)s\""), {name: _.escape(data.name)}), cancel: gettext("Keep installed"), proceed: gettext("Uninstall"), onproceed: performUninstall, @@ -739,7 +756,7 @@ $(function() { } text += "