From 84649be9f2e0f42d039f1ac422a63c9edaf78a8d Mon Sep 17 00:00:00 2001 From: Jan Huwald Date: Fri, 30 Mar 2012 11:32:01 +0000 Subject: adapt splash and robinson redirection to new webif diff --git a/files/common/etc/fsm/inetable/trans/queen.enter b/files/common/etc/fsm/inetable/trans/queen.enter index 9753a81..a7c5539 100755 --- a/files/common/etc/fsm/inetable/trans/queen.enter +++ b/files/common/etc/fsm/inetable/trans/queen.enter @@ -54,7 +54,7 @@ set dhcp.mesh.end_ip=$dhcp_end ## set splash # start redirection httpd (for splash), add GW IP to the addrs service # httpd listens on -echo "http://$gwip/cgi-bin/splash? /sbin/urlencode" > /tmp/redirection_target +echo "http://$gwip/cgi-bin/splash.html? /sbin/urlencode" > /tmp/redirection_target enable_httpd redirection $gwip:81 change_service_httpd_listen $gwip:80 /etc/init.d/uhttpd restart diff --git a/files/common/etc/fsm/inetable/trans/robinson.enter b/files/common/etc/fsm/inetable/trans/robinson.enter index 42e97cb..38ae604 100755 --- a/files/common/etc/fsm/inetable/trans/robinson.enter +++ b/files/common/etc/fsm/inetable/trans/robinson.enter @@ -38,7 +38,7 @@ set dhcp.fakedns.name='#' batctl gw off # start redirection httpd, add robinson IP to service httpd -echo "http://$randip/robinson.html" > /tmp/redirection_target +echo "http://$randip/" > /tmp/redirection_target enable_httpd redirection $randip:81 change_service_httpd_listen $randip:80 /etc/init.d/uhttpd restart diff --git a/files/common/www/service/cgi-bin/splash b/files/common/www/service/cgi-bin/splash deleted file mode 100755 index 1237ce0..0000000 --- a/files/common/www/service/cgi-bin/splash +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -echo -en "Status: 200 OK\r\n" -echo -en "Content-Type: text/html\r\n" -echo -en "\r\n" - -targeturl="$(echo "$QUERY_STRING" | tr -d '/')" -sed "s/targeturl/$targeturl/g" splash.html diff --git a/files/common/www/service/cgi-bin/splash.html b/files/common/www/service/cgi-bin/splash.html new file mode 100755 index 0000000..b8c8264 --- /dev/null +++ b/files/common/www/service/cgi-bin/splash.html @@ -0,0 +1,7 @@ +#!/bin/sh +echo -en "Status: 200 OK\r\n" +echo -en "Content-Type: text/html\r\n" +echo -en "\r\n" + +targeturl="$(echo "$QUERY_STRING" | tr -d '/')" +sed "s/targeturl/$targeturl/g" index.html diff --git a/files/common/www/service/cgi-bin/splash_click b/files/common/www/service/cgi-bin/splash_click deleted file mode 100755 index 1eb4e85..0000000 --- a/files/common/www/service/cgi-bin/splash_click +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -e -. $IPKG_INSTROOT/etc/functions.sh -. /etc/splash.sh - -echo -en "Status: 200 OK\r\n" -echo -en "Content-Type: text/html\r\n" -echo -en "\r\n" - -# decode request params -URL="http://$(sed 's/target_url=//g' | urldecode)" -USER_MAC=$(grep ^$REMOTE_HOST /dev/null - uci -q set splash_users.@user[-1].mac=$USER_MAC - uci -q set splash_users.@user[-1].time=`date +%s` -fi -unlockSplash - -# send response (encode / to not confuse sed) -sed "s/targeturl/$(echo "$URL" | sed 's#/#\\/#g')/g" iframe.html diff --git a/files/common/www/service/cgi-bin/splash_click.html b/files/common/www/service/cgi-bin/splash_click.html new file mode 100755 index 0000000..59926d0 --- /dev/null +++ b/files/common/www/service/cgi-bin/splash_click.html @@ -0,0 +1,48 @@ +#!/bin/sh -e + +. $IPKG_INSTROOT/etc/functions.sh +. /etc/splash.sh +. /www/service/cgi-bin/common.sh + +# decode request params +#URL="http://$(sed 's/target_url=//g' | urldecode || true)" +URL="http://sotun.de/" +USER_MAC=$(grep ^$REMOTE_HOST /dev/null + uci -q set splash_users.@user[-1].mac=$USER_MAC + uci -q set splash_users.@user[-1].time=`date +%s` +fi +unlockSplash + +# send response (encode / to not confuse sed) + +echo -en "Status: 200 OK\r +Content-Type: text/html\r +\r +" +if have_internet; then + sed "s/targeturl/$(echo "$URL" | sed 's#/#\\/#g')/g" iframe.html +else + cat internet.html +fi -- cgit v0.10.1