* DHCP-Splash fixes #1
authorSteven Barth <steven@midlink.org>
Sun, 11 May 2008 10:29:45 +0000 (10:29 +0000)
committerSteven Barth <steven@midlink.org>
Sun, 11 May 2008 10:29:45 +0000 (10:29 +0000)
12 files changed:
applications/luci-splash/root/usr/lib/luci-splash/htdocs/cgi-bin/index.cgi
applications/luci-splash/root/www/cgi-bin/luci-splash [new file with mode: 0644]
applications/luci-splash/root/www/cgi-bin/luci_splash.cgi [deleted file]
applications/luci-splash/src/controller/controller.lua [deleted file]
applications/luci-splash/src/controller/splash/splash.lua [new file with mode: 0644]
applications/luci-splash/src/model/v/splash/splash.htm [new file with mode: 0644]
applications/luci-splash/src/model/v/splash_splash/index.htm [new file with mode: 0644]
applications/luci-splash/src/model/v/splash_splash/splash.htm [new file with mode: 0644]
applications/luci-splash/src/model/view/splash/splash.htm [deleted file]
applications/luci-splash/src/model/view/splash_splash/index.htm [deleted file]
applications/luci-splash/src/model/view/splash_splash/splash.htm [deleted file]
contrib/package/ffluci/Makefile

index 341aaa4..11430f0 100644 (file)
@@ -29,24 +29,22 @@ end
 
 if not srv then
        ffluci.http.prepare_content("text/plain")
-       return print("Unable to detect network settings!")
-end
-
-if not stat then
+       print("Unable to detect network settings!")
+elseif not stat then
        ffluci.http.redirect("http://" .. srv)
