Create a view for dumping the DB

This commit is contained in:
Reid 'arrdem' McKenzie 2022-12-10 14:12:11 -07:00
parent 1540ff1e2b
commit 4324d14f02

View file

@ -277,6 +277,17 @@ def get_config(request: Request):
return Response.new(request.app.config, status=200, ctype="json")
@register_route("GET", "/admin/db")
def get_db(request: Request):
if not (auth := request.headers.get("Authorization")):
return Response.new_error(403, "access denied", "json")
if not auth == f"Bearer {request.app.config.admin_token}":
return Response.new_error(403, "access denied", "json")
return Response.new(request.app.database, status=200, ctype="json")
@register_route("GET", "/admin/pending")
def get_pending(request):
if not (auth := request.headers.get("Authorization")):