Show next scheduled sync time on every page
Exposes the scheduler's next_tick in the topbar via a safe Jinja helper (falls back to nothing if the scheduler isn't running yet), and converts the server-rendered UTC timestamp to the visitor's local time client-side so it reads correctly regardless of timezone. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,14 @@ router = APIRouter()
|
||||
templates = Jinja2Templates(directory=str(Path(__file__).resolve().parent / "templates"))
|
||||
|
||||
|
||||
def _next_sync_tick(request: Request):
|
||||
scheduler = getattr(request.app.state, "scheduler", None)
|
||||
return getattr(scheduler, "next_tick", None)
|
||||
|
||||
|
||||
templates.env.globals["next_sync_tick"] = _next_sync_tick
|
||||
|
||||
|
||||
def _get_user_or_404(repository: UserRepository, user_id: int) -> SyncUser:
|
||||
user = repository.get(user_id)
|
||||
if user is None:
|
||||
|
||||
Reference in New Issue
Block a user