Spaces:
Configuration error
Configuration error
fix: wrap localStorage access for iframe environments and resolve footer mojibake
Browse files1328 unmodified lines132913301331133213331334133513361337133813391340134113421343134428 unmodified lines13731374137513761377137813791380138113822146 unmodified lines352935303531353235333534353535363537353815 unmodified lines355435553556355735583559356018 unmodified lines35793580358135823583358435851328 unmodified lines</div><footer id="viewer-footer" class="viewer-footer"><span>agentmemory viewer · <span id="footer-version">loading...</span></span><span class="footer-sep">·</span><a href="https://github.com/rohitg00/agentmemory" target="_blank" rel="noopener">github</a><span class="footer-sep">·</span><a href="https://github.com/rohitg00/agentmemory#readme" target="_blank" rel="noopener">docs</a><span class="footer-sep">·</span><a id="footer-feedback" href="#" target="_blank" rel="noopener">report issue →</a></footer><script nonce="__AGENTMEMORY_VIEWER_NONCE__">var params = new URLSearchParams(window.location.search);var paramPort = params.get('port');var locPort = window.location.port;28 unmodified linesdocument.documentElement.dataset.theme = dark ? 'dark' : 'light';var btn = document.getElementById('theme-toggle');if (btn) btn.textContent = dark ? 'LIGHT' : 'DARK';if (persist) localStorage.setItem('agentmemory-theme', dark ? 'dark' : 'light');}window.toggleTheme = function() { applyTheme(!isDarkMode(), true); };var savedTheme = localStorage.getItem('agentmemory-theme');if (savedTheme) {applyTheme(savedTheme === 'dark', false);} else if (window.matchMedia('(prefers-color-scheme: dark)').matches) {2146 unmodified lines}// ==========================================================================// B4 — Onboarding card (empty state detection)// ==========================================================================function maybeShowOnboarding(health, flags) {if (localStorage.getItem('agentmemory_onboarding_dismissed')) return;if ((health.observationCount || 0) > 0 || (health.memoryCount || 0) > 0) return;var el = document.getElementById('view-folders');if (!el) return;15 unmodified lines}var secretSet = false; // AGENTMEMORY_SECRET status not exposed by flags endpointvar geminiSet = !!(cfg && cfg.embeddingProvider && cfg.embeddingProvider !== 'none');var card = document.createElement('div');card.className = 'onboarding-card';18 unmodified lines});});card.querySelector('.onboarding-dismiss').addEventListener('click', function() {localStorage.setItem('agentmemory_onboarding_dismissed', '1');card.remove();});1328 unmodified lines132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135628 unmodified lines13851386138713881389139013911392139313942146 unmodified lines354135423543354435453546354735483549355015 unmodified lines356635673568356935703571357218 unmodified lines35913592359335943595359635971328 unmodified lines</div><footer id="viewer-footer" class="viewer-footer"><span>agentmemory viewer · <span id="footer-version">loading...</span></span><span class="footer-sep">·</span><a href="https://github.com/rohitg00/agentmemory" target="_blank" rel="noopener">github</a><span class="footer-sep">·</span><a href="https://github.com/rohitg00/agentmemory#readme" target="_blank" rel="noopener">docs</a><span class="footer-sep">·</span><a id="footer-feedback" href="#" target="_blank" rel="noopener">report issue →</a></footer><script nonce="__AGENTMEMORY_VIEWER_NONCE__">var safeStorage = {_mem: {},getItem: function(key) {try { return localStorage.getItem(key); } catch (_) { return this._mem[key] || null; }},setItem: function(key, val) {try { localStorage.setItem(key, val); } catch (_) { this._mem[key] = String(val); }},removeItem: function(key) {try { localStorage.removeItem(key); } catch (_) { delete this._mem[key]; }}};var params = new URLSearchParams(window.location.search);var paramPort = params.get('port');var locPort = window.location.port;28 unmodified linesdocument.documentElement.dataset.theme = dark ? 'dark' : 'light';var btn = document.getElementById('theme-toggle');if (btn) btn.textContent = dark ? 'LIGHT' : 'DARK';if (persist) safeStorage.setItem('agentmemory-theme', dark ? 'dark' : 'light');}window.toggleTheme = function() { applyTheme(!isDarkMode(), true); };var savedTheme = safeStorage.getItem('agentmemory-theme');if (savedTheme) {applyTheme(savedTheme === 'dark', false);} else if (window.matchMedia('(prefers-color-scheme: dark)').matches) {2146 unmodified lines}// ==========================================================================// B4 -- Onboarding card (empty state detection)// ==========================================================================function maybeShowOnboarding(health, flags) {if (safeStorage.getItem('agentmemory_onboarding_dismissed')) return;if ((health.observationCount || 0) > 0 || (health.memoryCount || 0) > 0) return;var el = document.getElementById('view-folders');if (!el) return;15 unmodified lines}var secretSet = false; // AGENTMEMORY_SECRET status not exposed by flags endpointvar geminiSet = !!(flags && flags.embeddingProvider && flags.embeddingProvider !== 'none');var card = document.createElement('div');card.className = 'onboarding-card';18 unmodified lines});});card.querySelector('.onboarding-dismiss').addEventListener('click', function() {safeStorage.setItem('agentmemory_onboarding_dismissed', '1');card.remove();});
src/viewer/index.html+22-10