From 045d9c1942146eb971609b637029911e4802a2e9 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Sun, 11 May 2008 10:29:45 +0000 Subject: [PATCH] * DHCP-Splash fixes #1 --- .../lib/luci-splash/htdocs/cgi-bin/index.cgi | 38 +++++++++---------- .../cgi-bin/{luci_splash.cgi => luci-splash} | 0 .../{controller.lua => splash/splash.lua} | 0 .../src/model/{view => v}/splash/splash.htm | 0 .../model/{view => v}/splash_splash/index.htm | 0 .../{view => v}/splash_splash/splash.htm | 0 contrib/package/ffluci/Makefile | 1 + 7 files changed, 19 insertions(+), 20 deletions(-) rename applications/luci-splash/root/www/cgi-bin/{luci_splash.cgi => luci-splash} (100%) rename applications/luci-splash/src/controller/{controller.lua => splash/splash.lua} (100%) rename applications/luci-splash/src/model/{view => v}/splash/splash.htm (100%) rename applications/luci-splash/src/model/{view => v}/splash_splash/index.htm (100%) rename applications/luci-splash/src/model/{view => v}/splash_splash/splash.htm (100%) diff --git a/applications/luci-splash/root/usr/lib/luci-splash/htdocs/cgi-bin/index.cgi b/applications/luci-splash/root/usr/lib/luci-splash/htdocs/cgi-bin/index.cgi index 341aaa4b5..11430f0ac 100644 --- a/applications/luci-splash/root/usr/lib/luci-splash/htdocs/cgi-bin/index.cgi +++ b/applications/luci-splash/root/usr/lib/luci-splash/htdocs/cgi-bin/index.cgi @@ -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.cgi b/applications/luci-splash/root/www/cgi-bin/luci-splash similarity index 100% rename from applications/luci-splash/root/www/cgi-bin/luci_splash.cgi rename to applications/luci-splash/root/www/cgi-bin/luci-splash diff --git a/applications/luci-splash/src/controller/controller.lua b/applications/luci-splash/src/controller/splash/splash.lua similarity index 100% rename from applications/luci-splash/src/controller/controller.lua rename to applications/luci-splash/src/controller/splash/splash.lua diff --git a/applications/luci-splash/src/model/view/splash/splash.htm b/applications/luci-splash/src/model/v/splash/splash.htm similarity index 100% rename from applications/luci-splash/src/model/view/splash/splash.htm rename to applications/luci-splash/src/model/v/splash/splash.htm diff --git a/applications/luci-splash/src/model/view/splash_splash/index.htm b/applications/luci-splash/src/model/v/splash_splash/index.htm similarity index 100% rename from applications/luci-splash/src/model/view/splash_splash/index.htm rename to applications/luci-splash/src/model/v/splash_splash/index.htm diff --git a/applications/luci-splash/src/model/view/splash_splash/splash.htm b/applications/luci-splash/src/model/v/splash_splash/splash.htm similarity index 100% rename from applications/luci-splash/src/model/view/splash_splash/splash.htm rename to applications/luci-splash/src/model/v/splash_splash/splash.htm diff --git a/contrib/package/ffluci/Makefile b/contrib/package/ffluci/Makefile index af17aa57a..8f1d7f0aa 100644 --- a/contrib/package/ffluci/Makefile +++ b/contrib/package/ffluci/Makefile @@ -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 -- 2.25.1