Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

CloudFlare link in the default portal #21

Closed
tom-dierckx opened this issue Jul 22, 2020 · 1 comment
Closed

CloudFlare link in the default portal #21

tom-dierckx opened this issue Jul 22, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@tom-dierckx
Copy link

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

@khoih-prog
Copy link
Owner

khoih-prog commented Jul 22, 2020

@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,

khoih-prog added a commit that referenced this issue Jul 30, 2020
### Releases 1.0.9

1. Fix ESP32 STAstaticIP bug. 
2. Enable changing from DHCP <-> static IP using Config Portal.
3. Enable NTP configuration from sketch (USE_ESP_WIFIMANAGER_NTP, USE_CLOUDFLARE_NTP). See Issue #21: [CloudFlare link in the default portal](#21).
4. Add, enhance examples (fix MDNS for ESP32 examples, add DRD feature).
@khoih-prog khoih-prog added the enhancement New feature or request label Jan 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants