From d8eeeb2a3013bbe2f43054bfa0401311191a4aa1 Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Wed, 10 Jun 2015 14:49:20 +0800 Subject: [PATCH] Captive portal: use softap-specific hostname redirect --- .gitmodules | 3 ++- libesphttpd | 2 +- user/user_main.c | 11 ++--------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.gitmodules b/.gitmodules index f339e54..c6d3d67 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "libesphttpd"] path = libesphttpd - url = http://git.spritesserver.nl/libesphttpd.git/ +# url = http://git.spritesserver.nl/libesphttpd.git/ + url = ssh://git@spritesmods.com:/opt/git/libesphttpd.git diff --git a/libesphttpd b/libesphttpd index 0912a7e..2864a9d 160000 --- a/libesphttpd +++ b/libesphttpd @@ -1 +1 @@ -Subproject commit 0912a7e354579c78f12e191d30d24ee73f7873a0 +Subproject commit 2864a9dca31c93376718fed76da914ff977566a4 diff --git a/user/user_main.c b/user/user_main.c index 9c30bc9..b262d40 100644 --- a/user/user_main.c +++ b/user/user_main.c @@ -29,10 +29,6 @@ some pictures of cats. //The example can print out the heap use every 3 seconds. You can use this to catch memory leaks. //#define SHOW_HEAP_USE -//The example can act as a captive portal, that is, if someone connects their phone to the access -//point, it will automatically load up the main page on most phones/tablets. -#define CAPTIVE_PORTAL - //Function that tells the authentication system what users/passwords live on the system. //This is disabled in the default build; if you want to try it, enable the authBasic line in //the builtInUrls below. @@ -68,9 +64,7 @@ general ones. Authorization things (like authBasic) act as a 'barrier' and should be placed above the URLs they protect. */ HttpdBuiltInUrl builtInUrls[]={ -#ifdef CAPTIVE_PORTAL - {"*", cgiCheckHostname, "esp8266.local"}, -#endif + {"*", cgiRedirectApClientToHostname, "esp8266.local"}, {"/", cgiRedirect, "/index.tpl"}, {"/flash.bin", cgiReadFlash, NULL}, {"/led.tpl", cgiEspFsTemplate, tplLed}, @@ -109,9 +103,8 @@ static void ICACHE_FLASH_ATTR prHeapTimerCb(void *arg) { void user_init(void) { stdoutInit(); ioInit(); -#ifdef CAPTIVE_PORTAL captdnsInit(); -#endif + // 0x40200000 is the base address for spi flash memory mapping, ESPFS_POS is the position // where image is written in flash that is defined in Makefile. #ifdef ESPFS_POS