Merge branch 'maintenance' of https://github.com/OctoPrint/OctoPrint into improve/pluginmanager_ui
This commit is contained in:
commit
07c4b17260
12 files changed
+125
-23
No files matched your search
@@ -401,6 +401,22 @@ class PluginManagerPlugin(
|
||||
)
|
||||
)
|
||||
|
||||
@octoprint.plugin.BlueprintPlugin.route("/export", methods=["GET"])
|
||||
@no_firstrun_access
|
||||
@Permissions.PLUGIN_PLUGINMANAGER_MANAGE.require(403)
|
||||
def export_plugin_list(self):
|
||||
import json
|
||||
|
||||
import flask
|
||||
|
||||
plugins = self.generate_plugins_json(self._settings, self._plugin_manager)
|
||||
|
||||
return flask.Response(
|
||||
json.dumps(plugins),
|
||||
mimetype="text/plain",
|
||||
headers={"Content-Disposition": 'attachment; filename="plugin_list.json"'},
|
||||
)
|
||||
|
||||
def is_blueprint_protected(self):
|
||||
return False
|
||||
|
||||
@@ -1755,6 +1771,24 @@ class PluginManagerPlugin(
|
||||
|
||||
return result
|
||||
|
||||
@staticmethod
|
||||
def generate_plugins_json(
|
||||
settings, plugin_manager, ignore_bundled=True, ignore_plugins_folder=True
|
||||
):
|
||||
plugins = []
|
||||
plugin_folder = settings.getBaseFolder("plugins")
|
||||
for plugin in plugin_manager.plugins.values():
|
||||
if (ignore_bundled and plugin.bundled) or (
|
||||
ignore_plugins_folder
|
||||
and isinstance(plugin.origin, octoprint.plugin.core.FolderOrigin)
|
||||
and plugin.origin.folder == plugin_folder
|
||||
):
|
||||
# ignore bundled or from the plugins folder already included in the backup
|
||||
continue
|
||||
|
||||
plugins.append({"key": plugin.key, "name": plugin.name, "url": plugin.url})
|
||||
return plugins
|
||||
|
||||
def _to_external_plugin(self, plugin):
|
||||
return {
|
||||
"key": plugin.key,
|
||||
@@ -1898,3 +1932,8 @@ def __plugin_load__():
|
||||
"octoprint.events.register_custom_events": _register_custom_events,
|
||||
"octoprint.access.permissions": __plugin_implementation__.get_additional_permissions,
|
||||
}
|
||||
|
||||
global __plugin_helpers__
|
||||
__plugin_helpers__ = {
|
||||
"generate_plugins_json": __plugin_implementation__.generate_plugins_json,
|
||||
}
|
||||
@@ -61,6 +61,7 @@
|
||||
|
||||
<div class="pull-right">
|
||||
<button class="btn btn-small" data-bind="click: $root.showRepository"><i class="fas fa-plus"></i> {{ _('Get More') }}</button>
|
||||
<a class="btn btn-small" href="/plugin/pluginmanager/export"><i class="fas fa-download"></i> {{ _('Export') }}</a>
|
||||
<button class="btn btn-small" data-bind="click: function() { $root.showPluginSettings(); }" title="{{ _('Plugin Configuration')|edq }}"><i class="fas fa-wrench"></i></button>
|
||||
<a class="btn btn-small" data-toggle="collapse" href="#pluginmanager_info" title="{{ _('Info') }}"><i class="fas fa-lg fa-info-circle text-info" data-bind="css: {'text-error': noticeCount() > 0, 'text-info': noticeCount() <=0 }"></i></a>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user