diff --git a/api/index.php b/api/index.php index 120d4a7..46e018a 100644 --- a/api/index.php +++ b/api/index.php @@ -2077,6 +2077,7 @@ function getServerSettings(): void { 'scale_enabled' => env('SCALE_ENABLED', 'false') === 'true', 'scale_gateway_url' => env('SCALE_GATEWAY_URL', ''), 'meal_plan_enabled' => env('MEAL_PLAN_ENABLED', 'false') === 'true', + 'screensaver_enabled' => env('SCREENSAVER_ENABLED', 'false') === 'true', ]); } @@ -2122,6 +2123,7 @@ function saveSettings(): void { 'pref_zerowaste' => 'PREF_ZEROWASTE', 'scale_enabled' => 'SCALE_ENABLED', 'meal_plan_enabled' => 'MEAL_PLAN_ENABLED', + 'screensaver_enabled' => 'SCREENSAVER_ENABLED', ]; // Integer keys $intMap = [ diff --git a/assets/js/app.js b/assets/js/app.js index 9ddbb69..027af84 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -1855,7 +1855,8 @@ async function syncSettingsFromDB() { 'pref_healthy','pref_opened','pref_zerowaste','dietary','appliances', 'camera_facing','scale_enabled','scale_gateway_url', 'meal_plan_enabled','tts_enabled','tts_url','tts_token', - 'tts_method','tts_auth_type','tts_content_type','tts_payload_key']; + 'tts_method','tts_auth_type','tts_content_type','tts_payload_key', + 'screensaver_enabled']; for (const key of serverKeys) { if (serverSettings[key] !== undefined && serverSettings[key] !== null && serverSettings[key] !== '') { s[key] = serverSettings[key]; @@ -2193,9 +2194,9 @@ async function saveSettings() { const settingsToken = document.getElementById('setting-settings-token')?.value.trim() || ''; const tokenHeader = settingsToken ? { 'X-Settings-Token': settingsToken } : {}; const result = await api('save_settings', {}, 'POST', { - gemini_key: s.gemini_key, + ...(s.gemini_key ? { gemini_key: s.gemini_key } : {}), bring_email: s.bring_email, - bring_password: s.bring_password, + ...(s.bring_password ? { bring_password: s.bring_password } : {}), default_persons: s.default_persons, pref_veloce: s.pref_veloce, pref_pocafame: s.pref_pocafame, @@ -2209,6 +2210,7 @@ async function saveSettings() { scale_enabled: s.scale_enabled, scale_gateway_url: s.scale_gateway_url, meal_plan_enabled: s.meal_plan_enabled, + screensaver_enabled: s.screensaver_enabled, tts_enabled: s.tts_enabled, tts_url: s.tts_url, tts_token: s.tts_token, @@ -12179,9 +12181,9 @@ async function _initApp() { } syncSettingsFromDB().then(() => { scaleInit(); // connect to smart scale gateway if configured (needs settings) + initInactivityWatcher(); }); showPage('dashboard'); - initInactivityWatcher(); initSpesaMode(); initScreensaverShortcuts(); startBgShoppingRefresh();