esp8266-fastled-webserver icon indicating copy to clipboard operation
esp8266-fastled-webserver copied to clipboard

[Request] Customizable favorites

Open FreezyExp opened this issue 6 years ago • 1 comments

Adding a page where a 'simpler then simple' remote controller can be configured. I think a page with big buttons (configurable size?), would prove very useful in daily operation.

I would like to dumb down the interface, without losing any of the goodies it can offer. I could add a duplicate of simple.html and edit it to what I need, but what of features not yet configurable?

Proposal: quick.html page, with buttons to all the pre-configured favorites. a setupQuick.html page that handles adding / editing / removing favorites.

FreezyExp avatar Jun 09 '19 20:06 FreezyExp

Adding CORS support to the websockets, allowed me to run the website locally and still be able to control it from modern browsers. This makes the UI both easier to update and faster to control.

So I added a function to send the CORS headers and added a call to it in all the .on events, except the ones that were obviously not in need of this.

webServer.on("...", HTTP_POST, []() {
    sendCors();

void sendCors()
{
  if (webServer.hasHeader("origin")) {
      String originValue = webServer.header("origin");
      webServer.sendHeader("Access-Control-Allow-Origin", originValue);
      webServer.sendHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization");
      webServer.sendHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS");
      webServer.sendHeader("Access-Control-Max-Age", "600");
      webServer.sendHeader("Vary", "Origin");
  }
}

Someone that actually understands what this is supposed to do, might be able to limit it to just the light unit. But this worked for me.

FreezyExp avatar Oct 05 '19 22:10 FreezyExp