修复保存后前端卡死的问题

This commit is contained in:
CN-JS-HuiBai
2026-04-06 18:02:53 +08:00
parent da722ee07e
commit 2024523b46

View File

@@ -1682,9 +1682,6 @@
if (dom.faviconUrlInput) dom.faviconUrlInput.value = settings.favicon_url || '';
if (dom.showPageNameInput) dom.showPageNameInput.value = settings.show_page_name !== undefined ? settings.show_page_name.toString() : "1";
// Apply to UI
applySiteSettings(settings);
// Handle Theme Priority: localStorage > Site Default
const savedTheme = localStorage.getItem('theme');
const themeToApply = savedTheme || settings.default_theme || 'dark';
@@ -1773,11 +1770,6 @@
// Default Theme
if (settings.default_theme) {
if (dom.defaultThemeInput) dom.defaultThemeInput.value = settings.default_theme;
// If setting is 'auto', we also sync immediately
const savedTheme = localStorage.getItem('theme');
if (!savedTheme || savedTheme === 'auto') {
applyTheme(settings.default_theme);
}
}
// Filing info
@@ -1843,7 +1835,9 @@
showSiteMessage('设置保存成功', 'success');
// Update global object and UI immediately
window.SITE_SETTINGS = { ...window.SITE_SETTINGS, ...settings };
applySiteSettings(window.SITE_SETTINGS);
const savedTheme = localStorage.getItem('theme');
const themeToApply = savedTheme || settings.default_theme || 'dark';
applyTheme(themeToApply);
} else {
const err = await response.json();
showSiteMessage(`保存失败: ${err.error || '未知错误'}`, 'error');