From be3c0fe926f4c57d2e0c15ea07730c46ec23b1a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sun, 22 Jan 2017 21:55:03 +0100 Subject: [PATCH] updated lib & fixed compatibility --- libesphttpd | 2 +- user/user_main.c | 46 +++++++++++++++++++++++----------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/libesphttpd b/libesphttpd index 896caa5..cc6e7da 160000 --- a/libesphttpd +++ b/libesphttpd @@ -1 +1 @@ -Subproject commit 896caa5f82ccd5c441ad30b2558cd4d032b07b30 +Subproject commit cc6e7dafa72f5eec9c4eb0b450eab63e758db2cd diff --git a/user/user_main.c b/user/user_main.c index e3db259..fb655c2 100644 --- a/user/user_main.c +++ b/user/user_main.c @@ -119,39 +119,39 @@ general ones. Authorization things (like authBasic) act as a 'barrier' and should be placed above the URLs they protect. */ HttpdBuiltInUrl builtInUrls[]={ - {"*", cgiRedirectApClientToHostname, "esp8266.nonet"}, - {"/", cgiRedirect, "/index.tpl"}, - {"/led.tpl", cgiEspFsTemplate, tplLed}, - {"/index.tpl", cgiEspFsTemplate, tplCounter}, - {"/led.cgi", cgiLed, NULL}, + ROUTE_CGI_ARG("*", cgiRedirectApClientToHostname, "esp8266.nonet"), // redirect func for the captive portal + ROUTE_REDIRECT("/", "/index.tpl"), + ROUTE_TPL("/led.tpl", tplLed), + ROUTE_TPL("/index.tpl", tplCounter), + ROUTE_CGI("/led.cgi", cgiLed), #ifdef INCLUDE_FLASH_FNS - {"/flash/next", cgiGetFirmwareNext, &uploadParams}, - {"/flash/upload", cgiUploadFirmware, &uploadParams}, + ROUTE_CGI_ARG("/flash/next", cgiGetFirmwareNext, &uploadParams), + ROUTE_CGI_ARG("/flash/upload", cgiUploadFirmware, &uploadParams), #endif - {"/flash/reboot", cgiRebootFirmware, NULL}, + ROUTE_CGI("/flash/reboot", cgiRebootFirmware), //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}, +// ROUTE_AUTH("/wifi/*", myPassFn), - {"/wifi", cgiRedirect, "/wifi/wifi.tpl"}, - {"/wifi/", cgiRedirect, "/wifi/wifi.tpl"}, - {"/wifi/wifiscan.cgi", cgiWiFiScan, NULL}, - {"/wifi/wifi.tpl", cgiEspFsTemplate, tplWlan}, - {"/wifi/connect.cgi", cgiWiFiConnect, NULL}, - {"/wifi/connstatus.cgi", cgiWiFiConnStatus, NULL}, - {"/wifi/setmode.cgi", cgiWiFiSetMode, NULL}, + ROUTE_REDIRECT("/wifi", "/wifi/wifi.tpl"), + ROUTE_REDIRECT("/wifi/", "/wifi/wifi.tpl"), + ROUTE_CGI("/wifi/wifiscan.cgi", cgiWiFiScan), + ROUTE_TPL("/wifi/wifi.tpl", tplWlan), + ROUTE_CGI("/wifi/connect.cgi", cgiWiFiConnect), + ROUTE_CGI("/wifi/connstatus.cgi", cgiWiFiConnStatus), + ROUTE_CGI("/wifi/setmode.cgi", cgiWiFiSetMode), - {"/websocket/ws.cgi", cgiWebsocket, myWebsocketConnect}, - {"/websocket/echo.cgi", cgiWebsocket, myEchoWebsocketConnect}, + ROUTE_WS("/websocket/ws.cgi", myWebsocketConnect), + ROUTE_WS("/websocket/echo.cgi", myEchoWebsocketConnect), - {"/test", cgiRedirect, "/test/index.html"}, - {"/test/", cgiRedirect, "/test/index.html"}, - {"/test/test.cgi", cgiTestbed, NULL}, + ROUTE_REDIRECT("/test", "/test/index.html"), + ROUTE_REDIRECT("/test/", "/test/index.html"), + ROUTE_CGI("/test/test.cgi", cgiTestbed), - {"*", cgiEspFsHook, NULL}, //Catch-all cgi function for the filesystem - {NULL, NULL, NULL} + ROUTE_FILESYSTEM(), + ROUTE_END(), };