diff --git a/projects/activitypub_relay/src/python/relay/views.py b/projects/activitypub_relay/src/python/relay/views.py index 13094ef..3215585 100644 --- a/projects/activitypub_relay/src/python/relay/views.py +++ b/projects/activitypub_relay/src/python/relay/views.py @@ -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")):