Files
J621/backend/apps/core/middleware.py
T
JakeBreath 3aa42f3703 Shell polish: storage line, status pill, footer strip, sidebar
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
2026-09-17 08:19:27 -05:00

20 lines
605 B
Python

import time
class TimingMiddleware:
"""Record server-side request time, mirroring the original app.
Sets ``request.start_time`` before the view runs so views can report
elapsed time, and exposes the total duration as a response header.
"""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
started = time.perf_counter()
request.start_time = started
response = self.get_response(request)
response["X-Server-Time-Ms"] = f"{(time.perf_counter() - started) * 1000:.1f}"
return response