mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Redirect /-/config to /-/settings, closes #1103
This commit is contained in:
parent
3159263f05
commit
2a3d5b720b
7 changed files with 43 additions and 14 deletions
|
|
@ -66,6 +66,7 @@ from .utils.asgi import (
|
|||
Forbidden,
|
||||
NotFound,
|
||||
Request,
|
||||
Response,
|
||||
asgi_static,
|
||||
asgi_send,
|
||||
asgi_send_html,
|
||||
|
|
@ -884,8 +885,16 @@ class Datasette:
|
|||
r"/-/plugins(?P<as_format>(\.json)?)$",
|
||||
)
|
||||
add_route(
|
||||
JsonDataView.as_view(self, "config.json", lambda: self._config),
|
||||
r"/-/config(?P<as_format>(\.json)?)$",
|
||||
JsonDataView.as_view(self, "settings.json", lambda: self._config),
|
||||
r"/-/settings(?P<as_format>(\.json)?)$",
|
||||
)
|
||||
add_route(
|
||||
permanent_redirect("/-/settings.json"),
|
||||
r"/-/config.json",
|
||||
)
|
||||
add_route(
|
||||
permanent_redirect("/-/settings"),
|
||||
r"/-/config",
|
||||
)
|
||||
add_route(
|
||||
JsonDataView.as_view(self, "threads.json", self._threads),
|
||||
|
|
@ -1224,6 +1233,13 @@ def wrap_view(view_fn, datasette):
|
|||
return async_view_fn
|
||||
|
||||
|
||||
def permanent_redirect(path):
|
||||
return wrap_view(
|
||||
lambda request, send: Response.redirect(path, status=301),
|
||||
datasette=None,
|
||||
)
|
||||
|
||||
|
||||
_curly_re = re.compile(r"(\{.*?\})")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ def menu_links(datasette, actor):
|
|||
"label": "Metadata",
|
||||
},
|
||||
{
|
||||
"href": datasette.urls.path("/-/config"),
|
||||
"label": "Config",
|
||||
"href": datasette.urls.path("/-/settings"),
|
||||
"label": "Settings",
|
||||
},
|
||||
{
|
||||
"href": datasette.urls.path("/-/permissions"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue