summaryrefslogtreecommitdiffhomepage
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/admin-core/src/controller/admin/index.lua31
-rw-r--r--module/admin-core/src/controller/admin/system.lua10
-rw-r--r--module/admin-core/src/controller/splash/splash.lua6
-rw-r--r--module/admin-core/src/model/cbi/admin_network/dhcp.lua2
-rw-r--r--module/admin-core/src/model/cbi/admin_network/routes.lua2
-rw-r--r--module/admin-core/src/model/cbi/admin_services/olsrd.lua2
-rw-r--r--module/admin-core/src/model/cbi/admin_services/splash.lua2
-rw-r--r--module/admin-core/src/model/cbi/admin_wifi/networks.lua4
-rw-r--r--module/public-core/src/view/public_index/contact.htm2
-rw-r--r--module/public-core/src/view/public_index/index.htm2
-rw-r--r--module/public-core/src/view/sudo_status/iwconfig.htm2
-rw-r--r--module/public-core/src/view/sudo_status/iwscan.htm2
-rw-r--r--module/rpc-core/src/controller/rpc/luciinfo.lua12
13 files changed, 41 insertions, 38 deletions
diff --git a/module/admin-core/src/controller/admin/index.lua b/module/admin-core/src/controller/admin/index.lua
index 8bd04dd80..09d5aa1f5 100644
--- a/module/admin-core/src/controller/admin/index.lua
+++ b/module/admin-core/src/controller/admin/index.lua
@@ -6,10 +6,10 @@ function action_wizard()
end
local ifaces = {}
- local wldevs = ffluci.model.uci.show("wireless")
+ local wldevs = ffluci.model.uci.sections("wireless")
if wldevs then
- for k, v in pairs(wldevs.wireless) do
+ for k, v in pairs(wldevs) do
if v[".type"] == "wifi-device" then
table.insert(ifaces, k)
end
@@ -55,9 +55,9 @@ function configure_freifunk()
uci:set("network", "ffdhcp", "ipaddr", dhcpip)
uci:set("network", "ffdhcp", "netmask", uci:get("freifunk", "community", "dhcpmask"))
- local dhcp = uci:show("dhcp")
+ local dhcp = uci:sections("dhcp")
if dhcp then
- for k, v in pairs(dhcp.dhcp) do
+ for k, v in pairs(dhcp) do
if v[".type"] == "dhcp" and v.interface == "ffdhcp" then
uci:del("dhcp", k)
end
@@ -72,9 +72,9 @@ function configure_freifunk()
uci:set("dhcp", sk, "leasetime", "30m")
end
- local splash = uci:show("luci_splash")
+ local splash = uci:sections("luci_splash")
if splash then
- for k, v in pairs(splash.luci_splash) do
+ for k, v in pairs(splash) do
if v[".type"] == "iface" then
uci:del("luci_splash", k)
end
@@ -86,8 +86,8 @@ function configure_freifunk()
end
-- Configure OLSR
- if ffluci.http.formvalue("olsr") and uci:show("olsr") then
- for k, v in pairs(uci:show("olsr").olsr) do
+ if ffluci.http.formvalue("olsr") and uci:sections("olsr") then
+ for k, v in pairs(uci:sections("olsr")) do
if v[".type"] == "Interface" or v[".type"] == "LoadPlugin" then
uci:del("olsr", k)
end
@@ -122,14 +122,13 @@ function configure_freifunk()
end
-- Configure Wifi
- local wifi = ffluci.http.formvalue("wifi")
- local wcfg = uci:show("wireless")
- if type(wifi) == "table" and wcfg then
- for iface, v in pairs(wifi) do
- if wcfg.wireless[iface] then
+ local wcfg = uci:sections("wireless")
+ if wcfg then
+ for iface, v in pairs(wcfg) do
+ if v[".type"] == "wifi-device" and ffluci.http.formvalue("wifi."..iface) then
-- Cleanup
- for k, v in pairs(wcfg.wireless) do
- if v[".type"] == "wifi-iface" and v.device == iface then
+ for k, j in pairs(wcfg) do
+ if j[".type"] == "wifi-iface" and j.device == iface then
uci:del("wireless", k)
end
end
@@ -152,5 +151,5 @@ function configure_freifunk()
end
- ffluci.http.request_redirect("admin", "uci", "changes")
+ ffluci.http.redirect(ffluci.dispatcher.build_url("admin", "uci", "changes"))
end \ No newline at end of file
diff --git a/module/admin-core/src/controller/admin/system.lua b/module/admin-core/src/controller/admin/system.lua
index b0763d8af..7a927d604 100644
--- a/module/admin-core/src/controller/admin/system.lua
+++ b/module/admin-core/src/controller/admin/system.lua
@@ -61,8 +61,7 @@ function action_packages()
-- Packets to be installed
- local install = ffluci.http.formvalue("install")
- install = (type(install) == "table" and submit) and install or nil
+ local install = submit and ffluci.http.formvaluetable("install")
-- Install from URL
local url = ffluci.http.formvalue("url")
@@ -73,7 +72,7 @@ function action_packages()
install[url] = 1
end
- -- Do install
+ -- Do install
if install then
for k, v in pairs(install) do
void, install[k] = ipkg.install(k)
@@ -82,8 +81,7 @@ function action_packages()
-- Remove packets
- local remove = ffluci.http.formvalue("remove")
- remove = (type(remove) == "table" and submit) and remove or nil
+ local remove = submit and ffluci.http.formvaluetable("remove")
if remove then
for k, v in pairs(remove) do
void, remove[k] = ipkg.remove(k)
@@ -187,7 +185,7 @@ function action_upgrade()
if plat and imgname then
local kpattern = nil
if keepcfg then
- local files = ffluci.model.uci.show("luci", "flash_keep")
+ local files = ffluci.model.uci.sections("luci").flash_keep
if files.luci and files.luci.flash_keep then
kpattern = ""
for k,v in pairs(files.luci.flash_keep) do
diff --git a/module/admin-core/src/controller/splash/splash.lua b/module/admin-core/src/controller/splash/splash.lua
index 4e8a79a22..7e3d67ee9 100644
--- a/module/admin-core/src/controller/splash/splash.lua
+++ b/module/admin-core/src/controller/splash/splash.lua
@@ -6,14 +6,14 @@ function action_activate()
os.execute("luci-splash add "..mac.." >/dev/null 2>&1")
ffluci.http.redirect(ffluci.model.uci.get("freifunk", "community", "homepage"))
else
- ffluci.http.request_redirect()
+ ffluci.http.redirect(ffluci.dispatcher.build_url())
end
end
function action_accepted()
- ffluci.http.request_redirect()
+ ffluci.http.redirect(ffluci.dispatcher.build_url())
end
function action_unknown()
- ffluci.http.request_redirect()
+ ffluci.http.redirect(ffluci.dispatcher.build_url())
end \ No newline at end of file
diff --git a/module/admin-core/src/model/cbi/admin_network/dhcp.lua b/module/admin-core/src/model/cbi/admin_network/dhcp.lua
index c8f1007ff..caac277c4 100644
--- a/module/admin-core/src/model/cbi/admin_network/dhcp.lua
+++ b/module/admin-core/src/model/cbi/admin_network/dhcp.lua
@@ -10,7 +10,7 @@ s.addremove = true
s.anonymous = true
iface = s:option(ListValue, "interface", "Schnittstelle")
-for k, v in pairs(ffluci.model.uci.show("network").network) do
+for k, v in pairs(ffluci.model.uci.sections("network")) do
if v[".type"] == "interface" and k ~= "loopback" then
iface:value(k)
s:depends("interface", k) -- Only change sections with existing interfaces
diff --git a/module/admin-core/src/model/cbi/admin_network/routes.lua b/module/admin-core/src/model/cbi/admin_network/routes.lua
index 35f542357..49e432180 100644
--- a/module/admin-core/src/model/cbi/admin_network/routes.lua
+++ b/module/admin-core/src/model/cbi/admin_network/routes.lua
@@ -8,7 +8,7 @@ s.addremove = true
s.anonymous = true
iface = s:option(ListValue, "interface", "Schnittstelle")
-for k, v in pairs(ffluci.model.uci.show("network").network) do
+for k, v in pairs(ffluci.model.uci.sections("network")) do
if v[".type"] == "interface" and k ~= "loopback" then
iface:value(k)
end
diff --git a/module/admin-core/src/model/cbi/admin_services/olsrd.lua b/module/admin-core/src/model/cbi/admin_services/olsrd.lua
index 1090601d3..8431a8104 100644
--- a/module/admin-core/src/model/cbi/admin_services/olsrd.lua
+++ b/module/admin-core/src/model/cbi/admin_services/olsrd.lua
@@ -51,7 +51,7 @@ i.dynamic = true
network = i:option(ListValue, "Interface", "Netzwerkschnittstellen")
network:value("")
-for k, v in pairs(ffluci.model.uci.show("network").network) do
+for k, v in pairs(ffluci.model.uci.sections("network")) do
if v[".type"] == "interface" and k ~= "loopback" then
network:value(k)
end
diff --git a/module/admin-core/src/model/cbi/admin_services/splash.lua b/module/admin-core/src/model/cbi/admin_services/splash.lua
index d3c3f0ae7..fe4d2c3ee 100644
--- a/module/admin-core/src/model/cbi/admin_services/splash.lua
+++ b/module/admin-core/src/model/cbi/admin_services/splash.lua
@@ -11,7 +11,7 @@ s.addremove = true
s.anonymous = true
iface = s:option(ListValue, "network", "Schnittstelle")
-for k, v in pairs(ffluci.model.uci.show("network").network) do
+for k, v in pairs(ffluci.model.uci.sections("network")) do
if v[".type"] == "interface" and k ~= "loopback" then
iface:value(k)
end
diff --git a/module/admin-core/src/model/cbi/admin_wifi/networks.lua b/module/admin-core/src/model/cbi/admin_wifi/networks.lua
index feb2c7471..4a7ad12f6 100644
--- a/module/admin-core/src/model/cbi/admin_wifi/networks.lua
+++ b/module/admin-core/src/model/cbi/admin_wifi/networks.lua
@@ -11,7 +11,7 @@ s.anonymous = true
s:option(Value, "ssid", "Netzkennung (ESSID)").maxlength = 32
device = s:option(ListValue, "device", "Gerät")
-local d = ffluci.model.uci.show("wireless").wireless
+local d = ffluci.model.uci.sections("wireless")
if d then
for k, v in pairs(d) do
if v[".type"] == "wifi-device" then
@@ -22,7 +22,7 @@ end
network = s:option(ListValue, "network", "Netzwerk", "WLAN-Netz zu Netzwerk hinzufügen")
network:value("")
-for k, v in pairs(ffluci.model.uci.show("network").network) do
+for k, v in pairs(ffluci.model.uci.sections("network")) do
if v[".type"] == "interface" and k ~= "loopback" then
network:value(k)
end
diff --git a/module/public-core/src/view/public_index/contact.htm b/module/public-core/src/view/public_index/contact.htm
index df34812af..221dc89cc 100644
--- a/module/public-core/src/view/public_index/contact.htm
+++ b/module/public-core/src/view/public_index/contact.htm
@@ -1,5 +1,5 @@
<%+header%>
-<% local contact = ffluci.model.uci.show("freifunk").freifunk.contact %>
+<% local contact = ffluci.model.uci.sections("freifunk").contact %>
<h1><%:contact Kontakt%></h1>
<table cellspacing="0" cellpadding="6">
<tr><th><%:nickname Pseudonym%>:</th><td><%=contact.nickname%></td></tr>
diff --git a/module/public-core/src/view/public_index/index.htm b/module/public-core/src/view/public_index/index.htm
index a8a469ec3..6c7fe8588 100644
--- a/module/public-core/src/view/public_index/index.htm
+++ b/module/public-core/src/view/public_index/index.htm
@@ -1,5 +1,5 @@
<%+header%>
-<% local ff = ffluci.model.uci.show("freifunk").freifunk %>
+<% local ff = ffluci.model.uci.sections("freifunk") %>
<h1><%:hellonet Hallo und willkommen im Netz von%> <%=ff.community.name%>!</h1>
<p><%:public1 Wir sind eine Initiative zur Schaffung eines freien, offenen und unabhängigen Funknetzwerks auf WLAN-Basis.%><br />
<%:public2 Dies ist der Zugangspunkt %><%=ffluci.sys.hostname()%>. <%:public3 Er wird betrieben von %>
diff --git a/module/public-core/src/view/sudo_status/iwconfig.htm b/module/public-core/src/view/sudo_status/iwconfig.htm
index e06b631ac..92371ef60 100644
--- a/module/public-core/src/view/sudo_status/iwconfig.htm
+++ b/module/public-core/src/view/sudo_status/iwconfig.htm
@@ -1,5 +1,5 @@
<%
-ffluci.http.textheader()
+ffluci.http.set_content_type("text/plain")
for k, v in pairs(ffluci.sys.wifi.getiwconfig()) do
%>
<tr>
diff --git a/module/public-core/src/view/sudo_status/iwscan.htm b/module/public-core/src/view/sudo_status/iwscan.htm
index 8a1ee7254..f4268574b 100644
--- a/module/public-core/src/view/sudo_status/iwscan.htm
+++ b/module/public-core/src/view/sudo_status/iwscan.htm
@@ -1,5 +1,5 @@
<%
-ffluci.http.textheader()
+ffluci.http.set_content_type("text/plain")
for iface, cells in pairs(ffluci.sys.wifi.iwscan()) do
for i, cell in ipairs(cells) do
%>
diff --git a/module/rpc-core/src/controller/rpc/luciinfo.lua b/module/rpc-core/src/controller/rpc/luciinfo.lua
index 8d10fa885..d4e5cb306 100644
--- a/module/rpc-core/src/controller/rpc/luciinfo.lua
+++ b/module/rpc-core/src/controller/rpc/luciinfo.lua
@@ -3,7 +3,7 @@ module("ffluci.controller.rpc.luciinfo", package.seeall)
function action_index()
local uci = ffluci.model.uci.StateSession()
- ffluci.http.textheader()
+ ffluci.http.set_content_type("text/plain")
-- General
print("luciinfo.api=1")
@@ -26,8 +26,14 @@ function action_index()
-- Freifunk
- local ff = uci:show("freifunk", true) or ""
- print(ff)
+ local ff = uci:sections("freifunk") or {}
+ for k, v in pairs(ff) do
+ if k:sub(1, 1) ~= "." then
+ for i, j in pairs(v) do
+ print("freifunk." .. k .. "." .. i .. "=" .. j)
+ end
+ end
+ end
end
function sanitize(val)