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

custom html header #4

Closed
piecol opened this issue Feb 15, 2021 · 4 comments
Closed

custom html header #4

piecol opened this issue Feb 15, 2021 · 4 comments
Labels
enhancement New feature or request Support Library support

Comments

@piecol
Copy link

piecol commented Feb 15, 2021

hi,

would it be possible to add a parameter to define a custom html header ? this would provide a simple way to taylor the AP page to one's project in a safe way.

If not, what would be your recommended approach? currently, I hard-code it in the src/WiFiManager_NINA_Lite_SAMD.h file, but this might break with library upgrades.

String custom_html = "<!DOCTYPE html>..."

const char WIFININA_HTML_HEAD[]     /*PROGMEM*/ = custom_html;

thanks

@khoih-prog
Copy link
Owner

khoih-prog commented Feb 17, 2021

Hi @piecol

Thanks for your interests in the library and the request for enhancement.

When I first started to write these Lite libraries, I just thought to make it simple, reliable and as much as useful as possible for many different types of boards / shields, with the trade-off being without customs and special case headers.

Now, with your first enhancement request, I'll add the capabilities of adding / modifying special customs headers, such as CORS, etc. as follows

  1. Permanent in HTML
const char WM_HTTP_CACHE_CONTROL[]   PROGMEM = "Cache-Control";
const char WM_HTTP_NO_STORE[]        PROGMEM = "no-cache, no-store, must-revalidate";
const char WM_HTTP_PRAGMA[]          PROGMEM = "Pragma";
const char WM_HTTP_NO_CACHE[]        PROGMEM = "no-cache";
const char WM_HTTP_EXPIRES[]         PROGMEM = "Expires";
  1. Optional in HTML
const char WM_HTTP_CORS[]            PROGMEM = "Access-Control-Allow-Origin";
const char WM_HTTP_CORS_ALLOW_ALL[]  PROGMEM = "*";
  1. Functions for CORS, customs headers
void setCORSHeader(const char* CORSHeaders);
const char* getCORSHeader();
void setCustomsHeader(const char* CustomsHeaders);
const char* getCustomsHeader();

What else do you suggest ?

Please wait for new release within several days.

@khoih-prog khoih-prog added enhancement New feature or request Support Library support labels Feb 17, 2021
@piecol
Copy link
Author

piecol commented Feb 18, 2021

hi @khoih-prog,

thanks for considering my request!

for the application I am developing it would be helpful to implement:

  • a captive portal once the connection with the AP is set, to avoid browsing for 192.168.4.1
  • easy/basic stilying of the html page (set page background and button colors, border-radius of input/button, and such)

cheers

@khoih-prog
Copy link
Owner

Hi @piecol

The new release to support Configurable Customs HTML Headers has been published on Arduino as well as in PIO : WiFiManager_NINA_Lite.

Your contribution has been noted in Contributions and Thanks

Please have a look at

  1. To use custom HTML Style
  2. To use custom Head Elements

The Captive Portal is not working reliably yet. You can try to include WiFiManager_NINA_Lite_SAMD_CP.h instead of WiFiManager_NINA_Lite_SAMD.h to see if Captive Portal is working for you.


Major Release v1.1.0

  1. Configurable Customs HTML Headers, including Customs Style, Customs Gead Elements, CORS Header.
  2. Add support to boards using WiFi101 library such as MKR1000
  3. Fix Config Portal Bug.
  4. Add functions to control Config Portal from software or Virtual Switches. Check How to trigger a Config Portal from code #25
  5. Use more efficient FlashStorage_SAMD v1.1.0 and FlashStorage_STM32 v1.00
  6. Optimize code
  7. Add Version String

@piecol
Copy link
Author

piecol commented Feb 20, 2021

Thanks @khoih-prog !

Great news 😃

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request Support Library support
Projects
None yet
Development

No branches or pull requests

2 participants