diff --git a/src/octoprint/plugin/__init__.py b/src/octoprint/plugin/__init__.py index 21976d08..447e4791 100644 --- a/src/octoprint/plugin/__init__.py +++ b/src/octoprint/plugin/__init__.py @@ -103,7 +103,8 @@ def plugin_manager(init=False, plugin_folders=None, plugin_types=None, plugin_en EventHandlerPlugin, SlicerPlugin, AppPlugin, - ProgressPlugin] + ProgressPlugin, + WizardPlugin] if plugin_entry_points is None: plugin_entry_points = "octoprint.plugin" if plugin_disabled_list is None: diff --git a/src/octoprint/plugin/types.py b/src/octoprint/plugin/types.py index 70d7b5b7..e593a880 100644 --- a/src/octoprint/plugin/types.py +++ b/src/octoprint/plugin/types.py @@ -455,6 +455,9 @@ class WizardPlugin(OctoPrintPlugin, ReloadNeedingPlugin): def is_wizard_required(self): return False + def get_wizard_details(self): + return dict() + class SimpleApiPlugin(OctoPrintPlugin): """ diff --git a/src/octoprint/server/api/__init__.py b/src/octoprint/server/api/__init__.py index 47215573..150fba3a 100644 --- a/src/octoprint/server/api/__init__.py +++ b/src/octoprint/server/api/__init__.py @@ -98,6 +98,24 @@ def pluginCommand(name): #~~ first run setup +@api.route("/setup/wizard", methods=["GET"]) +def wizardState(): + if not s().getBoolean(["server", "firstRun"]) and not admin_permission.can(): + abort(403) + + result = dict() + wizard_plugins = octoprint.server.pluginManager.get_implementations(octoprint.plugin.WizardPlugin) + for implementation in wizard_plugins: + name = implementation._identifier + try: + required = implementation.is_wizard_required() + details = implementation.get_wizard_details() + except: + logging.getLogger(__name__).exception("There was an error fetching wizard details for {}, ignoring".format(name)) + else: + result[name] = dict(required=required, details=details) + + return jsonify(result) @api.route("/setup", methods=["POST"]) def firstRunSetup():