Added Help and About pages
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
#include <esp8266.h>
|
||||
#include <httpd.h>
|
||||
#include <esp_sdk_ver.h>
|
||||
|
||||
#include "cgi_main.h"
|
||||
#include "screen.h"
|
||||
#include "user_main.h"
|
||||
|
||||
#define STR_HELPER(x) #x
|
||||
#define STR(x) STR_HELPER(x)
|
||||
|
||||
/**
|
||||
* Main page template substitution
|
||||
@@ -32,3 +37,29 @@ httpd_cgi_state ICACHE_FLASH_ATTR tplScreen(HttpdConnData *connData, char *token
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
/** "About" page */
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR tplAbout(HttpdConnData *connData, char *token, void **arg)
|
||||
{
|
||||
if (token == NULL) return HTTPD_CGI_DONE;
|
||||
|
||||
if (streq(token, "vers_fw")) {
|
||||
httpdSend(connData, FIRMWARE_VERSION, -1);
|
||||
}
|
||||
else if (streq(token, "date")) {
|
||||
httpdSend(connData, __DATE__, -1);
|
||||
}
|
||||
else if (streq(token, "time")) {
|
||||
httpdSend(connData, __TIME__, -1);
|
||||
}
|
||||
else if (streq(token, "vers_httpd")) {
|
||||
httpdSend(connData, HTTPDVER, -1);
|
||||
}
|
||||
else if (streq(token, "vers_sdk")) {
|
||||
httpdSend(connData, STR(ESP_SDK_VERSION), -1);
|
||||
}
|
||||
else if (streq(token, "githubrepo")) {
|
||||
httpdSend(connData, TERMINAL_GITHUB_REPO, -1);
|
||||
}
|
||||
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
#define CGI_MAIN_H
|
||||
|
||||
httpd_cgi_state tplScreen(HttpdConnData *connData, char *token, void **arg);
|
||||
httpd_cgi_state tplAbout(HttpdConnData *connData, char *token, void **arg);
|
||||
|
||||
#endif // CGI_MAIN_H
|
||||
|
||||
@@ -27,6 +27,8 @@ HttpdBuiltInUrl routes[] = {
|
||||
|
||||
// --- Web pages ---
|
||||
ROUTE_TPL_FILE("/", tplScreen, "/term.tpl"),
|
||||
ROUTE_TPL_FILE("/about", tplAbout, "/about.tpl"),
|
||||
ROUTE_FILE("/help", "/help.tpl"),
|
||||
|
||||
// --- Sockets ---
|
||||
ROUTE_WS(URL_WS_UPDATE, updateSockConnect),
|
||||
|
||||
+4
-5
@@ -7,9 +7,9 @@
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* "THE BEER-WARE LICENSE" (Revision 42):
|
||||
* Jeroen Domburg <jeroen@spritesmods.com> wrote this file. As long as you retain
|
||||
* this notice you can do whatever you want with this stuff. If we meet some day,
|
||||
* and you think this stuff is worth it, you can buy me a beer in return.
|
||||
* Jeroen Domburg <jeroen@spritesmods.com> wrote this file. As long as you retain
|
||||
* this notice you can do whatever you want with this stuff. If we meet some day,
|
||||
* and you think this stuff is worth it, you can buy me a beer in return.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
#include "io.h"
|
||||
#include "screen.h"
|
||||
#include "routes.h"
|
||||
|
||||
#define FIRMWARE_VERSION "0.3"
|
||||
#include "user_main.h"
|
||||
|
||||
#ifdef ESPFS_POS
|
||||
CgiUploadFlashDef uploadParams={
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef USER_MAIN_H_H
|
||||
#define USER_MAIN_H_H
|
||||
|
||||
#define FIRMWARE_VERSION "0.4"
|
||||
#define TERMINAL_GITHUB_REPO "https://github.com/MightyPork/esp-vt100-firmware"
|
||||
|
||||
#endif //USER_MAIN_H_H
|
||||
Reference in New Issue
Block a user