mirror of
https://github.com/simonw/datasette.git
synced 2026-09-30 13:54:07 +02:00
/-/plugins now shows details of hooks, closes #794
Also added /-/plugins?all=1 parameter to see default plugins.
This commit is contained in:
parent
5278c04682
commit
a7137dfe06
4 changed files with 64 additions and 12 deletions
|
|
@ -625,9 +625,9 @@ class Datasette:
|
|||
},
|
||||
}
|
||||
|
||||
def _plugins(self, show_all=False):
|
||||
def _plugins(self, request):
|
||||
ps = list(get_plugins())
|
||||
if not show_all:
|
||||
if not request.args.get("all"):
|
||||
ps = [p for p in ps if p["name"] not in DEFAULT_PLUGINS]
|
||||
return [
|
||||
{
|
||||
|
|
@ -635,6 +635,7 @@ class Datasette:
|
|||
"static": p["static_path"] is not None,
|
||||
"templates": p["templates_path"] is not None,
|
||||
"version": p.get("version"),
|
||||
"hooks": p["hooks"],
|
||||
}
|
||||
for p in ps
|
||||
]
|
||||
|
|
@ -822,7 +823,9 @@ class Datasette:
|
|||
r"/-/versions(?P<as_format>(\.json)?)$",
|
||||
)
|
||||
add_route(
|
||||
JsonDataView.as_asgi(self, "plugins.json", self._plugins),
|
||||
JsonDataView.as_asgi(
|
||||
self, "plugins.json", self._plugins, needs_request=True
|
||||
),
|
||||
r"/-/plugins(?P<as_format>(\.json)?)$",
|
||||
)
|
||||
add_route(
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ def get_plugins():
|
|||
"name": plugin.__name__,
|
||||
"static_path": static_path,
|
||||
"templates_path": templates_path,
|
||||
"hooks": [h.name for h in pm.get_hookcallers(plugin)],
|
||||
}
|
||||
distinfo = plugin_to_distinfo.get(plugin)
|
||||
if distinfo:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue