PageBuilder
PageBuilder copied to clipboard
Add support for ESP32 Core v3.x
The ESP32 Arduino Core 3.x based on ESP-IDF 5.x breaks compatibility with the PageBuilder library. These fixes make it possible for the library to compile with Core 3.x versions and it seems to be working properly (tested on ESP32-S3).
- The function flush() from the ESP32 WiFi library has been deprecated. Use clear() instead
- The ESP32 Arduino Core 3.x RequestHandler features new API versions for canHandle() and canUpdate() that take in a reference to a WebServer as well. Even if the old APIs are still supported, when the WebServer parses a request it will make use of the new API, therefore bypassing PageBuilder and ending up in the Captive Portal pages not being loaded resulting in an error 404 when trying to browse the /_ac pages. If on ESP32 Core v3.x or later, define wrappers for canHandle() and canUpdate() using the WebServer& parameter that will just execute the old version of the API. This is needed only to ensure PageBuilder API isn't bypassed for the RequestHandler API, but in reality, we have no use for the WebServer reference, so we just make a function call for the old API. This ensures compatibility with ESP32 Arduino Core 3.x while mantaining backwards compatibility with older Core versions and ESP8266.