git hashes on about page

http-comm
Ondřej Hruška 7 years ago
parent 038c3b6466
commit 128515a9a7
  1. 3
      Makefile
  2. 2
      front-end
  3. 37
      user/cgi_main.c
  4. 9
      user/cgi_term_cfg.c
  5. 1
      user/routes.c
  6. 10
      user/screen.c
  7. 7
      user/screen.h
  8. 3
      user/version.h

@ -67,7 +67,8 @@ CFLAGS = -Os -std=gnu99 -Werror -Wpointer-arith -Wundef -Wall -Wl,-EL -fno-inli
-nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH \
-Wno-address -Wno-unused
CFLAGS += -DGIT_HASH='"$(shell git rev-parse --short HEAD)"'
CFLAGS += -DGIT_HASH_BACKEND='"$(shell git rev-parse --short HEAD)"'
CFLAGS += -DGIT_HASH_FRONTEND='"$(shell cd front-end && git rev-parse --short HEAD)"'
CFLAGS += -DADMIN_PASSWORD=$(ADMIN_PASSWORD)
ifdef GLOBAL_CFLAGS

@ -1 +1 @@
Subproject commit 2b93cedd3fca3350cfa0ca8aef92630ca5fe8501
Subproject commit fd2a6df24593edbd51f497190649ebaa0b917936

@ -33,32 +33,12 @@ httpd_cgi_state ICACHE_FLASH_ATTR tplScreen(HttpdConnData *connData, char *token
sprintf(buff, "%d", termconf->theme);
tplSend(connData, buff, -1);
}
return HTTPD_CGI_DONE;
}
httpd_cgi_state ICACHE_FLASH_ATTR
cgiTermInitialImage(HttpdConnData *connData)
{
const int bufsiz = 512;
char buff[bufsiz];
if (connData->conn == NULL) {
//Connection aborted. Clean up.
// Release data object
screenSerializeToBuffer(NULL, 0, &connData->cgiData);
return HTTPD_CGI_DONE;
}
if (connData->cgiData == NULL) {
httpdStartResponse(connData, 200);
httpdHeader(connData, "Content-Type", "application/octet-stream");
httpdEndHeaders(connData);
else if (streq(token, "want_all_fn")) {
sprintf(buff, "%d", termconf->want_all_fn);
tplSend(connData, buff, -1);
}
httpd_cgi_state cont = screenSerializeToBuffer(buff, bufsiz, &connData->cgiData);
httpdSend(connData, buff, -1); // no encode
return cont;
return HTTPD_CGI_DONE;
}
/** "About" page */
@ -82,9 +62,18 @@ tplAbout(HttpdConnData *connData, char *token, void **arg)
else if (streq(token, "vers_sdk")) {
tplSend(connData, STR(ESP_SDK_VERSION), -1);
}
else if (streq(token, "hash_backend")) {
tplSend(connData, GIT_HASH_BACKEND, -1);
}
else if (streq(token, "hash_frontend")) {
tplSend(connData, GIT_HASH_FRONTEND, -1);
}
else if (streq(token, "githubrepo")) {
tplSend(connData, TERMINAL_GITHUB_REPO, -1);
}
else if (streq(token, "githubrepo_front")) {
tplSend(connData, TERMINAL_GITHUB_REPO_FRONT, -1);
}
return HTTPD_CGI_DONE;
}

