Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/base/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ void Application::initWebServer(ESP8266WebServer &server, bool &shouldReboot, bo
server.sendHeader(F("Content-Encoding"), F("gzip"));
server.send_P(200, PSTR("text/html"), getHTMLContent(fw), getHTMLContentSize(fw)); });

// HTML mn handler
sprintf_P(url, PSTR("/mn%c.html"), _appId);
server.on(url, HTTP_GET, [this, &server]()
{
server.keepAlive(false);
server.sendHeader(F("Content-Encoding"), F("gzip"));
server.send_P(200, PSTR("text/html"), getHTMLContent(mn), getHTMLContentSize(mn)); });

// HTML discover handler
sprintf_P(url, PSTR("/discover%c.html"), _appId);
server.on(url, HTTP_GET, [this, &server]()
Expand Down Expand Up @@ -288,4 +296,4 @@ void Application::run()
#endif

appRun();
}
}
3 changes: 2 additions & 1 deletion src/base/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Application
status,
config,
fw,
mn,
discover
} WebPageForPlaceHolder;

Expand Down Expand Up @@ -70,4 +71,4 @@ class Application
void run();
};

#endif
#endif
8 changes: 7 additions & 1 deletion src/base/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ const PROGMEM char *Core::getHTMLContent(WebPageForPlaceHolder wp)
case fw:
return fw0htmlgz;
break;
case mn:
return mn0htmlgz;
break;
case discover:
return discover0htmlgz;
break;
Expand All @@ -70,6 +73,9 @@ size_t Core::getHTMLContentSize(WebPageForPlaceHolder wp)
case fw:
return sizeof(fw0htmlgz);
break;
case mn:
return sizeof(mn0htmlgz);
break;
case discover:
return sizeof(discover0htmlgz);
break;
Expand Down Expand Up @@ -278,4 +284,4 @@ void Core::appInitWebServer(ESP8266WebServer &server, bool &shouldReboot, bool &
{
server.keepAlive(false);
server.send(404); });
}
}
3 changes: 2 additions & 1 deletion src/base/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "data/status0.html.gz.h"
#include "data/config0.html.gz.h"
#include "data/fw0.html.gz.h"
#include "data/mn0.html.gz.h"
#include "data/discover0.html.gz.h"

class Core : public Application
Expand All @@ -30,4 +31,4 @@ class Core : public Application
Core(char appId, String fileName) : Application(appId, fileName) {}
};

#endif
#endif
13 changes: 11 additions & 2 deletions src/base/data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
class="pure-menu-link">Status</a></li>
<li class="pure-menu-item" id="menuConfig"><a href="" class="pure-menu-link">Config</a></li>
<li class="pure-menu-item" id="menuFirmware"><a href="" class="pure-menu-link">Firmware</a></li>
<li class="pure-menu-item" id="menuMonitor"><a href="" class="pure-menu-link">Monitor</a></li>
<li class="pure-menu-item" id="menuDiscover"><a href="" class="pure-menu-link">Discover</a></li>
</ul>
</div>
Expand Down Expand Up @@ -155,11 +156,11 @@ <h1 id="mainHeader"></h1>
el.dispatchEvent(evt);
}


function emptyContents() {
$("#menuStatus").classList.remove("pure-menu-selected");
$("#menuConfig").classList.remove("pure-menu-selected");
$("#menuFirmware").classList.remove("pure-menu-selected");
$("#menuMonitor").classList.remove("pure-menu-selected");
$("#menuDiscover").classList.remove("pure-menu-selected");

$("#content0").innerHTML = '';
Expand Down Expand Up @@ -213,6 +214,14 @@ <h1 id="mainHeader"></h1>
load($("#content0"), "/fw0.html");
});

$("#menuMonitor").addEventListener("click", function (evt) {
evt.preventDefault();
emptyContents();
$("#menuMonitor").classList.add("pure-menu-selected");
$("#mainHeader").textContent = "Monitor";
load($("#content0"), "/mn0.html");
});

$("#menuDiscover").addEventListener("click", function (evt) {
evt.preventDefault();
emptyContents();
Expand All @@ -223,4 +232,4 @@ <h1 id="mainHeader"></h1>
</script>
</body>

</html>
</html>
Loading