homepage_actions() plugin hook, closes #2298

This commit is contained in:
Simon Willison 2024-03-12 13:44:07 -07:00
commit daf5ca02ca
8 changed files with 118 additions and 2 deletions

View file

@ -425,6 +425,18 @@ def database_actions(datasette, database, actor, request):
]
@hookimpl
def homepage_actions(datasette, actor, request):
if actor:
label = f"Custom homepage for: {actor['id']}"
return [
{
"href": datasette.urls.path("/-/custom-homepage"),
"label": label,
}
]
@hookimpl
def skip_csrf(scope):
return scope["path"] == "/skip-csrf"