Files
J621/backend/apps/core/views.py
T
JakeBreath cc625d1e10 Fix shell details: distro name, storage path only in footer
- OS name comes from /etc/os-release (e.g. 'CachyOS Linux'), mirroring
  the original app's os_utils; macOS/Windows get proper names too
- Status pill shows the name as-is instead of uppercasing it
- Removed the watched-folder path next to the logo; it now appears only
  in the footer strip (spec updated to match)
2026-09-17 08:26:14 -05:00

38 lines
1.1 KiB
Python

import time
from django.conf import settings
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework.views import APIView
from .system_info import get_os_info
def _worker_counts():
"""Active/queued background jobs.
No task pipeline exists yet, so this reports honest zeros for now.
"""
return {"active": 0, "queued": 0}
class StatusView(APIView):
"""Runtime status used by the SPA shell (storage line, status pill, footer)."""
permission_classes = [AllowAny]
def get(self, request):
started = getattr(request, "start_time", time.perf_counter())
payload = {
"app": "J621",
"env": settings.APP_ENV,
"git_hash": settings.GIT_COMMIT_HASH,
"version": settings.APP_VERSION,
"os": get_os_info(),
"watched_folder": settings.WATCHED_FOLDER,
"e621_time_ms": None, # no e621 calls in the backend yet
"workers": _worker_counts(),
}
payload["server_time_ms"] = round((time.perf_counter() - started) * 1000, 1)
return Response(payload)