mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-27 17:28:02 +01:00
add http api to retreive only plugin names
This commit is contained in:
parent
7fa738d240
commit
a70c63edf4
2 changed files with 20 additions and 1 deletions
|
@ -230,7 +230,8 @@ class PluginController():
|
||||||
for key, module in discovered_plugins.items():
|
for key, module in discovered_plugins.items():
|
||||||
try:
|
try:
|
||||||
meta = metadata(key)
|
meta = metadata(key)
|
||||||
result.append(dict(Name=meta["Name"]))
|
if meta["Name"] != "cbpi4gui":
|
||||||
|
result.append(dict(Name=meta["Name"]))
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("FAILED to load plugin {} ".format(key))
|
logger.error("FAILED to load plugin {} ".format(key))
|
||||||
|
|
|
@ -86,3 +86,21 @@ class PluginHttpEndpoints:
|
||||||
"""
|
"""
|
||||||
plugin_list = await self.cbpi.plugin.load_plugin_list()
|
plugin_list = await self.cbpi.plugin.load_plugin_list()
|
||||||
return web.json_response(plugin_list, dumps=json_dumps)
|
return web.json_response(plugin_list, dumps=json_dumps)
|
||||||
|
|
||||||
|
@request_mapping(path="/names", method="GET", auth_required=False)
|
||||||
|
async def list(self, request):
|
||||||
|
"""
|
||||||
|
---
|
||||||
|
description: Get a list of avialable plugin names
|
||||||
|
tags:
|
||||||
|
- Plugin
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: successful operation. Return "pong" text
|
||||||
|
"405":
|
||||||
|
description: invalid HTTP Method
|
||||||
|
"""
|
||||||
|
plugin_names = await self.cbpi.plugin.load_plugin_names()
|
||||||
|
return web.json_response(plugin_names, dumps=json_dumps)
|
||||||
|
|
Loading…
Reference in a new issue