use html and js escapes for tpl strings
This commit is contained in:
+10
-9
@@ -1,6 +1,7 @@
|
||||
#include <esp8266.h>
|
||||
#include <httpd.h>
|
||||
#include <esp_sdk_ver.h>
|
||||
#include <httpdespfs.h>
|
||||
|
||||
#include "cgi_main.h"
|
||||
#include "screen.h"
|
||||
@@ -26,11 +27,11 @@ httpd_cgi_state ICACHE_FLASH_ATTR tplScreen(HttpdConnData *connData, char *token
|
||||
|
||||
if (streq(token, "labels_seq")) {
|
||||
screenSerializeLabelsToBuffer(buff, 150);
|
||||
httpdSend(connData, buff, -1);
|
||||
tplSend(connData, buff, -1);
|
||||
}
|
||||
else if (streq(token, "theme")) {
|
||||
sprintf(buff, "%d", termconf->theme);
|
||||
httpdSend(connData, buff, -1);
|
||||
tplSend(connData, buff, -1);
|
||||
}
|
||||
|
||||
return HTTPD_CGI_DONE;
|
||||
@@ -56,7 +57,7 @@ cgiTermInitialImage(HttpdConnData *connData)
|
||||
}
|
||||
|
||||
httpd_cgi_state cont = screenSerializeToBuffer(buff, bufsiz, &connData->cgiData);
|
||||
httpdSend(connData, buff, -1);
|
||||
httpdSend(connData, buff, -1); // no encode
|
||||
return cont;
|
||||
}
|
||||
|
||||
@@ -67,22 +68,22 @@ tplAbout(HttpdConnData *connData, char *token, void **arg)
|
||||
if (token == NULL) return HTTPD_CGI_DONE;
|
||||
|
||||
if (streq(token, "vers_fw")) {
|
||||
httpdSend(connData, FIRMWARE_VERSION, -1);
|
||||
tplSend(connData, FIRMWARE_VERSION, -1);
|
||||
}
|
||||
else if (streq(token, "date")) {
|
||||
httpdSend(connData, __DATE__, -1);
|
||||
tplSend(connData, __DATE__, -1);
|
||||
}
|
||||
else if (streq(token, "time")) {
|
||||
httpdSend(connData, __TIME__, -1);
|
||||
tplSend(connData, __TIME__, -1);
|
||||
}
|
||||
else if (streq(token, "vers_httpd")) {
|
||||
httpdSend(connData, HTTPDVER, -1);
|
||||
tplSend(connData, HTTPDVER, -1);
|
||||
}
|
||||
else if (streq(token, "vers_sdk")) {
|
||||
httpdSend(connData, STR(ESP_SDK_VERSION), -1);
|
||||
tplSend(connData, STR(ESP_SDK_VERSION), -1);
|
||||
}
|
||||
else if (streq(token, "githubrepo")) {
|
||||
httpdSend(connData, TERMINAL_GITHUB_REPO, -1);
|
||||
tplSend(connData, TERMINAL_GITHUB_REPO, -1);
|
||||
}
|
||||
|
||||
return HTTPD_CGI_DONE;
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ configuring the network settings
|
||||
*/
|
||||
|
||||
#include <esp8266.h>
|
||||
#include <httpdespfs.h>
|
||||
#include "cgi_network.h"
|
||||
#include "wifimgr.h"
|
||||
#include "persist.h"
|
||||
@@ -246,6 +247,6 @@ httpd_cgi_state ICACHE_FLASH_ATTR tplNetwork(HttpdConnData *connData, char *toke
|
||||
sprintf(buff, MACSTR, MAC2STR(mac));
|
||||
}
|
||||
|
||||
httpdSend(connData, buff, -1);
|
||||
tplSend(connData, buff, -1);
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
#include <esp8266.h>
|
||||
#include <httpd.h>
|
||||
#include <helpers.h>
|
||||
#include <httpdespfs.h>
|
||||
|
||||
#include "cgi_system.h"
|
||||
#include "persist.h"
|
||||
@@ -159,6 +160,6 @@ tplSystemCfg(HttpdConnData *connData, char *token, void **arg)
|
||||
sprintf(buff, "%d", sysconf->uart_stopbits);
|
||||
}
|
||||
|
||||
httpdSend(connData, buff, -1);
|
||||
tplSend(connData, buff, -1);
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ Cgi/template routines for configuring non-wifi settings
|
||||
*/
|
||||
|
||||
#include <esp8266.h>
|
||||
#include <httpdespfs.h>
|
||||
#include "cgi_term_cfg.h"
|
||||
#include "persist.h"
|
||||
#include "screen.h"
|
||||
@@ -165,6 +166,6 @@ tplTermCfg(HttpdConnData *connData, char *token, void **arg)
|
||||
}
|
||||
}
|
||||
|
||||
httpdSend(connData, buff, -1);
|
||||
tplSend(connData, buff, -1);
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
+3
-2
@@ -14,6 +14,7 @@ Cgi/template routines for the /wifi url.
|
||||
*/
|
||||
|
||||
#include <esp8266.h>
|
||||
#include <httpdespfs.h>
|
||||
#include "cgi_wifi.h"
|
||||
#include "wifimgr.h"
|
||||
#include "persist.h"
|
||||
@@ -302,7 +303,7 @@ httpd_cgi_state ICACHE_FLASH_ATTR cgiWiFiConnStatus(HttpdConnData *connData)
|
||||
break;
|
||||
}
|
||||
|
||||
httpdSend(connData, buff, -1);
|
||||
tplSend(connData, buff, -1);
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
@@ -585,6 +586,6 @@ httpd_cgi_state ICACHE_FLASH_ATTR tplWlan(HttpdConnData *connData, char *token,
|
||||
}
|
||||
}
|
||||
|
||||
httpdSend(connData, buff, -1);
|
||||
tplSend(connData, buff, -1);
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user