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";
|
)HTML";
|
||||||
|
|
||||||
static void handleRoot() {
|
static void handleRoot() {
|
||||||
server.setContentLength(CONTENT_LENGTH_UNKNOWN);
|
// Prevent browser caching so it always fetches the full page
|
||||||
server.send(200, "text/html; charset=utf-8", "");
|
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||||
const size_t total = sizeof(kHtml) - 1;
|
server.sendHeader("Pragma", "no-cache");
|
||||||
size_t off = 0;
|
server.sendHeader("Expires", "0");
|
||||||
while (off < total) {
|
|
||||||
size_t n = total - off;
|
// Send directly from flash. WebServer::send_P handles Content-Length and TCP chunking
|
||||||
if (n > 512) n = 512;
|
// internally without allocating a 15 KB String on the heap.
|
||||||
server.sendContent_P(kHtml + off, n);
|
server.send_P(200, "text/html; charset=utf-8", kHtml, sizeof(kHtml) - 1);
|
||||||
off += n;
|
|
||||||
yield();
|
|
||||||
}
|
|
||||||
server.sendContent("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handleLog() {
|
static void handleLog() {
|
||||||
|
|||||||
Reference in New Issue
Block a user