Merge PR #13 with gzip-only WebConfig assets
Keep the graceful final-ACK TCP close and optional FEM control guards from pixitha's browser compatibility fixes. Replace Brotli negotiation and duplicate page assets with one gzip representation compressed by Google Zopfli 0.4.3 using 1,000 iterations. Compress the bootstrap, captive success, compact OTA, and static WiFi setup pages with the same validated build cache. Honor gzip quality values and wildcard precedence. Validate compressed OTA page evidence in the firmware capability gate, and add native and Python regressions plus CI coverage. Remove the unused Brotli build dependency. Validation: 54 native tests, 56 Python/browser checks, full V4.3 build and verified application flash. Actual V4 WiFi responses matched the generated gzip assets; 30 repeat downloads completed without reboot. Chromium loaded the setup and settings pages without script or transfer errors. Physical Android testing is pending because the Pi detects no phone over USB or mDNS.
This commit is contained in:
commit
02b8935794
23 files changed
+2674
-2084
No files matched your search
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import brotli
|
||||
import gzip
|
||||
from pathlib import Path
|
||||
import re
|
||||
import unittest
|
||||
@@ -226,15 +226,15 @@ class WebConfigUiTest(unittest.TestCase):
|
||||
|
||||
def test_generated_asset_contains_show_controls(self):
|
||||
header = HEADER.read_text(encoding="utf-8")
|
||||
self.assertIn("Compressed with Google Brotli", header)
|
||||
length = int(re.search(r"WEBCONFIG_HTML_BR_LEN = (\d+);", header).group(1))
|
||||
self.assertIn("Compressed with Google Zopfli", header)
|
||||
length = int(re.search(r"WEBCONFIG_HTML_GZ_LEN = (\d+);", header).group(1))
|
||||
array = header.split(
|
||||
"const uint8_t WEBCONFIG_HTML_BR[] PROGMEM = {", 1
|
||||
"const uint8_t WEBCONFIG_HTML_GZ[] PROGMEM = {", 1
|
||||
)[1]
|
||||
blob = bytes(
|
||||
int(value, 16) for value in re.findall(r"0x([0-9a-f]{2})", array)
|
||||
)[:length]
|
||||
page = brotli.decompress(blob).decode("utf-8")
|
||||
page = gzip.decompress(blob).decode("utf-8")
|
||||
self.assertEqual(page.count('onclick="toggleWiFiPassword(this)"'), 2)
|
||||
self.assertIn("function toggleWiFiPassword(btn)", page)
|
||||
self.assertIn("function wzSkipRadio()", page)
|
||||
@@ -249,13 +249,13 @@ class WebConfigUiTest(unittest.TestCase):
|
||||
self.assertIn('case"bluetooth.mac":return r.bluetooth_mac||"";', page)
|
||||
self.assertIn("random-every-boot", page)
|
||||
|
||||
def test_webconfig_serves_the_single_brotli_asset(self):
|
||||
def test_webconfig_serves_the_single_gzip_asset(self):
|
||||
server = (ROOT / "src/helpers/esp32/WebConfigServer.cpp").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
self.assertIn("WEBCONFIG_HTML_BR", server)
|
||||
self.assertIn('res->addHeader("Content-Encoding", "br")', server)
|
||||
self.assertNotIn("WEBCONFIG_HTML_GZ", server)
|
||||
self.assertIn("WEBCONFIG_HTML_GZ", server)
|
||||
self.assertIn('res->addHeader("Content-Encoding", "gzip")', server)
|
||||
self.assertNotIn("WEBCONFIG_HTML_BR", server)
|
||||
|
||||
def test_skipped_mqtt_does_not_pin_display_in_setup_mode(self):
|
||||
main = (ROOT / "examples" / "companion_radio" / "main.cpp").read_text(
|
||||
|
||||
Reference in new issue
Block a user