diff --git a/README.md b/README.md index e945bba..668f8cc 100644 --- a/README.md +++ b/README.md @@ -210,8 +210,10 @@ Per-display option: Implementation notes: -- Headlines are fetched server-side via `GET /api/display//ticker` and cached briefly. -- The player reads the company ticker settings via `GET /api/display//playlist` and refreshes headlines periodically. +- Headlines are fetched server-side via `GET /api/display//ticker` and cached in-memory. +- The player reads the company ticker settings via `GET /api/display//playlist`. +- The player auto-refreshes headlines without restart on a **long interval** (default: **12 hours**, override via `?ticker_poll=seconds`). +- Server-side cache TTL defaults to **6 hours** (override via env var `TICKER_CACHE_TTL_SECONDS`). ## SMTP / Forgot password @@ -290,5 +292,6 @@ If the reset email is not received: + diff --git a/app/routes/api.py b/app/routes/api.py index ca04a1d..faea6a7 100644 --- a/app/routes/api.py +++ b/app/routes/api.py @@ -1,6 +1,7 @@ from datetime import datetime, timedelta import hashlib import json +import os import time import re from urllib.parse import urlparse @@ -20,7 +21,18 @@ MAX_ACTIVE_SESSIONS_PER_DISPLAY = 3 SESSION_TTL_SECONDS = 90 # RSS ticker cache (in-memory; OK for this small app; avoids hammering feeds) -TICKER_CACHE_TTL_SECONDS = 120 +# +# Default is intentionally long because displays can refresh headlines on a long interval +# (e.g., twice per day) and we don't want many displays to re-fetch the same feed. +# Override via env var `TICKER_CACHE_TTL_SECONDS`. +def _env_int(name: str, default: int) -> int: + try: + return int(os.environ.get(name, "") or default) + except (TypeError, ValueError): + return default + + +TICKER_CACHE_TTL_SECONDS = max(10, _env_int("TICKER_CACHE_TTL_SECONDS", 6 * 60 * 60)) _TICKER_CACHE: dict[str, dict] = {} diff --git a/app/static/styles.css b/app/static/styles.css index e713e1c..6d708cc 100644 --- a/app/static/styles.css +++ b/app/static/styles.css @@ -280,6 +280,13 @@ h1, h2, h3, .display-1, .display-2, .display-3 { background: #000; } +/* Mobile: dashboard display previews are heavy (iframes). Hide them on small screens. */ +@media (max-width: 768px) { + .display-gallery-card .display-preview { + display: none; + } +} + @media (max-width: 768px) { .display-gallery-grid { grid-template-columns: 1fr; diff --git a/app/templates/company/dashboard.html b/app/templates/company/dashboard.html index 574423a..1c24715 100644 --- a/app/templates/company/dashboard.html +++ b/app/templates/company/dashboard.html @@ -76,7 +76,8 @@