diff --git a/lib/heatshrink b/lib/heatshrink deleted file mode 160000 index 555f7cf..0000000 --- a/lib/heatshrink +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 555f7cf0b0a508c2f804d4fdf6c1fd0d92f9a798 diff --git a/user/cgi.c b/user/cgi.c index f9b9b10..8a64848 100644 --- a/user/cgi.c +++ b/user/cgi.c @@ -52,13 +52,15 @@ int ICACHE_FLASH_ATTR printGlobalInfo(char *buff, int buflen, char *token) { } #endif -void ICACHE_FLASH_ATTR printGlobalJSON(HttpdConnData *connData) { - httpdSend(connData, - "\n", -1); +extern char *esp_link_version; // in user_main.c + +int ICACHE_FLASH_ATTR cgiMenu(HttpdConnData *connData) { + char buff[1024]; + jsonHeader(connData, 200); + os_sprintf(buff, + "{\"menu\": [\"Home\", \"/home.html\", \"Wifi\", \"/wifi/wifi.html\"," + "\"\xC2\xB5" "C Console\", \"/console.html\", \"Debug log\", \"/log.html\" ],\n" + " \"version\": \"%s\" }", esp_link_version); + httpdSend(connData, buff, -1); + return HTTPD_CGI_DONE; } diff --git a/user/cgi.h b/user/cgi.h index 52af3c6..b5690cf 100644 --- a/user/cgi.h +++ b/user/cgi.h @@ -3,7 +3,7 @@ #include "httpd.h" -void ICACHE_FLASH_ATTR jsonHeader(HttpdConnData *connData, int code); -void ICACHE_FLASH_ATTR printGlobalJSON(HttpdConnData *connData); +void jsonHeader(HttpdConnData *connData, int code); +int cgiMenu(HttpdConnData *connData); #endif diff --git a/user/cgiflash.c b/user/cgiflash.c index 0706695..65bfd21 100644 --- a/user/cgiflash.c +++ b/user/cgiflash.c @@ -125,7 +125,7 @@ int ICACHE_FLASH_ATTR cgiUploadFirmware(HttpdConnData *connData) { // erase next flash block if necessary if (address % SPI_FLASH_SEC_SIZE == 0){ - os_printf("Erasing flash at 0x%05x (id=%d)\n", address, 2-id); + os_printf("Flashing 0x%05x (id=%d)\n", address, 2-id); spi_flash_erase_sector(address/SPI_FLASH_SEC_SIZE); } diff --git a/user/cgiwifi.c b/user/cgiwifi.c index 0ac843a..059fb34 100644 --- a/user/cgiwifi.c +++ b/user/cgiwifi.c @@ -511,7 +511,7 @@ int ICACHE_FLASH_ATTR printWifiInfo(char *buff) { len += os_sprintf(buff+len, ", \"ip\": \"%d.%d.%d.%d\"", IP2STR(&info.ip.addr)); len += os_sprintf(buff+len, ", \"netmask\": \"%d.%d.%d.%d\"", IP2STR(&info.netmask.addr)); len += os_sprintf(buff+len, ", \"gateway\": \"%d.%d.%d.%d\"", IP2STR(&info.gw.addr)); - len += os_sprintf(buff+len, ", \"hostname\": \"%s\"", wifi_station_get_hostname()); + len += os_sprintf(buff+len, ", \"hostname\": \"%s\"", flashConfig.hostname); } else { len += os_sprintf(buff+len, ", \"ip\": \"-none-\""); } diff --git a/user/user_main.c b/user/user_main.c index e8aa929..c16497f 100644 --- a/user/user_main.c +++ b/user/user_main.c @@ -59,28 +59,27 @@ general ones. Authorization things (like authBasic) act as a 'barrier' and should be placed above the URLs they protect. */ HttpdBuiltInUrl builtInUrls[]={ - {"/", cgiRedirect, "/home.tpl"}, + {"/", cgiRedirect, "/home.html"}, + {"/menu", cgiMenu, NULL}, {"/flash/next", cgiGetFirmwareNext, NULL}, {"/flash/upload", cgiUploadFirmware, NULL}, {"/flash/reboot", cgiRebootFirmware, NULL}, - {"/home.tpl", cgiEspFsHtml, NULL}, - //{"/help.tpl", cgiEspFsTemplate, tplCounter}, - {"/log.tpl", cgiEspFsHtml, NULL}, + //{"/home.html", cgiEspFsHtml, NULL}, + //{"/log.html", cgiEspFsHtml, NULL}, {"/log/text", ajaxLog, NULL}, - {"/console.tpl", cgiEspFsHtml, NULL}, + //{"/console.html", cgiEspFsHtml, NULL}, {"/console/reset", ajaxConsoleReset, NULL}, {"/console/baud", ajaxConsoleBaud, NULL}, {"/console/text", ajaxConsole, NULL}, - {"/help.tpl", cgiEspFsHtml, NULL}, //Routines to make the /wifi URL and everything beneath it work. //Enable the line below to protect the WiFi configuration with an username/password combo. // {"/wifi/*", authBasic, myPassFn}, - {"/wifi", cgiRedirect, "/wifi/wifi.tpl"}, - {"/wifi/", cgiRedirect, "/wifi/wifi.tpl"}, - {"/wifi/wifi.tpl", cgiEspFsHtml, NULL}, + {"/wifi", cgiRedirect, "/wifi/wifi.html"}, + {"/wifi/", cgiRedirect, "/wifi/wifi.html"}, + //{"/wifi/wifi.html", cgiEspFsHtml, NULL}, {"/wifi/info", cgiWifiInfo, NULL}, {"/wifi/scan", cgiWiFiScan, NULL}, {"/wifi/connect", cgiWiFiConnect, NULL},