diff --git a/backend/apps/core/system_info.py b/backend/apps/core/system_info.py new file mode 100644 index 0000000..0fece81 --- /dev/null +++ b/backend/apps/core/system_info.py @@ -0,0 +1,33 @@ +import platform +from functools import lru_cache + + +@lru_cache(maxsize=1) +def _os_release_values(): + values = {} + try: + with open("/etc/os-release", encoding="utf-8") as handle: + for line in handle: + line = line.strip() + if not line or "=" not in line: + continue + key, value = line.split("=", 1) + values[key] = value.strip().strip('"') + except OSError: + pass + return values + + +@lru_cache(maxsize=1) +def get_os_info(): + """OS display name and icon key, mirroring the original app's os_utils.""" + system = platform.system() + release = platform.release() + if system == "Linux": + name = _os_release_values().get("NAME") or "Linux" + return {"name": name, "release": release, "icon": "linux"} + if system == "Darwin": + return {"name": "macOS", "release": release, "icon": "apple"} + if system == "Windows": + return {"name": "Windows", "release": release, "icon": "windows"} + return {"name": system, "release": release, "icon": "unknown"} diff --git a/backend/apps/core/views.py b/backend/apps/core/views.py index 26aa806..0d84860 100644 --- a/backend/apps/core/views.py +++ b/backend/apps/core/views.py @@ -1,4 +1,3 @@ -import platform import time from django.conf import settings @@ -6,13 +5,7 @@ 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} +from .system_info import get_os_info def _worker_counts(): @@ -35,7 +28,7 @@ class StatusView(APIView): "env": settings.APP_ENV, "git_hash": settings.GIT_COMMIT_HASH, "version": settings.APP_VERSION, - "os": _os_info(), + "os": get_os_info(), "watched_folder": settings.WATCHED_FOLDER, "e621_time_ms": None, # no e621 calls in the backend yet "workers": _worker_counts(), diff --git a/frontend/design.md_j621_frontend_spec.md b/frontend/design.md_j621_frontend_spec.md index 24c0ad3..2fd2177 100644 --- a/frontend/design.md_j621_frontend_spec.md +++ b/frontend/design.md_j621_frontend_spec.md @@ -77,12 +77,12 @@ All tag chips, counters, and sidebar taxonomy badges strictly adhere to e621's e ### 4.1 Global Frame (Shell) - **Top App Bar (`#11111b`, height: 56px):** - - Left: Brand mark `J621` badge (`#cba6f7`) followed by the **storage line** — the path of the watched folder that J621 indexes (e.g. `/mnt/media/library`). J621 is folder-based: this is just a path on disk, not a NAS/appliance indicator. + - Left: Brand mark `J621` badge (`#cba6f7`) only. The watched folder path lives in the footer status strip, not in the header. - Center: Nav pills: `Library`, `Online`, `Pools`, `Followed`, `Upload`, `Duplicates`, and `Stats [STAFF]`. - Right: System status pill with real backend values, never hardcoded: environment (`DEV`/`PROD`), git commit hash, the actual host OS, page generation time, and the total e621 API request time for that page load — e.g. `ENV: PROD · a1b2c3d · LINUX · 18ms (e621: 4ms)`. Followed by the user avatar. - **Global Footer Status Strip (`#11111b`, height: 32px):** - The strip placement is a proposal; its values are real and drawn from the existing stats data. - - Left: the watched folder path — `📁 Local Storage: /mnt/media/library`. + - Left: the watched folder path — `📁 Local Storage: /mnt/media/library`. This is the only place the path appears (J621 is folder-based; it is just a path on disk, not a NAS/appliance indicator). - Center: `⚡ Active Workers: N running | Queue: M pending` — the count of active optimization/ingest jobs and queued downloads (the original app surfaced this on its stats page; the footer simply keeps it visible). - Right: the running build — ` @ ` (e.g. `dev @ 3f35330`), matching the original app. - **Collapsible Sidebar (Behavior):** diff --git a/frontend/src/components/AppShell.tsx b/frontend/src/components/AppShell.tsx index 0536121..1db3aba 100644 --- a/frontend/src/components/AppShell.tsx +++ b/frontend/src/components/AppShell.tsx @@ -53,15 +53,6 @@ export function AppShell() { - {status ? ( - - {status.watched_folder} - - ) : null} - {showSidebarToggle ? (