Backend: - apps.core with GET /api/status/ (env, git hash, OS, watched folder, worker counts) and a TimingMiddleware adding X-Server-Time-Ms - status endpoint reports its own server-side assembly time Frontend: - top bar shows the storage line (watched folder) and a status pill with ENV, git hash, host OS, server time (e621 time once it exists) - fixed 32px footer strip: storage path, active workers, build version - collapsible filter sidebar: closed by default, Ctrl/Cmd+B toggle, overlay drawer with backdrop blur under 1024px - rating filters, per-page and sidebar state persist in localStorage
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
import platform
|
|
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
|
|
|
|
|
|
def _os_info():
|
|
system = platform.system()
|
|
icon = {"Linux": "linux", "Darwin": "apple", "Windows": "windows"}.get(
|
|
system, "unknown"
|
|
)
|
|
return {"name": system, "release": platform.release(), "icon": icon}
|
|
|
|
|
|
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": _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)
|