mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 17:59:27 +02:00
Use template in rendering
This commit is contained in:
parent
5ac816b80f
commit
376b2c6faf
6 changed files with 527 additions and 215 deletions
|
@ -187,9 +187,15 @@ void init_webserver() {
|
|||
|
||||
// Route for going to settings web page
|
||||
server.on("/settings", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||
if (WEBSERVER_AUTH_REQUIRED && !request->authenticate(http_username, http_password))
|
||||
if (WEBSERVER_AUTH_REQUIRED && !request->authenticate(http_username, http_password)) {
|
||||
return request->requestAuthentication();
|
||||
request->send(200, "text/html", index_html, settings_processor);
|
||||
}
|
||||
|
||||
// Using make_shared to ensure lifetime for the settings object during send() lambda execution
|
||||
auto settings = std::make_shared<BatteryEmulatorSettingsStore>(true);
|
||||
|
||||
request->send(200, "text/html", settings_html,
|
||||
[settings](const String& content) { return settings_processor(content, *settings); });
|
||||
});
|
||||
|
||||
// Route for going to advanced battery info web page
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue