mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 21:29:12 +00:00
Update health API to pass authenticated users their info
This allows Khoj clients to get email address associated with user's API token for display in client UX In anonymous mode, default user information is passed
This commit is contained in:
@@ -554,6 +554,8 @@ async def extract_references_and_questions(
|
||||
return compiled_references, inferred_queries, defiltered_query
|
||||
|
||||
|
||||
@api.get("/health")
|
||||
async def health_check():
|
||||
return Response(status_code=200)
|
||||
@api.get("/health", response_class=Response)
|
||||
@requires(["authenticated"], status_code=200)
|
||||
def health_check(request: Request) -> Response:
|
||||
response_obj = {"email": request.user.object.email}
|
||||
return Response(content=json.dumps(response_obj), media_type="application/json", status_code=200)
|
||||
|
||||
Reference in New Issue
Block a user