From 19d09f5b59a495b817903e1697e045221872be68 Mon Sep 17 00:00:00 2001 From: Khoi Hoang <57012152+khoih-prog@users.noreply.github.com> Date: Mon, 17 Aug 2020 16:43:31 -0400 Subject: [PATCH] v1.0.11 ### Releases 1.0.11 1. Add optional **CORS (Cross-Origin Resource Sharing)** feature. Thanks to [AlesSt](https://github.com/AlesSt). See more in [Issue #27: CORS protection fires up with AJAX](https://github.com/khoih-prog/ESP_WiFiManager/issues/27) and [Cross Origin Resource Sharing](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing). To use, you must explicitly use `#define USING_CORS_FEATURE true` 2. Solve issue softAP with custom IP sometimes not working. Thanks to [AlesSt](https://github.com/AlesSt). See [Issue #26: softAP with custom IP not working](https://github.com/khoih-prog/ESP_WiFiManager/issues/26) and [Wifi.softAPConfig() sometimes set the wrong IP address](https://github.com/espressif/arduino-esp32/issues/985). 3. Temporary fix for issue of not clearing WiFi SSID/PW from flash of ESP32. Thanks to [AlesSt](https://github.com/AlesSt). See more in [Issue #25: API call /r doesnt clear credentials](https://github.com/khoih-prog/ESP_WiFiManager/issues/25) and [WiFi.disconnect(true) problem](https://github.com/espressif/arduino-esp32/issues/400). 4. Fix autoConnect() feature to permit autoConnect() to use STA static IP or DHCP IP. Remove from deprecated functi0n list. 5. Enhance README.md with more instructions and illustrations. --- README.md | 83 ++++++++++++- examples/AutoConnect/AutoConnect.ino | 116 +++++++++--------- .../AutoConnectWithFSParameters.ino | 37 +++--- .../AutoConnectWithFeedback.ino | 37 +++--- .../AutoConnectWithFeedbackLED.ino | 37 +++--- .../ConfigOnDoubleReset.ino | 7 +- examples/ConfigOnStartup/ConfigOnStartup.ino | 37 +++--- examples/ConfigOnSwitch/ConfigOnSwitch.ino | 37 +++--- .../ConfigOnSwitchFS/ConfigOnSwitchFS.ino | 37 +++--- .../ConfigOnSwitchFS_MQTT_Ptr.ino | 37 +++--- .../ConfigPortalParamsOnSwitch.ino | 37 +++--- .../ESP32_FSWebServer/ESP32_FSWebServer.ino | 37 +++--- .../ESP32_FSWebServer_DRD.ino | 37 +++--- examples/ESP_FSWebServer/ESP_FSWebServer.ino | 37 +++--- .../ESP_FSWebServer_DRD.ino | 37 +++--- library.json | 4 +- library.properties | 6 +- src/ESP_WiFiManager-Impl.h | 65 ++++++++-- src/ESP_WiFiManager.h | 14 ++- src/ESP_WiFiManager_Debug.h | 39 +++--- 20 files changed, 490 insertions(+), 288 deletions(-) diff --git a/README.md b/README.md index c764f09..0773429 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,16 @@ --- -### Releases 1.0.10 +### Releases 1.0.11 + +1. Add optional **CORS (Cross-Origin Resource Sharing)** feature. Thanks to [AlesSt](https://github.com/AlesSt). See more in [Issue #27: CORS protection fires up with AJAX](https://github.com/khoih-prog/ESP_WiFiManager/issues/27) and [Cross Origin Resource Sharing](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing). To use, you must explicitly use `#define USING_CORS_FEATURE true` +2. Solve issue softAP with custom IP sometimes not working. Thanks to [AlesSt](https://github.com/AlesSt). See [Issue #26: softAP with custom IP not working](https://github.com/khoih-prog/ESP_WiFiManager/issues/26) and [Wifi.softAPConfig() sometimes set the wrong IP address](https://github.com/espressif/arduino-esp32/issues/985). +3. Temporary fix for issue of not clearing WiFi SSID/PW from flash of ESP32. Thanks to [AlesSt](https://github.com/AlesSt). See more in [Issue #25: API call /r doesnt clear credentials](https://github.com/khoih-prog/ESP_WiFiManager/issues/25) and [WiFi.disconnect(true) problem](https://github.com/espressif/arduino-esp32/issues/400). +4. Fix autoConnect() feature to permit autoConnect() to use STA static IP or DHCP IP. Remove from deprecated functi0n list. +5. Enhance README.md with more instructions and illustrations. + + +#### Releases 1.0.10 1. Don't need to reinput already working SSID in Config Port to update other parameters, such as StaticIP. 2. Disable/Enable StaticIP configuration in Config Portal from sketch. Valid only if DHCP is used. @@ -45,6 +54,7 @@ 1. Add function getConfigPortalPW() 2. Add 4 new complicated examples compatible with ArduinoJson 6.0.0+ :[AutoConnect](examples/AutoConnect), [AutoConnectWithFeedback](examples/AutoConnectWithFeedback), [AutoConnectWithFeedbackLED](examples/AutoConnectWithFeedbackLED) and [AutoConnectWithFSParameters](examples/AutoConnectWithFSParameters) +--- --- This library is based on, modified, bug-fixed and improved from: @@ -197,6 +207,10 @@ String Router_Pass; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true @@ -408,6 +422,8 @@ ESP_wifiManager.setConfigPortalChannel(0); ////// ``` +--- + #### 12. Using fixed AP-mode channel, for example channel 3 @@ -417,14 +433,47 @@ ESP_wifiManager.setConfigPortalChannel(0); ESP_wifiManager.setConfigPortalChannel(3); ////// ``` +--- -#### 11. Setting STA-mode static IP +#### 13. Setting STA-mode static IP ```cpp // Set static IP, Gateway, Subnetmask, DNS1 and DNS2. New in v1.0.5 ESP_wifiManager.setSTAStaticIPConfig(stationIP, gatewayIP, netMask, dns1IP, dns2IP); ``` +--- + +#### 14. Using AUTOCONNECT_NO_INVALIDATE feature + +1. Don't invalidate WiFi SSID/PW when calling autoConnect() (default) + +```cpp +#define AUTOCONNECT_NO_INVALIDATE true +``` + +2. To invalidate WiFi SSID/PW when calling autoConnect() + +```cpp +#define AUTOCONNECT_NO_INVALIDATE false +``` +--- + +#### 15. Using CORS (Cross-Origin Resource Sharing) feature + +1. To use CORS feature + +```cpp +// Default false for using only whenever necessary to avoid security issue +#define USING_CORS_FEATURE true +``` + +2. Not use CORS feature (default) + +```cpp +// Default false for using only whenever necessary to avoid security issue +#define USING_CORS_FEATURE false +``` --- --- @@ -490,6 +539,7 @@ Once WiFi network information is saved in the `ESP32 / ESP8266`, it will try to 13. [AutoConnectWithFSParameters](examples/AutoConnectWithFSParameters) 14. [ConfigOnSwitchFS_MQTT_Ptr](examples/ConfigOnSwitchFS_MQTT_Ptr) +--- --- ## So, how it works? @@ -528,6 +578,7 @@ Enter your credentials, then click ***Save***. The WiFi Credentials will be save If you're already connected to a listed WiFi AP and don't want to change anything, just select ***Exit Portal*** from the `Main` page to reboot the board and connect to the previously-stored AP. The WiFi Credentials are still intact. +--- --- ## Documentation @@ -635,6 +686,7 @@ void loop() See [ConfigOnSwitch](examples/ConfigOnSwitch) example for a more complex version. +--- --- #### Custom Parameters @@ -927,6 +979,10 @@ String Router_Pass; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true @@ -1662,6 +1718,7 @@ After waiting 0 secs more in setup(), connection result is connected. Local IP: HHHHHHHHHH HHHHHHHHHH HHHHHHHHHH HHHHHHHHHH ``` +--- --- ### Debug @@ -1678,6 +1735,7 @@ You can also change the debugging level from 0 to 4 #define _WIFIMGR_LOGLEVEL_ 3 ``` --- +--- ### Troubleshooting If you get compilation errors, more often than not, you may need to install a newer version of the `ESP32 / ESP8266` core for Arduino. @@ -1693,8 +1751,17 @@ If you connect to the created configuration Access Point but the ConfigPortal do Submit issues to: [ESP_WiFiManager issues](https://github.com/khoih-prog/ESP_WiFiManager/issues) --- +--- + +### Releases 1.0.11 + +1. Add optional **CORS (Cross-Origin Resource Sharing)** feature. Thanks to [AlesSt](https://github.com/AlesSt). See more in [Issue #27: CORS protection fires up with AJAX](https://github.com/khoih-prog/ESP_WiFiManager/issues/27) and [Cross Origin Resource Sharing](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing). To use, you must explicitly use `#define USING_CORS_FEATURE true` +2. Solve issue softAP with custom IP sometimes not working. Thanks to [AlesSt](https://github.com/AlesSt). See [Issue #26: softAP with custom IP not working](https://github.com/khoih-prog/ESP_WiFiManager/issues/26) and [Wifi.softAPConfig() sometimes set the wrong IP address](https://github.com/espressif/arduino-esp32/issues/985). +3. Temporary fix for issue of not clearing WiFi SSID/PW from flash of ESP32. Thanks to [AlesSt](https://github.com/AlesSt). See more in [Issue #25: API call /r doesnt clear credentials](https://github.com/khoih-prog/ESP_WiFiManager/issues/25) and [WiFi.disconnect(true) problem](https://github.com/espressif/arduino-esp32/issues/400). +4. Fix autoConnect() feature to permit autoConnect() to use STA static IP or DHCP IP. Remove from deprecated functi0n list. +5. Enhance README.md with more instructions and illustrations. -### Releases 1.0.10 +#### Releases 1.0.10 1. Don't need to reinput already working SSID in Config Port to update other parameters, such as StaticIP. 2. Disable/Enable StaticIP configuration in Config Portal from sketch. Valid only if DHCP is used. @@ -1764,6 +1831,7 @@ See [KenTaylor's version](https://github.com/kentaylor/WiFiManager) for previous - Fix bug that keeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. - Add example ConfigPortalParamsOnSwitch to enable ConfigPortal credentials to be reconfigurable using ConfigPortal. +--- --- ### Contributions and Thanks @@ -1773,8 +1841,12 @@ See [KenTaylor's version](https://github.com/kentaylor/WiFiManager) for previous 3. Thanks to [CrispinP](https://github.com/CrispinP) for idea to add HostName (v1.0.4) and request to reduce the unnecessary waiting time in ESP_WiFiManager constructor (v1.0.6+). See [Starting WiFIManger is very slow (2000ms)](https://github.com/khoih-prog/ESP_WiFiManager/issues/6) 4. Thanks to [OttoKlaasen](https://github.com/OttoKlaasen) for reporting [Having issue to read the SPIFF file](https://github.com/khoih-prog/ESP_WiFiManager/issues/14) bug in examples. 5. Thanks to [Giuseppe](https://github.com/Gius-8) for reporting [Static Station IP doesn't work](https://github.com/khoih-prog/ESP_WiFiManager/issues/17) bug. -6. Thanks to [AlesSt](https://github.com/AlesSt) for reporting [On Android phone ConfigPortal is unresponsive](https://github.com/khoih-prog/ESP_WiFiManager/issues/23) and request an enhancement (***HOWTO disable the static IP inputs on the config page***) leading to [ESP_WiFiManager v1.0.10](https://github.com/khoih-prog/ESP_WiFiManager/releases/tag/v1.0.10). +6. Thanks to [AlesSt](https://github.com/AlesSt) for reporting then help provide the fixes: + - [On Android phone ConfigPortal is unresponsive](https://github.com/khoih-prog/ESP_WiFiManager/issues/23) and request an enhancement (***HOWTO disable the static IP inputs on the config page***) leading to [ESP_WiFiManager v1.0.10](https://github.com/khoih-prog/ESP_WiFiManager/releases/tag/v1.0.10). + - [Issue #25: API call /r doesnt clear credentials](https://github.com/khoih-prog/ESP_WiFiManager/issues/25), [Issue #26: softAP with custom IP not working](https://github.com/khoih-prog/ESP_WiFiManager/issues/26) and [Issue #27: CORS protection fires up with AJAX](https://github.com/khoih-prog/ESP_WiFiManager/issues/27) leading to [ESP_WiFiManager v1.0.11](https://github.com/khoih-prog/ESP_WiFiManager/releases/tag/v1.0.11). 7. Thanks to [wackoo-arduino](https://github.com/wackoo-arduino) for agreeing to contribute the sample code dealing with MQTT which the [ConfigOnSwitchFS_MQTT_Ptr](examples/ConfigOnSwitchFS_MQTT_Ptr) is based on. See [Custom MQTT parameters using Wifi Manager](https://forum.arduino.cc/index.php?topic=692108.75). +8. Thanks to [05prateek](https://github.com/05prateek) for reporting [Stationmode Static IP changes to dhcp when esp8266 is restarted](https://github.com/khoih-prog/ESP_WiFiManager/issues/28) bug which is fixed in v1.0.11 by enhance autoConnect() function. + @@ -1787,8 +1859,9 @@ See [KenTaylor's version](https://github.com/kentaylor/WiFiManager) for previous - + +
Giuseppe
Giuseppe

AlesSt
AlesSt

AlesSt
⭐️ AlesSt

wackoo-arduino
wackoo-arduino

05prateek
05prateek

diff --git a/examples/AutoConnect/AutoConnect.ino b/examples/AutoConnect/AutoConnect.ino index f19757b..a291625 100644 --- a/examples/AutoConnect/AutoConnect.ino +++ b/examples/AutoConnect/AutoConnect.ino @@ -10,22 +10,23 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.0.10 - - Version Modified By Date Comments - ------- ----------- ---------- ----------- - 1.0.0 K Hoang 07/10/2019 Initial coding - 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 - 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. - 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples - 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. - 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc - 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) - 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md - 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ - 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. - Add, enhance examples (fix MDNS for ESP32) - 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + Version: 1.0.11 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 07/10/2019 Initial coding + 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 + 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. + 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples + 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. + 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc + 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) + 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md + 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ + 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. + Add, enhance examples (fix MDNS for ESP32) + 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ #if !( defined(ESP8266) || defined(ESP32) ) #error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting. @@ -36,24 +37,24 @@ //Ported to ESP32 #ifdef ESP32 -#include -#include -#include - -#define ESP_getChipId() ((uint32_t)ESP.getEfuseMac()) - -#define LED_ON HIGH -#define LED_OFF LOW + #include + #include + #include + + #define ESP_getChipId() ((uint32_t)ESP.getEfuseMac()) + + #define LED_ON HIGH + #define LED_OFF LOW #else -#include //https://github.com/esp8266/Arduino -//needed for library -#include -#include - -#define ESP_getChipId() (ESP.getChipId()) - -#define LED_ON LOW -#define LED_OFF HIGH + #include //https://github.com/esp8266/Arduino + //needed for library + #include + #include + + #define ESP_getChipId() (ESP.getChipId()) + + #define LED_ON LOW + #define LED_OFF HIGH #endif // SSID and PW for your Router @@ -78,36 +79,41 @@ String Router_Pass; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) -// Force DHCP to be true -#if defined(USE_DHCP_IP) -#undef USE_DHCP_IP -#endif -#define USE_DHCP_IP true + // Force DHCP to be true + #if defined(USE_DHCP_IP) + #undef USE_DHCP_IP + #endif + #define USE_DHCP_IP true #else -// You can select DHCP or Static IP here -//#define USE_DHCP_IP true -#define USE_DHCP_IP false + // You can select DHCP or Static IP here + //#define USE_DHCP_IP true + #define USE_DHCP_IP false #endif #if ( USE_DHCP_IP || ( defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP ) ) // Use DHCP -#warning Using DHCP IP -IPAddress stationIP = IPAddress(0, 0, 0, 0); -IPAddress gatewayIP = IPAddress(192, 168, 2, 1); -IPAddress netMask = IPAddress(255, 255, 255, 0); + #warning Using DHCP IP + IPAddress stationIP = IPAddress(0, 0, 0, 0); + IPAddress gatewayIP = IPAddress(192, 168, 2, 1); + IPAddress netMask = IPAddress(255, 255, 255, 0); #else -// Use static IP -#warning Using static IP -#ifdef ESP32 -IPAddress stationIP = IPAddress(192, 168, 2, 232); -#else -IPAddress stationIP = IPAddress(192, 168, 2, 186); -#endif - -IPAddress gatewayIP = IPAddress(192, 168, 2, 1); -IPAddress netMask = IPAddress(255, 255, 255, 0); + // Use static IP + #warning Using static IP + + #ifdef ESP32 + IPAddress stationIP = IPAddress(192, 168, 2, 232); + #else + IPAddress stationIP = IPAddress(192, 168, 2, 186); + #endif + + IPAddress gatewayIP = IPAddress(192, 168, 2, 1); + IPAddress netMask = IPAddress(255, 255, 255, 0); #endif #define USE_CONFIGURABLE_DNS true diff --git a/examples/AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino b/examples/AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino index 1d43ab3..18e9c27 100644 --- a/examples/AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino +++ b/examples/AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino @@ -10,22 +10,23 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.0.10 - - Version Modified By Date Comments - ------- ----------- ---------- ----------- - 1.0.0 K Hoang 07/10/2019 Initial coding - 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 - 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. - 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples - 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. - 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc - 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) - 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md - 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ - 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. - Add, enhance examples (fix MDNS for ESP32) - 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + Version: 1.0.11 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 07/10/2019 Initial coding + 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 + 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. + 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples + 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. + 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc + 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) + 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md + 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ + 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. + Add, enhance examples (fix MDNS for ESP32) + 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ #if !( defined(ESP8266) || defined(ESP32) ) #error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting. @@ -108,6 +109,10 @@ String AP_PASS; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true diff --git a/examples/AutoConnectWithFeedback/AutoConnectWithFeedback.ino b/examples/AutoConnectWithFeedback/AutoConnectWithFeedback.ino index 16d2847..6f956ab 100644 --- a/examples/AutoConnectWithFeedback/AutoConnectWithFeedback.ino +++ b/examples/AutoConnectWithFeedback/AutoConnectWithFeedback.ino @@ -10,22 +10,23 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.0.10 - - Version Modified By Date Comments - ------- ----------- ---------- ----------- - 1.0.0 K Hoang 07/10/2019 Initial coding - 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 - 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. - 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples - 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. - 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc - 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) - 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md - 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ - 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. - Add, enhance examples (fix MDNS for ESP32) - 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + Version: 1.0.11 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 07/10/2019 Initial coding + 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 + 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. + 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples + 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. + 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc + 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) + 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md + 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ + 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. + Add, enhance examples (fix MDNS for ESP32) + 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ #if !( defined(ESP8266) || defined(ESP32) ) #error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting. @@ -82,6 +83,10 @@ String AP_PASS; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true diff --git a/examples/AutoConnectWithFeedbackLED/AutoConnectWithFeedbackLED.ino b/examples/AutoConnectWithFeedbackLED/AutoConnectWithFeedbackLED.ino index fcc7f46..084e7b3 100644 --- a/examples/AutoConnectWithFeedbackLED/AutoConnectWithFeedbackLED.ino +++ b/examples/AutoConnectWithFeedbackLED/AutoConnectWithFeedbackLED.ino @@ -10,22 +10,23 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.0.10 - - Version Modified By Date Comments - ------- ----------- ---------- ----------- - 1.0.0 K Hoang 07/10/2019 Initial coding - 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 - 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. - 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples - 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. - 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc - 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) - 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md - 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ - 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. - Add, enhance examples (fix MDNS for ESP32) - 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + Version: 1.0.11 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 07/10/2019 Initial coding + 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 + 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. + 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples + 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. + 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc + 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) + 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md + 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ + 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. + Add, enhance examples (fix MDNS for ESP32) + 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ #if !( defined(ESP8266) || defined(ESP32) ) #error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting. @@ -87,6 +88,10 @@ String AP_PASS; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true diff --git a/examples/ConfigOnDoubleReset/ConfigOnDoubleReset.ino b/examples/ConfigOnDoubleReset/ConfigOnDoubleReset.ino index b5d0a8b..da264c5 100644 --- a/examples/ConfigOnDoubleReset/ConfigOnDoubleReset.ino +++ b/examples/ConfigOnDoubleReset/ConfigOnDoubleReset.ino @@ -13,7 +13,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.0.10 + Version: 1.0.11 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -29,6 +29,7 @@ 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. Add, enhance examples (fix MDNS for ESP32) 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ /**************************************************************************************************************************** This example will open a configuration portal when the reset button is pressed twice. @@ -143,6 +144,10 @@ bool initialConfig = false; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true diff --git a/examples/ConfigOnStartup/ConfigOnStartup.ino b/examples/ConfigOnStartup/ConfigOnStartup.ino index 515f576..877a9e1 100644 --- a/examples/ConfigOnStartup/ConfigOnStartup.ino +++ b/examples/ConfigOnStartup/ConfigOnStartup.ino @@ -13,22 +13,23 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.0.10 - - Version Modified By Date Comments - ------- ----------- ---------- ----------- - 1.0.0 K Hoang 07/10/2019 Initial coding - 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 - 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. - 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples - 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. - 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc - 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) - 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md - 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ - 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. - Add, enhance examples (fix MDNS for ESP32) - 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + Version: 1.0.11 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 07/10/2019 Initial coding + 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 + 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. + 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples + 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. + 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc + 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) + 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md + 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ + 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. + Add, enhance examples (fix MDNS for ESP32) + 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ /**************************************************************************************************************************** This example will open a configuration portal for 60 seconds when first powered up if the boards has stored WiFi Credentials. @@ -102,6 +103,10 @@ String Router_Pass; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true diff --git a/examples/ConfigOnSwitch/ConfigOnSwitch.ino b/examples/ConfigOnSwitch/ConfigOnSwitch.ino index 7991f74..c7af116 100644 --- a/examples/ConfigOnSwitch/ConfigOnSwitch.ino +++ b/examples/ConfigOnSwitch/ConfigOnSwitch.ino @@ -13,22 +13,23 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.0.10 - - Version Modified By Date Comments - ------- ----------- ---------- ----------- - 1.0.0 K Hoang 07/10/2019 Initial coding - 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 - 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. - 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples - 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. - 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc - 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) - 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md - 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ - 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. - Add, enhance examples (fix MDNS for ESP32) - 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + Version: 1.0.11 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 07/10/2019 Initial coding + 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 + 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. + 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples + 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. + 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc + 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) + 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md + 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ + 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. + Add, enhance examples (fix MDNS for ESP32) + 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ /**************************************************************************************************************************** This example will open a configuration portal when no WiFi configuration has been previously entered or when a button is pushed. @@ -214,6 +215,10 @@ bool initialConfig = false; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true diff --git a/examples/ConfigOnSwitchFS/ConfigOnSwitchFS.ino b/examples/ConfigOnSwitchFS/ConfigOnSwitchFS.ino index 468ad53..25a29d9 100644 --- a/examples/ConfigOnSwitchFS/ConfigOnSwitchFS.ino +++ b/examples/ConfigOnSwitchFS/ConfigOnSwitchFS.ino @@ -13,22 +13,23 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.0.10 - - Version Modified By Date Comments - ------- ----------- ---------- ----------- - 1.0.0 K Hoang 07/10/2019 Initial coding - 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 - 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. - 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples - 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. - 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc - 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) - 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md - 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ - 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. - Add, enhance examples (fix MDNS for ESP32) - 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + Version: 1.0.11 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 07/10/2019 Initial coding + 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 + 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. + 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples + 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. + 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc + 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) + 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md + 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ + 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. + Add, enhance examples (fix MDNS for ESP32) + 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ /**************************************************************************************************************************** This example will open a configuration portal when the reset button is pressed twice. @@ -278,6 +279,10 @@ String Router_Pass; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true diff --git a/examples/ConfigOnSwitchFS_MQTT_Ptr/ConfigOnSwitchFS_MQTT_Ptr.ino b/examples/ConfigOnSwitchFS_MQTT_Ptr/ConfigOnSwitchFS_MQTT_Ptr.ino index 6adf9c7..3adba89 100644 --- a/examples/ConfigOnSwitchFS_MQTT_Ptr/ConfigOnSwitchFS_MQTT_Ptr.ino +++ b/examples/ConfigOnSwitchFS_MQTT_Ptr/ConfigOnSwitchFS_MQTT_Ptr.ino @@ -13,22 +13,23 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.0.10 - - Version Modified By Date Comments - ------- ----------- ---------- ----------- - 1.0.0 K Hoang 07/10/2019 Initial coding - 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 - 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. - 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples - 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. - 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc - 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) - 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md - 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ - 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. - Add, enhance examples (fix MDNS for ESP32) - 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + Version: 1.0.11 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 07/10/2019 Initial coding + 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 + 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. + 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples + 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. + 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc + 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) + 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md + 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ + 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. + Add, enhance examples (fix MDNS for ESP32) + 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ /**************************************************************************************************************************** This example will open a configuration portal when no WiFi configuration has been previously entered or when a button is pushed. @@ -270,6 +271,10 @@ String Router_Pass; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true diff --git a/examples/ConfigPortalParamsOnSwitch/ConfigPortalParamsOnSwitch.ino b/examples/ConfigPortalParamsOnSwitch/ConfigPortalParamsOnSwitch.ino index 6099ac2..b0d6738 100644 --- a/examples/ConfigPortalParamsOnSwitch/ConfigPortalParamsOnSwitch.ino +++ b/examples/ConfigPortalParamsOnSwitch/ConfigPortalParamsOnSwitch.ino @@ -13,22 +13,23 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.0.10 - - Version Modified By Date Comments - ------- ----------- ---------- ----------- - 1.0.0 K Hoang 07/10/2019 Initial coding - 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 - 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. - 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples - 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. - 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc - 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) - 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md - 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ - 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. - Add, enhance examples (fix MDNS for ESP32) - 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + Version: 1.0.11 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 07/10/2019 Initial coding + 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 + 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. + 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples + 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. + 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc + 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) + 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md + 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ + 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. + Add, enhance examples (fix MDNS for ESP32) + 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ /**************************************************************************************************************************** This example will open a configuration portal when a predetermined button is pressed @@ -248,6 +249,10 @@ bool initialConfig = false; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true diff --git a/examples/ESP32_FSWebServer/ESP32_FSWebServer.ino b/examples/ESP32_FSWebServer/ESP32_FSWebServer.ino index 3f5b6f2..96b54b0 100644 --- a/examples/ESP32_FSWebServer/ESP32_FSWebServer.ino +++ b/examples/ESP32_FSWebServer/ESP32_FSWebServer.ino @@ -27,22 +27,23 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Version: 1.0.10 - - Version Modified By Date Comments - ------- ----------- ---------- ----------- - 1.0.0 K Hoang 07/10/2019 Initial coding - 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 - 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. - 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples - 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. - 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc - 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) - 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md - 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ - 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. - Add, enhance examples (fix MDNS for ESP32) - 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + Version: 1.0.11 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 07/10/2019 Initial coding + 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 + 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. + 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples + 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. + 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc + 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) + 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md + 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ + 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. + Add, enhance examples (fix MDNS for ESP32) + 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ /***************************************************************************************************************************** How To Use: @@ -109,6 +110,10 @@ String Router_Pass; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true diff --git a/examples/ESP32_FSWebServer_DRD/ESP32_FSWebServer_DRD.ino b/examples/ESP32_FSWebServer_DRD/ESP32_FSWebServer_DRD.ino index 065250e..229a7dc 100644 --- a/examples/ESP32_FSWebServer_DRD/ESP32_FSWebServer_DRD.ino +++ b/examples/ESP32_FSWebServer_DRD/ESP32_FSWebServer_DRD.ino @@ -27,22 +27,23 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Version: 1.0.10 - - Version Modified By Date Comments - ------- ----------- ---------- ----------- - 1.0.0 K Hoang 07/10/2019 Initial coding - 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 - 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. - 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples - 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. - 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc - 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) - 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md - 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ - 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. - Add, enhance examples (fix MDNS for ESP32) - 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + Version: 1.0.11 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 07/10/2019 Initial coding + 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 + 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. + 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples + 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. + 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc + 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) + 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md + 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ + 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. + Add, enhance examples (fix MDNS for ESP32) + 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ /***************************************************************************************************************************** How To Use: @@ -134,6 +135,10 @@ bool initialConfig = false; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true diff --git a/examples/ESP_FSWebServer/ESP_FSWebServer.ino b/examples/ESP_FSWebServer/ESP_FSWebServer.ino index dc47422..4c35013 100644 --- a/examples/ESP_FSWebServer/ESP_FSWebServer.ino +++ b/examples/ESP_FSWebServer/ESP_FSWebServer.ino @@ -27,22 +27,23 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Version: 1.0.10 - - Version Modified By Date Comments - ------- ----------- ---------- ----------- - 1.0.0 K Hoang 07/10/2019 Initial coding - 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 - 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. - 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples - 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. - 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc - 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) - 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md - 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ - 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. - Add, enhance examples (fix MDNS for ESP32) - 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + Version: 1.0.11 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 07/10/2019 Initial coding + 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 + 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. + 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples + 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. + 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc + 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) + 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md + 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ + 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. + Add, enhance examples (fix MDNS for ESP32) + 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ /***************************************************************************************************************************** How To Use: @@ -105,6 +106,10 @@ String Router_Pass; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true diff --git a/examples/ESP_FSWebServer_DRD/ESP_FSWebServer_DRD.ino b/examples/ESP_FSWebServer_DRD/ESP_FSWebServer_DRD.ino index e0481c9..8fcb0fb 100644 --- a/examples/ESP_FSWebServer_DRD/ESP_FSWebServer_DRD.ino +++ b/examples/ESP_FSWebServer_DRD/ESP_FSWebServer_DRD.ino @@ -27,22 +27,23 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Version: 1.0.10 - - Version Modified By Date Comments - ------- ----------- ---------- ----------- - 1.0.0 K Hoang 07/10/2019 Initial coding - 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 - 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. - 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples - 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. - 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc - 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) - 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md - 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ - 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. - Add, enhance examples (fix MDNS for ESP32) - 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + Version: 1.0.11 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 07/10/2019 Initial coding + 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 + 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. + 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples + 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. + 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc + 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) + 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md + 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ + 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. + Add, enhance examples (fix MDNS for ESP32) + 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ /***************************************************************************************************************************** How To Use: @@ -133,6 +134,10 @@ bool initialConfig = false; // See Issue #21: CloudFlare link in the default portal (https://github.com/khoih-prog/ESP_WiFiManager/issues/21) #define USE_CLOUDFLARE_NTP false +// New in v1.0.11 +#define USING_CORS_FEATURE true +////// + // Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network #if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP) // Force DHCP to be true diff --git a/library.json b/library.json index d8f442a..e0358e2 100644 --- a/library.json +++ b/library.json @@ -1,8 +1,8 @@ { "name": "ESP_WifiManager", - "version": "1.0.10", + "version": "1.0.11", "keywords": "wifi, WiFiManager, esp8266, esp32", - "description": "ESP32, ESP8266 WiFi Connection manager with enhanced GUI and fallback web ConfigPortal", + "description": "ESP32, ESP8266 WiFi Connection Manager with enhanced GUI and fallback web ConfigPortal. This Library is used for configuring ESP32, ESP8266 modules WiFi Credentials at runtime. You can also specify static DNS servers, personalized HostName, fixed or random AP channel. Now with CORS feature.", "authors": { "name": "Khoi Hoang", diff --git a/library.properties b/library.properties index 80c9af1..11a5fc1 100644 --- a/library.properties +++ b/library.properties @@ -1,10 +1,10 @@ name=ESP_WiFiManager -version=1.0.10 +version=1.0.11 author=Khoi Hoang maintainer=Khoi Hoang license=MIT -sentence=ESP32, ESP8266 WiFi Connection manager with enhanced GUI and fallback web ConfigPortal -paragraph=Library for configuring ESP32, ESP8266 modules WiFi credentials at runtime. You can also specify static DNS servers, personalized HostName, fixed or random AP channel. +sentence=ESP32, ESP8266 WiFi Connection Manager with enhanced GUI and fallback web ConfigPortal +paragraph=Library for configuring ESP32, ESP8266 modules WiFi credentials at runtime. You can also specify static DNS servers, personalized HostName, fixed or random AP channel. Now with CORS feature. category=Communication url=https://github.com/khoih-prog/ESP_WiFiManager architectures=esp8266,esp32 diff --git a/src/ESP_WiFiManager-Impl.h b/src/ESP_WiFiManager-Impl.h index 1a4de1a..ddccaf8 100644 --- a/src/ESP_WiFiManager-Impl.h +++ b/src/ESP_WiFiManager-Impl.h @@ -15,7 +15,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.0.10 + Version: 1.0.11 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -31,6 +31,7 @@ 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. Add, enhance examples (fix MDNS for ESP32) 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ #ifndef ESP_WiFiManager_Impl_h @@ -329,11 +330,19 @@ void ESP_WiFiManager::setupConfigPortal() WiFi.softAP(_apName); } ////// - + + // From v1.0.11 + // Contributed by AlesSt (https://github.com/AlesSt) to solve issue softAP with custom IP sometimes not working + // See https://github.com/khoih-prog/ESP_WiFiManager/issues/26 and https://github.com/espressif/arduino-esp32/issues/985 + // delay 100ms to wait for SYSTEM_EVENT_AP_START + delay(100); + ////// + //optional soft ip config if (_ap_static_ip) { - LOGWARN(F("Custom AP IP/GW/Subnet")); + LOGWARN(F("Custom AP IP/GW/Subnet = ")); + LOGWARN2(_ap_static_ip, _ap_static_gw, _ap_static_sn); WiFi.softAPConfig(_ap_static_ip, _ap_static_gw, _ap_static_sn); } @@ -374,13 +383,25 @@ boolean ESP_WiFiManager::autoConnect() blocking call then use (WiFi.status()==WL_CONNECTED) test to see if connected yet. See some discussion at https://github.com/tzapu/WiFiManager/issues/68 */ + +// New in v1.0.11 +// To permit autoConnect() to use STA static IP or DHCP IP. +#ifndef AUTOCONNECT_NO_INVALIDATE + #define AUTOCONNECT_NO_INVALIDATE true +#endif + boolean ESP_WiFiManager::autoConnect(char const *apName, char const *apPassword) { - LOGINFO(F("\nAutoConnect")); - - // device will attempt to connect by itself; wait 10 secs - // to see if it succeeds and should it fail, fall back to AP - WiFi.mode(WIFI_STA); +#if AUTOCONNECT_NO_INVALIDATE + LOGINFO(F("\nAutoConnect using previously saved SSID/PW, but keep previous settings")); + // Connect to previously saved SSID/PW, but keep previous settings + connectWifi(); +#else + LOGINFO(F("\nAutoConnect using previously saved SSID/PW, but invalidate previous settings")); + // Connect to previously saved SSID/PW, but invalidate previous settings + connectWifi(WiFi_SSID(), WiFi_Pass()); +#endif + unsigned long startedAt = millis(); while (millis() - startedAt < 10000) @@ -401,6 +422,7 @@ boolean ESP_WiFiManager::autoConnect(char const *apName, char const *apPassword) return startConfigPortal(apName, apPassword); } +////// boolean ESP_WiFiManager::startConfigPortal() { @@ -733,6 +755,11 @@ void ESP_WiFiManager::resetSettings() WiFi.disconnect(true); #else WiFi.disconnect(true, true); + // New in v1.0.11 + // Temporary fix for issue of not clearing WiFi SSID/PW from flash of ESP32 + // See https://github.com/khoih-prog/ESP_WiFiManager/issues/25 and https://github.com/espressif/arduino-esp32/issues/400 + WiFi.begin("0","0"); + ////// #endif delay(200); @@ -1372,6 +1399,11 @@ void ESP_WiFiManager::handleState() } /** Handle the scan page */ +// Default false for using only whenever necessary to avoid security issue when using CORS (Cross-Origin Resource Sharing) +#ifndef USING_CORS_FEATURE + #define USING_CORS_FEATURE false +#endif + void ESP_WiFiManager::handleScan() { LOGDEBUG(F("Scan")); @@ -1382,6 +1414,14 @@ void ESP_WiFiManager::handleScan() LOGDEBUG(F("State-Json")); server->sendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); + + // New in v1.0.11 +#if USING_CORS_FEATURE + // Contributed by AlesSt (https://github.com/AlesSt) to solve AJAX CORS protection problem of API redirects on client side + // See more in https://github.com/khoih-prog/ESP_WiFiManager/issues/27 and https://en.wikipedia.org/wiki/Cross-origin_resource_sharing + server->sendHeader("Access-Control-Allow-Origin", "*"); +#endif + server->sendHeader("Pragma", "no-cache"); server->sendHeader("Expires", "-1"); @@ -1464,7 +1504,13 @@ void ESP_WiFiManager::handleReset() LOGDEBUG(F("Sent reset page")); delay(5000); - WiFi.disconnect(true); // Wipe out WiFi credentials. + + // New in v1.0.11 + // Temporary fix for issue of not clearing WiFi SSID/PW from flash of ESP32 + // See https://github.com/khoih-prog/ESP_WiFiManager/issues/25 and https://github.com/espressif/arduino-esp32/issues/400 + resetSettings(); + //WiFi.disconnect(true); // Wipe out WiFi credentials. + ////// #ifdef ESP8266 ESP.reset(); @@ -1738,6 +1784,7 @@ String ESP_WiFiManager::getStoredWiFiPass() wifi_config_t conf; esp_wifi_get_config(WIFI_IF_STA, &conf); + return String(reinterpret_cast(conf.sta.password)); } #endif diff --git a/src/ESP_WiFiManager.h b/src/ESP_WiFiManager.h index 14385a8..725fbd7 100644 --- a/src/ESP_WiFiManager.h +++ b/src/ESP_WiFiManager.h @@ -15,7 +15,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.0.10 + Version: 1.0.11 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -31,6 +31,7 @@ 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. Add, enhance examples (fix MDNS for ESP32) 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ #ifndef ESP_WiFiManager_h @@ -205,8 +206,10 @@ class ESP_WiFiManager ~ESP_WiFiManager(); - boolean autoConnect(); //Deprecated. Do not use. - boolean autoConnect(char const *apName, char const *apPassword = NULL); //Deprecated. Do not use. + // Update feature from v1.0.11. Can use with STA staticIP now + boolean autoConnect(); + boolean autoConnect(char const *apName, char const *apPassword = NULL); + ////// //if you want to start the config portal boolean startConfigPortal(); @@ -393,7 +396,10 @@ class ESP_WiFiManager // New v1.0.8 void setWifiStaticIP(void); - int connectWifi(String ssid, String pass); + // New v1.0.11 + int connectWifi(String ssid = "", String pass = ""); + ////// + uint8_t waitForConnectResult(); void handleRoot(); diff --git a/src/ESP_WiFiManager_Debug.h b/src/ESP_WiFiManager_Debug.h index 492eae0..a9127d2 100644 --- a/src/ESP_WiFiManager_Debug.h +++ b/src/ESP_WiFiManager_Debug.h @@ -15,7 +15,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.0.10 + Version: 1.0.11 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -31,6 +31,7 @@ 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. Add, enhance examples (fix MDNS for ESP32) 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. *****************************************************************************************************************************/ #ifndef ESP_WiFiManager_Debug_H @@ -53,24 +54,28 @@ #define _WIFIMGR_LOGLEVEL_ 0 #endif -#define LOGERROR(x) if(_WIFIMGR_LOGLEVEL_>0) { DBG_PORT.print("[WM] "); DBG_PORT.println(x); } -#define LOGERROR0(x) if(_WIFIMGR_LOGLEVEL_>0) { DBG_PORT.print(x); } -#define LOGERROR1(x,y) if(_WIFIMGR_LOGLEVEL_>0) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.println(y); } -#define LOGERROR2(x,y,z) if(_WIFIMGR_LOGLEVEL_>0) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.print(y); DBG_PORT.print(" "); DBG_PORT.println(z); } +#define LOGERROR(x) if(_WIFIMGR_LOGLEVEL_>0) { DBG_PORT.print("[WM] "); DBG_PORT.println(x); } +#define LOGERROR0(x) if(_WIFIMGR_LOGLEVEL_>0) { DBG_PORT.print(x); } +#define LOGERROR1(x,y) if(_WIFIMGR_LOGLEVEL_>0) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.println(y); } +#define LOGERROR2(x,y,z) if(_WIFIMGR_LOGLEVEL_>0) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.print(y); DBG_PORT.print(" "); DBG_PORT.println(z); } +#define LOGERROR3(x,y,z,w) if(_WIFIMGR_LOGLEVEL_>0) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.print(y); DBG_PORT.print(" "); DBG_PORT.print(z); DBG_PORT.print(" "); DBG_PORT.println(w); } -#define LOGWARN(x) if(_WIFIMGR_LOGLEVEL_>1) { DBG_PORT.print("[WM] "); DBG_PORT.println(x); } -#define LOGWARN0(x) if(_WIFIMGR_LOGLEVEL_>1) { DBG_PORT.print(x); } -#define LOGWARN1(x,y) if(_WIFIMGR_LOGLEVEL_>1) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.println(y); } -#define LOGWARN2(x,y,z) if(_WIFIMGR_LOGLEVEL_>1) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.print(y); DBG_PORT.print(" "); DBG_PORT.println(z); } +#define LOGWARN(x) if(_WIFIMGR_LOGLEVEL_>1) { DBG_PORT.print("[WM] "); DBG_PORT.println(x); } +#define LOGWARN0(x) if(_WIFIMGR_LOGLEVEL_>1) { DBG_PORT.print(x); } +#define LOGWARN1(x,y) if(_WIFIMGR_LOGLEVEL_>1) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.println(y); } +#define LOGWARN2(x,y,z) if(_WIFIMGR_LOGLEVEL_>1) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.print(y); DBG_PORT.print(" "); DBG_PORT.println(z); } +#define LOGWARN3(x,y,z,w) if(_WIFIMGR_LOGLEVEL_>1) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.print(y); DBG_PORT.print(" "); DBG_PORT.print(z); DBG_PORT.print(" "); DBG_PORT.println(w); } -#define LOGINFO(x) if(_WIFIMGR_LOGLEVEL_>2) { DBG_PORT.print("[WM] "); DBG_PORT.println(x); } -#define LOGINFO0(x) if(_WIFIMGR_LOGLEVEL_>2) { DBG_PORT.print(x); } -#define LOGINFO1(x,y) if(_WIFIMGR_LOGLEVEL_>2) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.println(y); } -#define LOGINFO2(x,y,z) if(_WIFIMGR_LOGLEVEL_>2) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.print(y); DBG_PORT.print(" "); DBG_PORT.println(z); } +#define LOGINFO(x) if(_WIFIMGR_LOGLEVEL_>2) { DBG_PORT.print("[WM] "); DBG_PORT.println(x); } +#define LOGINFO0(x) if(_WIFIMGR_LOGLEVEL_>2) { DBG_PORT.print(x); } +#define LOGINFO1(x,y) if(_WIFIMGR_LOGLEVEL_>2) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.println(y); } +#define LOGINFO2(x,y,z) if(_WIFIMGR_LOGLEVEL_>2) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.print(y); DBG_PORT.print(" "); DBG_PORT.println(z); } +#define LOGINFO3(x,y,z,w) if(_WIFIMGR_LOGLEVEL_>2) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.print(y); DBG_PORT.print(" "); DBG_PORT.print(z); DBG_PORT.print(" "); DBG_PORT.println(w); } -#define LOGDEBUG(x) if(_WIFIMGR_LOGLEVEL_>3) { DBG_PORT.print("[WM] "); DBG_PORT.println(x); } -#define LOGDEBUG0(x) if(_WIFIMGR_LOGLEVEL_>3) { DBG_PORT.print(x); } -#define LOGDEBUG1(x,y) if(_WIFIMGR_LOGLEVEL_>3) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.println(y); } -#define LOGDEBUG2(x,y,z) if(_WIFIMGR_LOGLEVEL_>3) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.print(y); DBG_PORT.print(" "); DBG_PORT.println(z); } +#define LOGDEBUG(x) if(_WIFIMGR_LOGLEVEL_>3) { DBG_PORT.print("[WM] "); DBG_PORT.println(x); } +#define LOGDEBUG0(x) if(_WIFIMGR_LOGLEVEL_>3) { DBG_PORT.print(x); } +#define LOGDEBUG1(x,y) if(_WIFIMGR_LOGLEVEL_>3) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.println(y); } +#define LOGDEBUG2(x,y,z) if(_WIFIMGR_LOGLEVEL_>3) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.print(y); DBG_PORT.print(" "); DBG_PORT.println(z); } +#define LOGDEBUG3(x,y,z,w) if(_WIFIMGR_LOGLEVEL_>3) { DBG_PORT.print("[WM] "); DBG_PORT.print(x); DBG_PORT.print(" "); DBG_PORT.print(y); DBG_PORT.print(" "); DBG_PORT.print(z); DBG_PORT.print(" "); DBG_PORT.println(w); } #endif //ESP_WiFiManager_Debug_H