Browse Source

Option to enable/disable web auth from web UI

rfm69
Xose Pérez 6 years ago
parent
commit
d9cd999db9
5 changed files with 2522 additions and 2509 deletions
  1. +1
    -0
      code/espurna/config/general.h
  2. BIN
      code/espurna/data/index.html.gz
  3. +2509
    -2508
      code/espurna/static/index.html.gz.h
  4. +7
    -1
      code/espurna/ws.ino
  5. +5
    -0
      code/html/index.html

+ 1
- 0
code/espurna/config/general.h View File

@ -405,6 +405,7 @@ PROGMEM const char* const custom_reset_string[] = {
// This will only be enabled if WEB_SUPPORT is 1 (this is the default value) // This will only be enabled if WEB_SUPPORT is 1 (this is the default value)
#define WS_AUTHENTICATION 1 // WS authentication ON by default (see #507)
#define WS_BUFFER_SIZE 5 // Max number of secured websocket connections #define WS_BUFFER_SIZE 5 // Max number of secured websocket connections
#define WS_TIMEOUT 1800000 // Timeout for secured websocket #define WS_TIMEOUT 1800000 // Timeout for secured websocket
#define WS_UPDATE_INTERVAL 30000 // Update clients every 30 seconds #define WS_UPDATE_INTERVAL 30000 // Update clients every 30 seconds


BIN
code/espurna/data/index.html.gz View File


+ 2509
- 2508
code/espurna/static/index.html.gz.h
File diff suppressed because it is too large
View File


+ 7
- 1
code/espurna/ws.ino View File

@ -270,6 +270,7 @@ void _wsOnStart(JsonObject& root) {
root["btnDelay"] = getSetting("btnDelay", BUTTON_DBLCLICK_DELAY).toInt(); root["btnDelay"] = getSetting("btnDelay", BUTTON_DBLCLICK_DELAY).toInt();
root["webPort"] = getSetting("webPort", WEB_PORT).toInt(); root["webPort"] = getSetting("webPort", WEB_PORT).toInt();
root["wsAuth"] = getSetting("wsAuth", WS_AUTHENTICATION).toInt() == 1;
} }
@ -388,7 +389,12 @@ void wsSend_P(uint32_t client_id, PGM_P payload) {
void wsConfigure() { void wsConfigure() {
#if USE_PASSWORD #if USE_PASSWORD
_ws.setAuthentication(WEB_USERNAME, (const char *) getSetting("adminPass", ADMIN_PASS).c_str());
bool auth = getSetting("wsAuth", WS_AUTHENTICATION).toInt() == 1;
if (auth) {
_ws.setAuthentication(WEB_USERNAME, (const char *) getSetting("adminPass", ADMIN_PASS).c_str());
} else {
_ws.setAuthentication("", "");
}
#endif #endif
} }


+ 5
- 0
code/html/index.html View File

@ -471,6 +471,11 @@
</div> </div>
</div> </div>
<div class="pure-g">
<label class="pure-u-1 pure-u-lg-1-4">Enable WS Auth</label>
<div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="wsAuth" /></div>
</div>
<div class="pure-g"> <div class="pure-g">
<label class="pure-u-1 pure-u-lg-1-4">Enable HTTP API</label> <label class="pure-u-1 pure-u-lg-1-4">Enable HTTP API</label>
<div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="apiEnabled" /></div> <div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="apiEnabled" /></div>


Loading…
Cancel
Save