优化白色主题渲染逻辑
This commit is contained in:
@@ -128,12 +128,24 @@
|
||||
// Start data fetching
|
||||
fetchMetrics();
|
||||
fetchNetworkHistory();
|
||||
|
||||
// Site settings
|
||||
if (window.SITE_SETTINGS) {
|
||||
applySiteSettings(window.SITE_SETTINGS);
|
||||
// Actual theme class already applied in head, just update icons and inputs
|
||||
const savedTheme = localStorage.getItem('theme');
|
||||
const currentTheme = savedTheme || window.SITE_SETTINGS.default_theme || 'dark';
|
||||
updateThemeIcons(currentTheme);
|
||||
|
||||
// Still populate inputs
|
||||
dom.pageNameInput.value = window.SITE_SETTINGS.page_name || '';
|
||||
dom.siteTitleInput.value = window.SITE_SETTINGS.title || '';
|
||||
dom.logoUrlInput.value = window.SITE_SETTINGS.logo_url || '';
|
||||
dom.defaultThemeInput.value = window.SITE_SETTINGS.default_theme || 'dark';
|
||||
}
|
||||
|
||||
loadSiteSettings();
|
||||
|
||||
// Initial icon check based on early head script
|
||||
const currentTheme = document.documentElement.classList.contains('light-theme') ? 'light' : 'dark';
|
||||
updateThemeIcons(currentTheme);
|
||||
|
||||
setInterval(fetchMetrics, REFRESH_INTERVAL);
|
||||
setInterval(fetchNetworkHistory, NETWORK_HISTORY_INTERVAL);
|
||||
}
|
||||
@@ -444,6 +456,8 @@
|
||||
const response = await fetch('/api/settings');
|
||||
const settings = await response.json();
|
||||
|
||||
window.SITE_SETTINGS = settings; // Cache it globally
|
||||
|
||||
// Update inputs
|
||||
dom.pageNameInput.value = settings.page_name || '';
|
||||
dom.siteTitleInput.value = settings.title || '';
|
||||
|
||||
Reference in New Issue
Block a user