applications/luci-splash: Per default redirect to the page the user requested after...
[project/luci.git] / applications / luci-splash / htdocs / cgi-bin / splash / splash.sh
index cbffaf6ab3f88223f27e97062b3d16f925652d4d..76f6d4d3e41e240b4b9bb4df8cc05e3790c839f0 100755 (executable)
@@ -1,4 +1,15 @@
 #!/bin/sh
+
+$(uci -q get luci_splash.general.redirect_url) || {
+       set -x
+       touch /var/state/luci_splash_locations
+       touch /etc/config/luci_splash_locations
+       MAC=$(grep "$REMOTE_HOST" /proc/net/arp | awk '{print $4}')
+       uci -P /var/state set luci_splash_locations.${MAC//:/}=redirect
+       uci -P /var/state set luci_splash_locations.${MAC//:/}.location="http://${HTTP_HOST}${REQUEST_URI}"
+       set +x
+}
+
 echo -en "Cache-Control: no-cache, max-age=0, no-store, must-revalidate\r\n"
 echo -en "Pragma: no-cache\r\n"
 echo -en "Expires: -1\r\n"
@@ -21,3 +32,4 @@ cat <<EOT
 </WISPAccessGatewayParam>
 EOT
 
+