diff --git a/datasette/app.py b/datasette/app.py index 4105ba3a..a37a4a45 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -366,6 +366,17 @@ class Datasette: }, } + def plugins(self): + return [ + { + "name": p["name"], + "static": p["static_path"] is not None, + "templates": p["templates_path"] is not None, + "version": p.get("version"), + } + for p in get_plugins(pm) + ] + def app(self): app = Sanic(__name__) default_templates = str(app_root / "datasette" / "templates") @@ -419,19 +430,7 @@ class Datasette: "/-/versions", ) app.add_route( - JsonDataView.as_view( - self, - "plugins.json", - lambda: [ - { - "name": p["name"], - "static": p["static_path"] is not None, - "templates": p["templates_path"] is not None, - "version": p.get("version"), - } - for p in get_plugins(pm) - ], - ), + JsonDataView.as_view(self, "plugins.json", self.plugins), "/-/plugins", ) app.add_route(