-end
-
-local action = "splash"
-
-local mac = ffluci.sys.net.ip4mac(ip)
-if not mac then
-       action = "unknown"
-end
-
-local status = ffluci.sys.execl("luci-splash status "..mac)[1]
-
-if status == "whitelisted" or status == "lease" then
-       action = "allowed"
-end
-
-ffluci.http.redirect("http://" .. srv .. "/cgi-bin/luci-splash/" .. action)
\ No newline at end of file
+else
+       local action = "splash"
+       
+       local mac = ffluci.sys.net.ip4mac(ip)
+       if not mac then
+               action = "unknown"
+       end
+       
+       local status = ffluci.sys.execl("luci-splash status "..mac)[1]
+       
+       if status == "whitelisted" or status == "lease" then
+               action = "allowed"
+       end
+       
+       ffluci.http.redirect("http://" .. srv .. "/cgi-bin/luci-splash/" .. action)
+end
\ No newline at end of file
diff --git a/applications/luci-splash/root/www/cgi-bin/luci-splash b/applications/luci-splash/root/www/cgi-bin/luci-splash
new file mode 100644 (file)
index 0000000..188ad7a
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+echo "Status: 302 Found"
+echo "Location: /cgi-bin/ffluci/splash/splash$PATH_INFO"
+echo
\ No newline at end of file
diff --git a/applications/luci-splash/root/www/cgi-bin/luci_splash.cgi b/applications/luci-splash/root/www/cgi-bin/luci_splash.cgi
deleted file mode 100644 (file)
index 188ad7a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-echo "Status: 302 Found"
-echo "Location: /cgi-bin/ffluci/splash/splash$PATH_INFO"
-echo
\ No newline at end of file
diff --git a/applications/luci-splash/src/controller/controller.lua b/applications/luci-splash/src/controller/controller.lua
deleted file mode 100644 (file)
index 62088be..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-module("ffluci.controller.splash.splash", package.seeall)
-
-function action_activate()
-       local mac = ffluci.sys.net.ip4mac(ffluci.http.env.REMOTE_ADDR)
-       if mac and ffluci.http.formvalue("accept") then
-               os.execute("luci-splash add "..mac.." >/dev/null 2>&1")
-               ffluci.http.redirect(ffluci.model.uci.get("freifunk", "community", "homepage"))
-       else
-               ffluci.http.redirect(ffluci.dispatcher.build_url())
-       end
-end
-
-function action_accepted()
-       ffluci.http.redirect(ffluci.dispatcher.build_url())
-end
-
-function action_unknown()
-       ffluci.http.redirect(ffluci.dispatcher.build_url())
-end
\ No newline at end of file
diff --git a/applications/luci-splash/src/controller/splash/splash.lua b/applications/luci-splash/src/controller/splash/splash.lua
new file mode 100644 (file)
index 0000000..62088be
--- /dev/null
@@ -0,0 +1,19 @@
+module("ffluci.controller.splash.splash", package.seeall)
+
+function action_activate()
+       local mac = ffluci.sys.net.ip4mac(ffluci.http.env.REMOTE_ADDR)
+       if mac and ffluci.http.formvalue("accept") then
+               os.execute("luci-splash add "..mac.." >/dev/null 2>&1")
+               ffluci.http.redirect(ffluci.model.uci.get("freifunk", "community", "homepage"))
+       else
+               ffluci.http.redirect(ffluci.dispatcher.build_url())
+       end
+end
+
+function action_accepted()
+       ffluci.http.redirect(ffluci.dispatcher.build_url())
+end
+
+function action_unknown()
+       ffluci.http.redirect(ffluci.dispatcher.build_url())
+end
\ No newline at end of file
diff --git a/applications/luci-splash/src/model/v/splash/splash.htm b/applications/luci-splash/src/model/v/splash/splash.htm
new file mode 100644 (file)
index 0000000..db4bd0f
--- /dev/null
@@ -0,0 +1,31 @@
+<h1><%:welcome Willkommen%>!</h1>
+<p>
+Du bist jetzt mit dem freien Funknetz 
+<a href="<%~freifunk.community.homepage%>"><%~freifunk.community.name%></a> verbunden.<br />
+Wir sind ein experimentelles Gemeinschaftsnetzwerk, aber kein Internetanbieter.
+</p>
+
+<p>
+Ein Zugang <strong>ins Internet</strong> ist trotzdem möglich,
+da einige Freifunker ihre privaten Internetzugänge zur Verfügung stellen.
+Diese Zugänge müssen sich hier alle teilen.
+Bitte sei Dir dessen bewusst und verhalte Dich dementsprechend:
+<ul>
+<li>bitte <strong>keine Filesharing-Programme</strong> betreiben!</li>
+<li>bitte <strong>keine unnötigen Downloads oder Streams</strong> starten!</li>
+<li>bitte <strong>keine illegalen Aktivitäten</strong>!</li>
+</ul>
+</p>
+
+<p>
+Wenn Du unsere Idee gut findest, kannst Du uns unterstützen:
+<ul>
+<li><a href="<%~freifunk.community.homepage%>">Werde selbst Freifunker oder teile deinen Internetzugang!</a></li>
+<li>Betreibe deine anderen WLAN-Geräte <em>NICHT</em> auf den Kanälen 1-5, diese stören oft unser Netz.</li>
+</ul>
+</p>
+
+<p>
+Mit einem Klick auf <em><%:accept Annehmen%></em> kannst du für <%~luci_splash.general.leasetime%> Stunden
+über unser Netz das Internet verwenden. Dann wirst du erneut aufgefordet, diese Bedingungen zu akzeptieren.
+</p>
\ No newline at end of file
diff --git a/applications/luci-splash/src/model/v/splash_splash/index.htm b/applications/luci-splash/src/model/v/splash_splash/index.htm
new file mode 100644 (file)
index 0000000..75aa026
--- /dev/null
@@ -0,0 +1,2 @@
+<%+header%>
+<%+footer%>
\ No newline at end of file
diff --git a/applications/luci-splash/src/model/v/splash_splash/splash.htm b/applications/luci-splash/src/model/v/splash_splash/splash.htm
new file mode 100644 (file)
index 0000000..9c16580
--- /dev/null
@@ -0,0 +1,7 @@
+<%+header%>
+<%+splash/splash%>
+<form method="get" action="<%=controller%>/splash/splash/activate">
+       <input type="submit" value="<%:decline Ablehnen%>" />
+       <input type="submit" name="accept" value="<%:accept Annehmen%>" />
+</form>
+<%+footer%>
\ No newline at end of file
diff --git a/applications/luci-splash/src/model/view/splash/splash.htm b/applications/luci-splash/src/model/view/splash/splash.htm
deleted file mode 100644 (file)
index db4bd0f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<h1><%:welcome Willkommen%>!</h1>
-<p>
-Du bist jetzt mit dem freien Funknetz 
-<a href="<%~freifunk.community.homepage%>"><%~freifunk.community.name%></a> verbunden.<br />
-Wir sind ein experimentelles Gemeinschaftsnetzwerk, aber kein Internetanbieter.
-</p>
-
-<p>
-Ein Zugang <strong>ins Internet</strong> ist trotzdem möglich,
-da einige Freifunker ihre privaten Internetzugänge zur Verfügung stellen.
-Diese Zugänge müssen sich hier alle teilen.
-Bitte sei Dir dessen bewusst und verhalte Dich dementsprechend:
-<ul>
-<li>bitte <strong>keine Filesharing-Programme</strong> betreiben!</li>
-<li>bitte <strong>keine unnötigen Downloads oder Streams</strong> starten!</li>
-<li>bitte <strong>keine illegalen Aktivitäten</strong>!</li>
-</ul>
-</p>
-
-<p>
-Wenn Du unsere Idee gut findest, kannst Du uns unterstützen:
-<ul>
-<li><a href="<%~freifunk.community.homepage%>">Werde selbst Freifunker oder teile deinen Internetzugang!</a></li>
-<li>Betreibe deine anderen WLAN-Geräte <em>NICHT</em> auf den Kanälen 1-5, diese stören oft unser Netz.</li>
-</ul>
-</p>
-
-<p>
-Mit einem Klick auf <em><%:accept Annehmen%></em> kannst du für <%~luci_splash.general.leasetime%> Stunden
-über unser Netz das Internet verwenden. Dann wirst du erneut aufgefordet, diese Bedingungen zu akzeptieren.
-</p>
\ No newline at end of file
diff --git a/applications/luci-splash/src/model/view/splash_splash/index.htm b/applications/luci-splash/src/model/view/splash_splash/index.htm
deleted file mode 100644 (file)
index 75aa026..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-<%+header%>
-<%+footer%>
\ No newline at end of file
diff --git a/applications/luci-splash/src/model/view/splash_splash/splash.htm b/applications/luci-splash/src/model/view/splash_splash/splash.htm
deleted file mode 100644 (file)
index 9c16580..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<%+header%>
-<%+splash/splash%>
-<form method="get" action="<%=controller%>/splash/splash/activate">
-       <input type="submit" value="<%:decline Ablehnen%>" />
-       <input type="submit" name="accept" value="<%:accept Annehmen%>" />
-</form>
-<%+footer%>
\ No newline at end of file
index af17aa5..8f1d7f0 100644 (file)
@@ -156,6 +156,7 @@ define Package/ffluci-app-splash/install
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/etc/init.d/luci_splash $(1)/etc/init.d
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/etc/cron.minutely/luci_splash $(1)/etc/cron.minutely
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/usr/lib/luci-splash/htdocs/cgi-bin/index.cgi $(1)/usr/lib/luci-splash/htdocs/cgi-bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/www/cgi-bin/luci-splash $(1)/www/cgi-bin/luci-splash
 endef