diff --git a/plugins/sample-manifest-v1/plugin.json b/plugins/sample-manifest-v1/plugin.json new file mode 100644 index 00000000..28003b60 --- /dev/null +++ b/plugins/sample-manifest-v1/plugin.json @@ -0,0 +1,31 @@ +{ + "manifest_version": 1, + "name": "Manifest v1 Example", + "version": "1.0.0", + "description": "Example of the version 1 capability declaration format.", + "author": "Dispatcharr Team", + "maintainers": [ + "sethwv" + ], + "help_url": "https://github.com/Dispatcharr/Plugins", + "capabilities": [ + "outbound_network" + ], + "fields": [ + { + "id": "endpoint", + "label": "Endpoint", + "type": "string", + "default": "https://example.com" + } + ], + "actions": [ + { + "id": "check_endpoint", + "label": "Check Endpoint", + "description": "Shows the version 1 capability declaration pattern." + } + ], + "license": "Unlicense", + "unlisted": "true" +} diff --git a/plugins/sample-manifest-v1/plugin.py b/plugins/sample-manifest-v1/plugin.py new file mode 100644 index 00000000..4cef54e6 --- /dev/null +++ b/plugins/sample-manifest-v1/plugin.py @@ -0,0 +1,14 @@ +class Plugin: + name = "Official Manifest v1 Example" + version = "1.0.0" + description = "Dispatcharr-maintained example of manifest version 1." + author = "Dispatcharr Team" + + def run(self, action, params, context): + if action != "check_endpoint": + return {"status": "error", "message": f"Unknown action: {action}"} + return { + "status": "ok", + "message": "Manifest version 1 declares capabilities for approval without runtime enforcement.", + "endpoint": context["settings"].get("endpoint"), + } diff --git a/plugins/sample-manifest-v2/plugin.json b/plugins/sample-manifest-v2/plugin.json new file mode 100644 index 00000000..a0f89caa --- /dev/null +++ b/plugins/sample-manifest-v2/plugin.json @@ -0,0 +1,32 @@ +{ + "manifest_version": 2, + "name": "Manifest v2 Example", + "version": "1.0.0", + "description": "Example of version 2 capability enforcement and durable plugin storage.", + "author": "Dispatcharr Team", + "maintainers": [ + "sethwv" + ], + "help_url": "https://github.com/Dispatcharr/Plugins", + "capabilities": [ + "background_tasks" + ], + "fields": [ + { + "id": "message", + "label": "Message", + "type": "string", + "default": "Hello from Dispatcharr" + } + ], + "actions": [ + { + "id": "write_status", + "label": "Write Status", + "description": "Writes a status file to the plugin data directory.", + "async": true + } + ], + "license": "Unlicense", + "unlisted": "true" +} diff --git a/plugins/sample-manifest-v2/plugin.py b/plugins/sample-manifest-v2/plugin.py new file mode 100644 index 00000000..fa0a3546 --- /dev/null +++ b/plugins/sample-manifest-v2/plugin.py @@ -0,0 +1,18 @@ +from pathlib import Path + + +class Plugin: + name = "Official Manifest v2 Example" + version = "1.0.0" + description = "Dispatcharr-maintained example of manifest version 2." + author = "Dispatcharr Team" + + def run(self, action, params, context): + if action != "write_status": + return {"status": "error", "message": f"Unknown action: {action}"} + + message = context["settings"].get("message", "Hello from Dispatcharr") + status_path = Path(context["data_dir"]) / "status.txt" + status_path.write_text(message, encoding="utf-8") + context["report_progress"](100, "Status file written") + return {"status": "ok", "message": f"Wrote {status_path.name}"}