$ show Juerd/ESP-WiFiSettings
This repository provides a WiFi configuration manager for ESP32 and ESP8266 microcontrollers using the Arduino framework. It enables devices to create a captive portal for WiFi setup, store credentials in the filesystem, and optionally define additional configuration parameters (strings, integers, booleans) via a simple API. The library operates as a singleton, handling WiFi connection attempts, portal management, and runtime language selection for the configuration interface. Key features include automatic password generation, support for OTA updates via the same credentials, and callback hooks for custom behavior during connection events. The architecture centers around the WiFiSettings class, which manages state through filesystem storage (SPIFFS for ESP32, LittleFS for ESP8266) and a dynamic parameter system. The configuration portal is implemented as a blocking web server with DNS redirect, serving a localized HTML form that saves user input to files. Language support is handled via a separate header using flash-stored strings and runtime selection, minimizing memory usage. The design prioritizes ease of use over advanced features, making it suitable for simple IoT devices requiring straightforward WiFi provisioning.
The LLM identified 2 files worth highlighting for reuse:
A self-contained internationalization system that stores UI strings in flash memory (using PROGMEM via F() macro) and supports runtime language selection. It uses a map of language codes to language names and a Texts structure to hold translated strings, allowing efficient multilingual support in memory-constrained environments without runtime translation overhead.
The html_entities function provides essential HTML escaping to prevent cross-site scripting (XSS) in the captive portal's web interface. It converts special characters (like <, >, &, ") to HTML entities and is self-contained, making it easy to reuse in other Arduino web server projects. The function operates on Arduino String objects and uses a simple character-by-character replacement strategy.