mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01: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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue