From 8cc5da52dc2bbbb4e2669be455a72249acea995e Mon Sep 17 00:00:00 2001 From: drjones Date: Fri, 3 Apr 2026 09:49:00 -0700 Subject: [PATCH] Fix web UI white screen: restore send_P with strict cache-busting headers Made-with: Cursor --- src/main.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 56e7d23..7a5b944 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2240,18 +2240,14 @@ window.addEventListener('resize',capDrawWave); )HTML"; static void handleRoot() { - server.setContentLength(CONTENT_LENGTH_UNKNOWN); - server.send(200, "text/html; charset=utf-8", ""); - const size_t total = sizeof(kHtml) - 1; - size_t off = 0; - while (off < total) { - size_t n = total - off; - if (n > 512) n = 512; - server.sendContent_P(kHtml + off, n); - off += n; - yield(); - } - server.sendContent(""); + // Prevent browser caching so it always fetches the full page + server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); + server.sendHeader("Pragma", "no-cache"); + server.sendHeader("Expires", "0"); + + // Send directly from flash. WebServer::send_P handles Content-Length and TCP chunking + // internally without allocating a 15 KB String on the heap. + server.send_P(200, "text/html; charset=utf-8", kHtml, sizeof(kHtml) - 1); } static void handleLog() {