From dc4d157944dfff170e8927563522cebc61077b62 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Sun, 24 May 2026 22:01:21 -0700 Subject: [PATCH] Fix Auto-Sync next-run countdown and theme its modal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Playlist Auto-Sync schedule board was showing "next in 8h" on every card regardless of the configured interval. Root cause: backend stores next_run as a naive UTC string ("2026-05-25 05:00:00") and the new auto-sync renderer was parsing it with plain `new Date(...)`, which treats unmarked timestamps as local time. On Pacific time that offsets the displayed countdown by ~8 hours. Auto-Sync now routes through the existing `_autoParseUTC` helper that the rest of the Automations page already uses, so countdowns line up with the wall clock. A separate correctness fix in the automation update API: when a PUT changes `trigger_type` or `trigger_config`, the stored `next_run` is now blanked before the engine reschedules. Previously the scheduler's restart-survival path would preserve a stale future timestamp from the prior interval, so dragging a playlist from the 8h column to the 1h column kept firing at the old 8h mark. Boot-time restart behavior is unchanged — only user-driven schedule changes reset the clock. Modal restyle: the Auto-Sync manager's hardcoded sky-blue palette is replaced with `var(--accent-rgb)` everywhere so the modal honors the user's chosen accent color. Tinted glow on the modal border, tabbed header active state, scheduled-playlist chips, scrollbars, and a new drag-over highlight on columns all follow the accent theme. The column drag-over state is wired through new ondragleave handling so the highlight clears reliably when leaving a column. --- core/automation/api.py | 7 ++++ webui/static/helper.js | 5 +++ webui/static/stats-automations.js | 17 +++++++- webui/static/style.css | 69 ++++++++++++++++++++++--------- 4 files changed, 76 insertions(+), 22 deletions(-) diff --git a/core/automation/api.py b/core/automation/api.py index a6f78afe..a99e08ce 100644 --- a/core/automation/api.py +++ b/core/automation/api.py @@ -225,6 +225,13 @@ def update_automation( if cycle_path: return {'error': f'Signal cycle detected: {cycle_path}. This would cause an infinite loop.'}, 400 + trigger_changed = ( + 'trigger_type' in update_fields + or 'trigger_config' in update_fields + ) + if trigger_changed: + update_fields['next_run'] = None + success = database.update_automation(automation_id, **update_fields) if not success: return {'error': 'Automation not found'}, 404 diff --git a/webui/static/helper.js b/webui/static/helper.js index 3f9568f6..1e304a8b 100644 --- a/webui/static/helper.js +++ b/webui/static/helper.js @@ -3413,6 +3413,11 @@ function closeHelperSearch() { // projects that span multiple commits before shipping. Strip the flag at // release time and add a real `date:` line at the top of the version block. const WHATS_NEW = { + '2.6.2': [ + { date: 'May 24, 2026 — 2.6.2 release' }, + { title: 'Fix: Auto-Sync "next in 8h" timezone bug', desc: 'scheduled Auto-Sync playlists were all showing "next in 8h" regardless of the interval — Every 1 hour, Every 1 day, anything. backend stores next-run as a naive UTC string and the frontend was parsing it as local time, which on Pacific time offset the displayed countdown by ~8 hours. Auto-Sync now uses the existing UTC-aware parser the rest of the Automations page already uses. as a separate correctness fix, the automation update endpoint also now blanks the stored next-run whenever the trigger type or trigger config changes, so the engine recomputes from scratch instead of preserving a leftover timestamp from the previous schedule.' }, + { title: 'Auto-Sync modal restyled to your accent color', desc: 'the Playlist Auto-Sync manager now picks up your chosen accent (the same one used everywhere else in the app) instead of the hardcoded sky-blue palette it shipped with. tabs, drop zones, scheduled-playlist chips, scrollbars, and the modal glow all follow the accent theme. drop targets also light up clearly while dragging.' }, + ], '2.6.1': [ { date: 'May 24, 2026 — 2.6.1 release' }, { title: 'React Import page polish', desc: 'Import now runs through the React route stack with album, singles, and auto-import tabs plus the state fixes needed for reliable Vite builds.' }, diff --git a/webui/static/stats-automations.js b/webui/static/stats-automations.js index 25bc01ce..fa22d51b 100644 --- a/webui/static/stats-automations.js +++ b/webui/static/stats-automations.js @@ -818,7 +818,7 @@ function renderAutoSyncSchedulePanel(playlists, playlistSchedules) { const bucketHtml = AUTO_SYNC_BUCKETS.map(hours => { const assigned = schedulablePlaylists.filter(p => playlistSchedules[p.id]?.hours === hours); return ` -