splash.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. $(uci -q get luci_splash.general.redirect_url) || {
  3. touch /var/state/luci_splash_locations
  4. touch /etc/config/luci_splash_locations
  5. MAC=$(grep "$REMOTE_HOST" /proc/net/arp | awk '{print $4}')
  6. uci -P /var/state set luci_splash_locations.${MAC//:/}=redirect
  7. uci -P /var/state set luci_splash_locations.${MAC//:/}.location="http://${HTTP_HOST}${REQUEST_URI}"
  8. }
  9. echo -en "Cache-Control: no-cache, max-age=0, no-store, must-revalidate\r\n"
  10. echo -en "Pragma: no-cache\r\n"
  11. echo -en "Expires: -1\r\n"
  12. echo -en "Status: 307 Temporary Redirect\r\n"
  13. echo -en "Location: http://$SERVER_ADDR/cgi-bin/luci/splash\r\n"
  14. echo -en "\r\n"
  15. cat <<EOT
  16. <?xml version="1.0" encoding="UTF-8"?>
  17. <WISPAccessGatewayParam xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.wballiance.net/wispr_2_0.xsd">
  18. <Redirect>
  19. <MessageType>100</MessageType>
  20. <ResponseCode>0</ResponseCode>
  21. <AccessProcedure>1.0</AccessProcedure>
  22. <AccessLocation>12</AccessLocation>
  23. <LocationName>$SERVER_ADDR</LocationName>
  24. <LoginURL>http://$SERVER_ADDR/cgi-bin/luci/splash?wispr=1</LoginURL>
  25. <AbortLoginURL>http://$SERVER_ADDR/</AbortLoginURL>
  26. </Redirect>
  27. </WISPAccessGatewayParam>
  28. EOT