diff --git a/configuration/homeScreen-configuration.js b/configuration/homeScreen-configuration.js index f9a9f65..3da2490 100644 --- a/configuration/homeScreen-configuration.js +++ b/configuration/homeScreen-configuration.js @@ -1530,6 +1530,12 @@ window.KefinTweaksConfig = ${JSON.stringify(configToBackup, null, 2)};`; * Get enabled home sections and discovery sections * @returns {Object} Object with enabledHomeSections and enabledDiscoverySections */ + function applyGlobalCacheTtlToSections(sections, globalCacheTtl) { + if (!(Number(globalCacheTtl) >= 0) || !Array.isArray(sections)) return sections; + const ttl = Number(globalCacheTtl); + return sections.map((section) => (section ? { ...section, ttl } : section)); + } + function getSections() { const config = getConfig(); @@ -1543,10 +1549,19 @@ window.KefinTweaksConfig = ${JSON.stringify(configToBackup, null, 2)};`; isInSeasonalPeriod }); + const globalCacheTtl = config.CACHE?.globalCacheTtl; + const home = applyGlobalCacheTtlToSections( + [...enabledHomeSections, ...enabledSeasonalSections, ...enabledCustomSections], + globalCacheTtl + ); + const discovery = applyGlobalCacheTtlToSections( + [...enabledDiscoverySections, ...enabledCustomDiscoverySections], + globalCacheTtl + ); return { - enabledHomeSections: [...enabledHomeSections, ...enabledSeasonalSections, ...enabledCustomSections], - enabledDiscoverySections: [...enabledDiscoverySections, ...enabledCustomDiscoverySections] + enabledHomeSections: home, + enabledDiscoverySections: discovery } } @@ -2105,12 +2120,16 @@ window.KefinTweaksConfig = ${JSON.stringify(configToBackup, null, 2)};`; /** * Build compact section row HTML */ - function buildSectionRowHTML(section, type = 'home', groupName = null) { + function buildSectionRowHTML(section, type = 'home') { const isEnabled = section.enabled !== false; const isSeasonal = section.startDate && section.endDate; const isSpotlight = section.renderMode === 'Spotlight'; const isDiscovery = section.discoveryEnabled === true; const isCustom = type.toLowerCase() === 'custom' || section.id.startsWith('custom'); + const descriptionText = String(section.description || '').trim(); + const descriptionHtml = descriptionText + ? `${escapeHtml(descriptionText)}` + : ''; return `
Every Home Screen Section has a cache expiration time associated to it. If the section has no explicitly defined cache value, it will use the Default setting below.
When a Section is being loaded, if the cache has not expired, the cached items will be rendered instead of requesting new data. If a Section has "No Cache" set, it will always request new data from the server.
The Cache settings listed below will appear as options when creating or editing a Home Screen Section in the "Advanced Options" at the bottom of the editor.
+Global Cache: when set (not Disabled), individual section cache timers are ignored and every section uses this value.