Fix web UI white screen: restore send_P with strict cache-busting headers
Made-with: Cursor
This commit is contained in:
20
src/main.cpp
20
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() {
|
||||
|
||||
Reference in New Issue
Block a user