From 7e3a0f5d8f6f7195a6a42949dc3c4ebbbcc5d751 Mon Sep 17 00:00:00 2001 From: logicog Date: Mon, 16 Mar 2026 17:32:15 +0100 Subject: [PATCH 1/2] Allow javascript to modify svg styles for Firefox version >140 --- httpd/httpd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpd/httpd.c b/httpd/httpd.c index 6649b36..38f2ec1 100644 --- a/httpd/httpd.c +++ b/httpd/httpd.c @@ -630,7 +630,7 @@ void httpd_appcall(void) slen = strtox(outbuf, "HTTP/1.1 200 OK\r\nContent-Type: "); slen += strtox(outbuf + slen, mime_strings[f_data[entry].mime]); - slen += strtox(outbuf + slen, "; charset=UTF-8\r\nCache-Control: max-age=60, must-revalidate\r\nAccess-Control-Allow-Origin: *\r\n\r\n"); + slen += strtox(outbuf + slen, "; charset=UTF-8\r\nCache-Control: max-age=60, must-revalidate\r\nAccess-Control-Allow-Origin: *\r\nContent-Security-Policy: style-src 'self' 'unsafe-inline'\r\n\r\n"); len_left = f_data[entry].len; if (len_left > (TCP_OUTBUF_SIZE - slen)) { From 090283d538358e81c0b14f926270d6e419933a88 Mon Sep 17 00:00:00 2001 From: logicog Date: Mon, 16 Mar 2026 17:32:50 +0100 Subject: [PATCH 2/2] Add retry mechanism for xhttp requests to make Chrome happy --- html/main.js | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/html/main.js b/html/main.js index 085db57..2f256ee 100644 --- a/html/main.js +++ b/html/main.js @@ -70,6 +70,8 @@ function update(callback) { continue; var bgs = psvg.contentDocument.getElementsByClassName("bg"); var leds = psvg.contentDocument.getElementsByClassName("led"); + if (leds[0] == null || leds[0].style == null) + continue; if (p.enabled == 0) { pState[n] = -1; bgs[0].style.fill = "red"; @@ -127,9 +129,25 @@ function callbackXHTTP() x = currentRequests[0]; currentCallback = x.onreadystatechange; x.onreadystatechange = callbackXHTTP; - setTimeout(() => { - x.send(); - }, 20); + var retries = 10; + while (retries) { + try { + setTimeout(() => { + x.send(); + console.log("B1"); + }, 20); + } catch (error) { + retries--; + setTimeout(() => { + console.log(`Retry ${retries}/${maxRetries} failed: ${error.message}`); + }, 200); + if (retries < 1) { + throw error; + } + } + console.log("B2"); + return; + } } function sendXHTTP(x) @@ -139,7 +157,24 @@ function sendXHTTP(x) currentRequests.push(x); currentCallback = x.onreadystatechange; x.onreadystatechange = callbackXHTTP; - x.send(); + var retries = 10; + while (retries) { + try { + x.send(); + console.log("A1"); + } catch (error) { + retries--; + setTimeout(() => { + console.log(`Retry ${retries}/${maxRetries} failed: ${error.message}`); + }, 200); + if (retries < 1) { + throw error; + } + } + console.log("A2"); + return; + } + console.log("A3"); return; } currentRequests.push(x);