mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-08-28 03:44:13 +00:00
Fix: initState merges localStorage → export includes saved changes
State now loads: DEFAULTS → server config → localStorage. Admin saves locally, comes back later, opens customizer — sees their saved values, export includes everything.
This commit is contained in:
+13
-10
@@ -189,18 +189,21 @@
|
||||
|
||||
function initState() {
|
||||
const cfg = window.SITE_CONFIG || {};
|
||||
// Merge: DEFAULTS → server config → localStorage saved values
|
||||
var local = {};
|
||||
try { var s = localStorage.getItem('meshcore-user-theme'); if (s) local = JSON.parse(s); } catch {}
|
||||
state = {
|
||||
branding: Object.assign({}, DEFAULTS.branding, cfg.branding || {}),
|
||||
theme: Object.assign({}, DEFAULTS.theme, cfg.theme || {}),
|
||||
themeDark: Object.assign({}, DEFAULTS.themeDark, cfg.themeDark || {}),
|
||||
nodeColors: Object.assign({}, DEFAULTS.nodeColors, cfg.nodeColors || {}),
|
||||
typeColors: Object.assign({}, DEFAULTS.typeColors, cfg.typeColors || {}),
|
||||
branding: Object.assign({}, DEFAULTS.branding, cfg.branding || {}, local.branding || {}),
|
||||
theme: Object.assign({}, DEFAULTS.theme, cfg.theme || {}, local.theme || {}),
|
||||
themeDark: Object.assign({}, DEFAULTS.themeDark, cfg.themeDark || {}, local.themeDark || {}),
|
||||
nodeColors: Object.assign({}, DEFAULTS.nodeColors, cfg.nodeColors || {}, local.nodeColors || {}),
|
||||
typeColors: Object.assign({}, DEFAULTS.typeColors, cfg.typeColors || {}, local.typeColors || {}),
|
||||
home: {
|
||||
heroTitle: (cfg.home && cfg.home.heroTitle) || DEFAULTS.home.heroTitle,
|
||||
heroSubtitle: (cfg.home && cfg.home.heroSubtitle) || DEFAULTS.home.heroSubtitle,
|
||||
steps: deepClone((cfg.home && cfg.home.steps) || DEFAULTS.home.steps),
|
||||
checklist: deepClone((cfg.home && cfg.home.checklist) || DEFAULTS.home.checklist),
|
||||
footerLinks: deepClone((cfg.home && cfg.home.footerLinks) || DEFAULTS.home.footerLinks)
|
||||
heroTitle: (local.home && local.home.heroTitle) || (cfg.home && cfg.home.heroTitle) || DEFAULTS.home.heroTitle,
|
||||
heroSubtitle: (local.home && local.home.heroSubtitle) || (cfg.home && cfg.home.heroSubtitle) || DEFAULTS.home.heroSubtitle,
|
||||
steps: deepClone((local.home && local.home.steps) || (cfg.home && cfg.home.steps) || DEFAULTS.home.steps),
|
||||
checklist: deepClone((local.home && local.home.checklist) || (cfg.home && cfg.home.checklist) || DEFAULTS.home.checklist),
|
||||
footerLinks: deepClone((local.home && local.home.footerLinks) || (cfg.home && cfg.home.footerLinks) || DEFAULTS.home.footerLinks)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+1
-1
@@ -101,6 +101,6 @@
|
||||
<script src="observer-detail.js?v=1774219440" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="node-analytics.js?v=1774126708" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="perf.js?v=1773985649" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="customize.js?v=1774234563" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
<script src="customize.js?v=1774234619" onerror="console.error('Failed to load:', this.src)"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user