From 7133088e8a15007b514d105870ea8b3b9dc69e20 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Wed, 3 Jun 2026 00:17:02 +0000 Subject: feat: synchronize background image rotation across sessions Server seeds bg URL from a 5-minute time bucket so all open sessions show the same image simultaneously. Client-side JS rotates in sync and prefetches the next image on the same interval. Co-Authored-By: Claude Sonnet 4.6 --- internal/handlers/handlers.go | 5 ++--- web/templates/index.html | 17 +++++++++++++++++ web/templates/login.html | 3 +-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index bd14e65..19d26be 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -92,9 +92,8 @@ func (h *Handler) HandleDashboard(w http.ResponseWriter, r *http.Request) { return } - // Generate random background URL (Lorem Picsum - CORS-friendly) - // Add random seed to get different image each load - backgroundURL := fmt.Sprintf("https://picsum.photos/1920/1080?random=%d", time.Now().UnixNano()) + // Background URL: seed from 5-minute time bucket so all sites show the same image simultaneously + backgroundURL := fmt.Sprintf("https://picsum.photos/1920/1080?random=%d", time.Now().Unix()/300) // Wrap dashboard data with active tab for template data := struct { diff --git a/web/templates/index.html b/web/templates/index.html index 465e612..8351804 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -24,9 +24,26 @@ .bg-modal { background-color: var(--modal-bg); } .bg-modal-overlay { background-color: var(--modal-overlay); } + +
diff --git a/web/templates/login.html b/web/templates/login.html index 19bce00..7ff27ca 100644 --- a/web/templates/login.html +++ b/web/templates/login.html @@ -10,8 +10,7 @@ .text-shadow-sm { text-shadow: 0 1px 2px rgba(0,0,0,0.5); } - -
+

Personal Dashboard

-- cgit v1.2.3