use moustache library

This commit is contained in:
Rene Zeldenthuis
2022-10-01 17:02:24 +02:00
parent a989878e4b
commit 6d245acc52
4 changed files with 7 additions and 64 deletions

View File

@@ -10,7 +10,7 @@
#include <camera_config.h>
#include <format_duration.h>
#include <format_number.h>
#include <template_render.h>
#include <moustache.h>
#include <html_data.h>
#include <html_data_gzip.h>
#include <settings.h>
@@ -68,7 +68,7 @@ void handle_root()
// Wifi Modes
const char *wifi_modes[] = {"NULL", "STA", "AP", "STA+AP"};
const template_variable_t substitutions[] = {
const moustache_variable_t substitutions[] = {
// Config Changed?
{"ConfigChanged", String(config_changed)},
// Version / CPU
@@ -112,7 +112,7 @@ void handle_root()
{"RtspPort", String(RTSP_PORT)}};
web_server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
auto html = template_render(file_data_index_html, substitutions);
auto html = moustache_render(file_data_index_html, substitutions);
web_server.send(200, "text/html", html);
}
@@ -128,12 +128,12 @@ void handle_restart()
return;
}
const template_variable_t substitutions[] = {
const moustache_variable_t substitutions[] = {
{"AppTitle", APP_TITLE},
{"AppVersion", APP_VERSION},
{"ThingName", iotWebConf.getThingName()}};
auto html = template_render(file_data_restart_html, substitutions);
auto html = moustache_render(file_data_restart_html, substitutions);
web_server.send(200, "text/html", html);
log_v("Restarting... Press refresh to connect again");
sleep(100);