views: Implement an API to retrieve the readiness status in JSON

- This can have may uses such as:

  - Waiting properly on the reboot page until the system has been restarted
  while showing the status.

  - Or, waiting for first setup to complete before running functional tests.

  - Or, monitoring for the health status of FreedomBox in general.

- The page is public as all the information conveyed there is also already
public. Should we introduce any sensitive information there such as
'operations_in_progress', we can provide that information only to
administrators.

Tests:

- Visiting /plinth/status/ shows the status in JSON. Using curl to retrieve the
information is also possible.

- During the first setup 'is_first_setup_running' is 'true'. After it has
completed, it is 'false'.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa authored and Veiko Aasa committed 2025-11-03 13:53:59 +02:00
1 parent 8a4f03c58a
commit 623604649e
3 files changed
+14 -2

No files matched your search

+3 -2
View File
@@ -30,9 +30,10 @@ class FirstBootMiddleware(MiddlewareMixin):
if user_requests_login:
return
# Don't interfere with help pages
# Don't interfere with help or status pages
user_requests_help = request.path.startswith(reverse('help:index'))
if user_requests_help:
user_requests_status = request.path.startswith(reverse('status'))
if user_requests_help or user_requests_status:
return
# Don't interfere with first setup progress page. When first setup is