diff --git a/lib/template_render/template_render.h b/lib/template_render/template_render.h index 0592d5a..736a89c 100644 --- a/lib/template_render/template_render.h +++ b/lib/template_render/template_render.h @@ -1,6 +1,6 @@ #pragma once -#include +#include typedef struct { @@ -8,12 +8,12 @@ typedef struct const String value; } template_substitution_t; -template +template inline String template_render(const char *format, T (&values)[n]) { auto s = String(format); - for (size_t i=0; i" "" - "{{Title}}" APP_TITLE " v" APP_VERSION "" + "" APP_TITLE " v" APP_VERSION "" "" "

Status page for {{ThingName}}


" @@ -79,8 +79,6 @@ void handle_root() "
Go to configure page to change settings."; const template_substitution_t root_page_substitutions[] = { - {"Title", APP_TITLE}, - {"Version", APP_VERSION}, {"ThingName", iotWebConf.getThingName()}, {"ChipModel", ESP.getChipModel()}, {"CpuFreqMHz", String(ESP.getCpuFreqMHz())}, @@ -100,10 +98,8 @@ void handle_root() auto html = template_render(root_page_template, root_page_substitutions); if (config_changed) - { html += "
" "

Configuration has changed. Please restart the device.

"; - } html += ""; web_server.send(200, "text/html", html); @@ -120,11 +116,11 @@ void handle_restart() return; } - String html; - html += "

Restarting...

"; - html += ""; - html += "" APP_TITLE " v" APP_VERSION ""; - html += ""; + const char *html = + "

Restarting...

" + "" + "" APP_TITLE " v" APP_VERSION "" + ""; web_server.send(200, "text/html", html); log_v("Restarting... Press refresh to connect again"); sleep(250);