khoih-prog/ESP_WiFiManager

CloudFlare link in the default portal

tom-dierckx opened this issue · 1 comments

The default portal hangs on a request to a Cloadflare link for a javascript library.
This effectively breaks the application on connected devices that do not have another link to the internet.
Is this as intended? After blocking a request to the Cloadflare cdn on the client the self service portal works.

(The link in question https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.js)

Regards and thank you for the amazing work,

Tom

@tom-dierckx

Thanks for using the library and your encouraging words.

The NTP access to cloudflare.com was an enhancement from a request for a special use case. See Feature Request! Firmware and Data (SPIFFS) update OTA and NTP Timezone #5

You can disable it if it's not necessary to avoid above-mentioned issue by either

  1. Edit ESP_WiFiManager.h, and modify the line to
// From v1.0.6 to enable NTP config
#define USE_ESP_WIFIMANAGER_NTP     false

from

// From v1.0.6 to enable NTP config
#define USE_ESP_WIFIMANAGER_NTP     true
  1. Edit ESP_WiFiManager.h, and modify the line to
#if 0
const char HTTP_SCRIPT_NTP[] PROGMEM = "<script src='https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.js'></script><script>var timezone=jstz.determine();console.log('Your timezone is:' + timezone.name());document.getElementById('timezone').innerHTML = timezone.name();</script>";
#else

from

#if 1
const char HTTP_SCRIPT_NTP[] PROGMEM = "<script src='https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.js'></script><script>var timezone=jstz.determine();console.log('Your timezone is:' + timezone.name());document.getElementById('timezone').innerHTML = timezone.name();</script>";
#else

In future version, I'll add an option to let you define the option in sketch, instead of modifying the library directly, such as

#define USE_ESP_WIFIMANAGER_NTP       true
#define USE_CLOUDFLARE_NTP            true
#define USE_ESP_WIFIMANAGER_NTP       true
#define USE_CLOUDFLARE_NTP            false

or

#define USE_ESP_WIFIMANAGER_NTP       false
#define USE_CLOUDFLARE_NTP            false

Please test and let me know the results as well as your suggestions

Regards,