From d8718994516d3abe71315ecaed00efd53188384d Mon Sep 17 00:00:00 2001 From: dev Date: Sun, 28 Jun 2026 21:50:21 +0200 Subject: [PATCH] Apply saved appearance on app startup --- webui/static/init.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/webui/static/init.js b/webui/static/init.js index aea68fab..aec092d7 100644 --- a/webui/static/init.js +++ b/webui/static/init.js @@ -274,6 +274,34 @@ function applyReduceEffects(enabled) { } })(); +async function bootstrapServerAppearanceSettings() { + try { + const response = await fetch('/api/settings', { credentials: 'same-origin' }); + const settings = await response.json(); + if (!response.ok || !settings || typeof settings !== 'object' || settings.error) return; + + const appearance = settings.ui_appearance || {}; + const preset = appearance.accent_preset || '#1db954'; + const custom = appearance.accent_color || '#1db954'; + const accent = preset === 'custom' ? custom : preset; + applyAccentColor(accent); + + if (Object.prototype.hasOwnProperty.call(appearance, 'particles_enabled')) { + applyParticlesSetting(appearance.particles_enabled !== false); + } + if (Object.prototype.hasOwnProperty.call(appearance, 'worker_orbs_enabled')) { + applyWorkerOrbsSetting(appearance.worker_orbs_enabled !== false); + } + if (localStorage.getItem('soulsync-reduce-effects') === null) { + applyReduceEffects(appearance.reduce_effects === true); + } + } catch (error) { + console.warn('Could not bootstrap appearance settings:', error); + } +} + +bootstrapServerAppearanceSettings(); + // ── Profile System ───────────────────────────────────────────── let currentProfile = null; const PROFILE_CONTEXT_CHANGED_EVENT = 'ss:webui-profile-context-changed';