From 663f4938176d0aee6f1133b5d5b7ff2c51842bf0 Mon Sep 17 00:00:00 2001 From: Jared Dohrman Date: Sat, 18 Apr 2026 11:17:49 +1000 Subject: [PATCH] web: cache repeater title across app and stats pages --- src/helpers/web/WebPanelServer.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/helpers/web/WebPanelServer.cpp b/src/helpers/web/WebPanelServer.cpp index 74e94865..9ee20e4e 100644 --- a/src/helpers/web/WebPanelServer.cpp +++ b/src/helpers/web/WebPanelServer.cpp @@ -994,6 +994,7 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML( const RADIO_PRESETS_URL = "https://api.meshcore.nz/api/v1/config"; const isStatsPage = window.location.pathname === "/stats"; const LAST_PAGE_KEY = "repeater-last-page"; + const PANEL_TITLE_KEY = "repeater-panel-title"; let token = sessionStorage.getItem("repeater-token") || ""; let commandQueue = Promise.resolve(); let radioPresetEntries = []; @@ -1005,7 +1006,19 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML( function updatePanelTitle(nameValue) { const fallbackTitle = "Repeater Config"; const trimmedName = String(nameValue == null ? "" : nameValue).trim(); - document.title = trimmedName ? trimmedName : fallbackTitle; + const nextTitle = trimmedName ? trimmedName : fallbackTitle; + document.title = nextTitle; + if (trimmedName) { + localStorage.setItem(PANEL_TITLE_KEY, trimmedName); + } else { + localStorage.removeItem(PANEL_TITLE_KEY); + } + } + function applyCachedPanelTitle() { + const cachedTitle = localStorage.getItem(PANEL_TITLE_KEY); + if (cachedTitle && cachedTitle.trim()) { + document.title = cachedTitle.trim(); + } } function rememberCurrentPage() { localStorage.setItem(LAST_PAGE_KEY, isStatsPage ? "/stats" : "/app"); @@ -1017,6 +1030,7 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML( window.location.replace("/"); } rememberCurrentPage(); + applyCachedPanelTitle(); function getPreferredTheme() { const saved = localStorage.getItem("repeater-theme"); if (saved === "light" || saved === "dark") return saved;