@ -137,6 +137,12 @@ cgiTermCfgSetParams(HttpdConnData *connData)
notify_screen_content = true;
}
if (GET_ARG("want_all_fn")) {
cgi_dbg("AllFN mode: %s", buff);
n = atoi(buff);
termconf->want_all_fn = (bool)n;
}
if (GET_ARG("crlf_mode")) {
cgi_dbg("CRLF mode: %s", buff);
n = atoi(buff);
@ -321,6 +327,9 @@ tplTermCfg(HttpdConnData *connData, char *token, void **arg)
else if (streq(token, "fn_alt_mode")) {
sprintf(buff, "%d", (int)termconf->fn_alt_mode);
}
else if (streq(token, "want_all_fn")) {
sprintf(buff, "%d", (int)termconf->want_all_fn);
}
else if (streq(token, "crlf_mode")) {
sprintf(buff, "%d", (int)termconf->crlf_mode);
}

@ -32,7 +32,6 @@ const HttpdBuiltInUrl routes[] ESP_CONST_DATA = {
ROUTE_FILE("/help/?", "/help.html"),
// --- Sockets ---
ROUTE_CGI("/term/init", cgiTermInitialImage),
ROUTE_WS(URL_WS_UPDATE, updateSockConnect),
// --- System control ---

@ -188,6 +188,7 @@ terminal_restore_defaults(void)
termconf->show_config_links = SCR_DEF_SHOW_MENU;
termconf->cursor_shape = SCR_DEF_CURSOR_SHAPE;
termconf->crlf_mode = SCR_DEF_CRLF;
termconf->want_all_fn = SCR_DEF_ALLFN;
}
/**
@ -231,7 +232,7 @@ terminal_apply_settings_noclear(void)
changed = 1;
}
// Migrate to v3
// Migrate to v4
if (termconf->config_version < 4) {
persist_dbg("termconf: Updating to version 4");
termconf->cursor_shape = CURSOR_BLOCK_BL;
@ -239,6 +240,13 @@ terminal_apply_settings_noclear(void)
changed = 1;
}
// Migrate to v5
if (termconf->config_version < 4) {
persist_dbg("termconf: Updating to version 5");
termconf->want_all_fn = 0;
changed = 1;
}
termconf->config_version = TERMCONF_VERSION;
// Validation...

@ -37,7 +37,7 @@
// Size designed for the terminal config structure
// Must be constant to avoid corrupting user config after upgrade
#define TERMCONF_SIZE 300
#define TERMCONF_VERSION 4
#define TERMCONF_VERSION 5
#define TERM_BTN_LEN 10
#define TERM_BTN_MSG_LEN 10
@ -46,7 +46,7 @@
#define SCR_DEF_DISPLAY_TOUT_MS 12
#define SCR_DEF_DISPLAY_COOLDOWN_MS 35
#define SCR_DEF_PARSER_TOUT_MS 10
#define SCR_DEF_PARSER_TOUT_MS 0
#define SCR_DEF_FN_ALT_MODE true // true - SS3 codes, easier to parse & for xterm compatibility
#define SCR_DEF_WIDTH 26
#define SCR_DEF_HEIGHT 10
@ -69,7 +69,7 @@ enum CursorShape {
#define SCR_DEF_SHOW_MENU 1
#define SCR_DEF_CURSOR_SHAPE CURSOR_BLOCK_BL
#define SCR_DEF_CRLF 0
#define SCR_DEF_ALLFN 0
// --- Persistent Settings ---
#define CURSOR_BLINKS(shape) ((shape)==CURSOR_BLOCK_BL||(shape)==CURSOR_UNDERLINE_BL||(shape)==CURSOR_BAR_BL)
@ -93,6 +93,7 @@ typedef struct {
char btn_msg[TERM_BTN_COUNT][TERM_BTN_MSG_LEN];
enum CursorShape cursor_shape;
bool crlf_mode;
bool want_all_fn;
} TerminalConfigBundle;
// Live config

@ -9,8 +9,9 @@
#define FW_V_MINOR 1
#define FW_V_PATCH 0
#define FIRMWARE_VERSION STR(FW_V_MAJOR) "." STR(FW_V_MINOR) "." STR(FW_V_PATCH) "+" GIT_HASH
#define FIRMWARE_VERSION STR(FW_V_MAJOR) "." STR(FW_V_MINOR) "." STR(FW_V_PATCH)
#define FIRMWARE_VERSION_NUM (FW_V_MAJOR*1000 + FW_V_MINOR*10 + FW_V_PATCH) // this is used in ID queries
#define TERMINAL_GITHUB_REPO "https://github.com/espterm/espterm-firmware"
#define TERMINAL_GITHUB_REPO_FRONT "https://github.com/espterm/espterm-front-end"
#endif //ESP_VT100_FIRMWARE_VERSION_H

Loading…
Cancel
Save