From 6604399aa8f35d33c53a5e5a1fea765f401aef5e Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Thu, 22 May 2008 14:04:03 +0000 Subject: Merge branch 'menu' --- .../freifunk/src/controller/admin/index/wizard.lua | 238 ---------------- .../freifunk/src/controller/freifunk/freifunk.lua | 311 +++++++++++++++++++++ .../freifunk/src/controller/freifunk/luciinfo.lua | 45 +++ modules/freifunk/src/controller/freifunk/olsr.lua | 164 +++++++++++ modules/freifunk/src/controller/public/index.lua | 1 - modules/freifunk/src/controller/public/olsr.lua | 137 --------- modules/freifunk/src/controller/public/status.lua | 21 -- modules/freifunk/src/controller/rpc/luciinfo.lua | 41 --- modules/freifunk/src/controller/sudo/status.lua | 1 - .../freifunk/src/model/cbi/admin_index/contact.lua | 18 -- .../src/model/cbi/admin_index/freifunk.lua | 19 -- .../freifunk/src/model/cbi/freifunk/contact.lua | 18 ++ .../freifunk/src/model/cbi/freifunk/freifunk.lua | 19 ++ modules/freifunk/src/model/menu/10freifunk.lua | 18 -- modules/freifunk/src/view/admin_index/wizard.htm | 58 ---- .../freifunk/src/view/freifunk-olsr/error_olsr.htm | 6 + modules/freifunk/src/view/freifunk-olsr/hna.htm | 17 ++ modules/freifunk/src/view/freifunk-olsr/index.htm | 43 +++ modules/freifunk/src/view/freifunk-olsr/mid.htm | 17 ++ modules/freifunk/src/view/freifunk-olsr/routes.htm | 36 +++ .../freifunk/src/view/freifunk-olsr/topology.htm | 23 ++ modules/freifunk/src/view/freifunk/contact.htm | 13 + modules/freifunk/src/view/freifunk/index.htm | 11 + modules/freifunk/src/view/freifunk/wizard.htm | 58 ++++ modules/freifunk/src/view/public_index/contact.htm | 13 - modules/freifunk/src/view/public_index/index.htm | 11 - .../freifunk/src/view/public_olsr/error_olsr.htm | 6 - modules/freifunk/src/view/public_olsr/hna.htm | 17 -- modules/freifunk/src/view/public_olsr/index.htm | 43 --- modules/freifunk/src/view/public_olsr/mid.htm | 17 -- modules/freifunk/src/view/public_olsr/routes.htm | 36 --- modules/freifunk/src/view/public_olsr/topology.htm | 23 -- modules/freifunk/src/view/public_status/index.htm | 20 +- modules/freifunk/src/view/public_status/iwscan.htm | 19 +- modules/freifunk/src/view/sudo_status/iwconfig.htm | 21 -- modules/freifunk/src/view/sudo_status/iwscan.htm | 22 -- 36 files changed, 818 insertions(+), 763 deletions(-) delete mode 100644 modules/freifunk/src/controller/admin/index/wizard.lua create mode 100644 modules/freifunk/src/controller/freifunk/freifunk.lua create mode 100644 modules/freifunk/src/controller/freifunk/luciinfo.lua create mode 100644 modules/freifunk/src/controller/freifunk/olsr.lua delete mode 100644 modules/freifunk/src/controller/public/index.lua delete mode 100644 modules/freifunk/src/controller/public/olsr.lua delete mode 100644 modules/freifunk/src/controller/public/status.lua delete mode 100644 modules/freifunk/src/controller/rpc/luciinfo.lua delete mode 100644 modules/freifunk/src/controller/sudo/status.lua delete mode 100644 modules/freifunk/src/model/cbi/admin_index/contact.lua delete mode 100644 modules/freifunk/src/model/cbi/admin_index/freifunk.lua create mode 100644 modules/freifunk/src/model/cbi/freifunk/contact.lua create mode 100644 modules/freifunk/src/model/cbi/freifunk/freifunk.lua delete mode 100644 modules/freifunk/src/model/menu/10freifunk.lua delete mode 100644 modules/freifunk/src/view/admin_index/wizard.htm create mode 100644 modules/freifunk/src/view/freifunk-olsr/error_olsr.htm create mode 100644 modules/freifunk/src/view/freifunk-olsr/hna.htm create mode 100644 modules/freifunk/src/view/freifunk-olsr/index.htm create mode 100644 modules/freifunk/src/view/freifunk-olsr/mid.htm create mode 100644 modules/freifunk/src/view/freifunk-olsr/routes.htm create mode 100644 modules/freifunk/src/view/freifunk-olsr/topology.htm create mode 100644 modules/freifunk/src/view/freifunk/contact.htm create mode 100644 modules/freifunk/src/view/freifunk/index.htm create mode 100644 modules/freifunk/src/view/freifunk/wizard.htm delete mode 100644 modules/freifunk/src/view/public_index/contact.htm delete mode 100644 modules/freifunk/src/view/public_index/index.htm delete mode 100644 modules/freifunk/src/view/public_olsr/error_olsr.htm delete mode 100644 modules/freifunk/src/view/public_olsr/hna.htm delete mode 100644 modules/freifunk/src/view/public_olsr/index.htm delete mode 100644 modules/freifunk/src/view/public_olsr/mid.htm delete mode 100644 modules/freifunk/src/view/public_olsr/routes.htm delete mode 100644 modules/freifunk/src/view/public_olsr/topology.htm delete mode 100644 modules/freifunk/src/view/sudo_status/iwconfig.htm delete mode 100644 modules/freifunk/src/view/sudo_status/iwscan.htm (limited to 'modules/freifunk') diff --git a/modules/freifunk/src/controller/admin/index/wizard.lua b/modules/freifunk/src/controller/admin/index/wizard.lua deleted file mode 100644 index efca38d21..000000000 --- a/modules/freifunk/src/controller/admin/index/wizard.lua +++ /dev/null @@ -1,238 +0,0 @@ -module("ffluci.controller.admin.index.wizard", package.seeall) - -function action() - if ffluci.http.formvalue("ip") then - return configure_freifunk() - end - - local ifaces = {} - local wldevs = ffluci.model.uci.sections("wireless") - - if wldevs then - for k, v in pairs(wldevs) do - if v[".type"] == "wifi-device" then - table.insert(ifaces, k) - end - end - end - - ffluci.template.render("admin_index/wizard", {ifaces=ifaces}) -end - -function configure_freifunk() - local ip = ffluci.http.formvalue("ip") - local uci = ffluci.model.uci.Session() - - -- Load UCI - uci:t_load("network") - uci:t_load("dhcp") - uci:t_load("freifunk") - uci:t_load("luci_splash") - uci:t_load("olsr") - uci:t_load("wireless") - uci:t_load("luci_fw") - - - -- Configure FF-Interface - uci:t_del("network", "ff") - uci:t_del("network", "ffdhcp") - - uci:t_set("network", "ff", nil, "interface") - uci:t_set("network", "ff", "type", "bridge") - uci:t_set("network", "ff", "proto", "static") - uci:t_set("network", "ff", "ipaddr", ip) - uci:t_set("network", "ff", "netmask", uci:t_get("freifunk", "community", "mask")) - uci:t_set("network", "ff", "dns", uci:t_get("freifunk", "community", "dns")) - - -- Reset Routing - local routing = uci:t_sections("luci_fw") - if routing then - for k, v in pairs(routing) do - if v[".type"] == "routing" and (v.iface == "ff" or v.oface == "ff") then - uci:t_del("luci_fw", k) - end - end - - local int = uci:t_add("luci_fw", "routing") - uci:t_set("luci_fw", int, "iface", "ff") - uci:t_set("luci_fw", int, "oface", "ff") - uci:t_set("luci_fw", int, "fwd", "1") - end - - -- Routing from Internal - local iface = ffluci.http.formvalue("frominternal") - if iface and iface ~= "" then - local routing = uci:t_sections("luci_fw") - if routing then - for k, v in pairs(routing) do - if v[".type"] == "routing" and (v.iface == iface and v.oface == "ff") then - uci:t_del("luci_fw", k) - end - end - - local int = uci:t_add("luci_fw", "routing") - uci:t_set("luci_fw", int, "iface", iface) - uci:t_set("luci_fw", int, "oface", "ff") - uci:t_set("luci_fw", int, "fwd", "1") - uci:t_set("luci_fw", int, "nat", "1") - end - end - - -- Routing to External - local iface = ffluci.http.formvalue("toexternal") - if iface and iface ~= "" then - local routing = uci:t_sections("luci_fw") - if routing then - for k, v in pairs(routing) do - if v[".type"] == "routing" and (v.oface == iface and v.iface == "ff") then - uci:t_del("luci_fw", k) - end - end - - local int = uci:t_add("luci_fw", "routing") - uci:t_set("luci_fw", int, "iface", "ff") - uci:t_set("luci_fw", int, "oface", iface) - uci:t_set("luci_fw", int, "fwd", "1") - uci:t_set("luci_fw", int, "nat", "1") - end - end - - -- Configure DHCP - if ffluci.http.formvalue("dhcp") then - local dhcpnet = uci:t_get("freifunk", "community", "dhcp"):match("^([0-9]+)") - local dhcpip = ip:gsub("^[0-9]+", dhcpnet) - - uci:t_set("network", "ffdhcp", nil, "interface") - uci:t_set("network", "ffdhcp", "proto", "static") - uci:t_set("network", "ffdhcp", "ifname", "br-ff:dhcp") - uci:t_set("network", "ffdhcp", "ipaddr", dhcpip) - uci:t_set("network", "ffdhcp", "netmask", uci:t_get("freifunk", "community", "dhcpmask")) - - local dhcp = uci:t_sections("dhcp") - if dhcp then - for k, v in pairs(dhcp) do - if v[".type"] == "dhcp" and v.interface == "ffdhcp" then - uci:t_del("dhcp", k) - end - end - - local dhcpbeg = 48 + tonumber(ip:match("[0-9]+$")) * 4 - - local sk = uci:t_add("dhcp", "dhcp") - uci:t_set("dhcp", sk, "interface", "ffdhcp") - uci:t_set("dhcp", sk, "start", dhcpbeg) - uci:t_set("dhcp", sk, "limit", (dhcpbeg < 252) and 3 or 2) - uci:t_set("dhcp", sk, "leasetime", "30m") - end - - local splash = uci:t_sections("luci_splash") - if splash then - for k, v in pairs(splash) do - if v[".type"] == "iface" then - uci:t_del("luci_splash", k) - end - end - - local sk = uci:t_add("luci_splash", "iface") - uci:t_set("luci_splash", sk, "network", "ffdhcp") - end - - local routing = uci:t_sections("luci_fw") - if routing then - for k, v in pairs(routing) do - if v[".type"] == "routing" and (v.iface == "ffdhcp" or v.oface == "ffdhcp") then - uci:t_del("luci_fw", k) - end - end - - local int = uci:t_add("luci_fw", "routing") - uci:t_set("luci_fw", int, "iface", "ffdhcp") - uci:t_set("luci_fw", int, "oface", "ff") - uci:t_set("luci_fw", int, "nat", "1") - - local iface = ffluci.http.formvalue("toexternal") - if iface and iface ~= "" then - local int = uci:t_add("luci_fw", "routing") - uci:t_set("luci_fw", int, "iface", "ffdhcp") - uci:t_set("luci_fw", int, "oface", iface) - uci:t_set("luci_fw", int, "nat", "1") - end - end - end - - -- Configure OLSR - if ffluci.http.formvalue("olsr") and uci:t_sections("olsr") then - for k, v in pairs(uci:t_sections("olsr")) do - if v[".type"] == "Interface" or v[".type"] == "LoadPlugin" then - uci:t_del("olsr", k) - end - end - - if ffluci.http.formvalue("shareinet") then - uci:t_set("olsr", "dyn_gw", nil, "LoadPlugin") - uci:t_set("olsr", "dyn_gw", "Library", "olsrd_dyn_gw.so.0.4") - end - - uci:t_set("olsr", "nameservice", nil, "LoadPlugin") - uci:t_set("olsr", "nameservice", "Library", "olsrd_nameservice.so.0.3") - uci:t_set("olsr", "nameservice", "name", ip:gsub("%.", "-")) - uci:t_set("olsr", "nameservice", "hosts_file", "/var/etc/hosts") - uci:t_set("olsr", "nameservice", "suffix", ".olsr") - uci:t_set("olsr", "nameservice", "latlon_infile", "/tmp/latlon.txt") - - uci:t_set("olsr", "txtinfo", nil, "LoadPlugin") - uci:t_set("olsr", "txtinfo", "Library", "olsrd_txtinfo.so.0.1") - uci:t_set("olsr", "txtinfo", "Accept", "127.0.0.1") - - local oif = uci:t_add("olsr", "Interface") - uci:t_set("olsr", oif, "Interface", "ff") - uci:t_set("olsr", oif, "HelloInterval", "6.0") - uci:t_set("olsr", oif, "HelloValidityTime", "108.0") - uci:t_set("olsr", oif, "TcInterval", "4.0") - uci:t_set("olsr", oif, "TcValidityTime", "324.0") - uci:t_set("olsr", oif, "MidInterval", "18.0") - uci:t_set("olsr", oif, "MidValidityTime", "324.0") - uci:t_set("olsr", oif, "HnaInterval", "18.0") - uci:t_set("olsr", oif, "HnaValidityTime", "108.0") - end - - -- Configure Wifi - local wcfg = uci:t_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, j in pairs(wcfg) do - if j[".type"] == "wifi-iface" and j.device == iface then - uci:t_del("wireless", k) - end - end - - uci:t_set("wireless", iface, "disabled", "0") - uci:t_set("wireless", iface, "mode", "11g") - uci:t_set("wireless", iface, "txantenna", 1) - uci:t_set("wireless", iface, "rxantenna", 1) - uci:t_set("wireless", iface, "channel", uci:t_get("freifunk", "community", "channel")) - - local wif = uci:t_add("wireless", "wifi-iface") - uci:t_set("wireless", wif, "device", iface) - uci:t_set("wireless", wif, "network", "ff") - uci:t_set("wireless", wif, "mode", "adhoc") - uci:t_set("wireless", wif, "ssid", uci:t_get("freifunk", "community", "essid")) - uci:t_set("wireless", wif, "bssid", uci:t_get("freifunk", "community", "bssid")) - uci:t_set("wireless", wif, "txpower", 13) - end - end - end - - -- Save UCI - uci:t_save("network") - uci:t_save("dhcp") - uci:t_save("freifunk") - uci:t_save("luci_splash") - uci:t_save("olsr") - uci:t_save("wireless") - uci:t_save("luci_fw") - - ffluci.http.redirect(ffluci.dispatcher.build_url("admin", "uci", "changes")) -end \ No newline at end of file diff --git a/modules/freifunk/src/controller/freifunk/freifunk.lua b/modules/freifunk/src/controller/freifunk/freifunk.lua new file mode 100644 index 000000000..e73ec263c --- /dev/null +++ b/modules/freifunk/src/controller/freifunk/freifunk.lua @@ -0,0 +1,311 @@ +module("ffluci.controller.freifunk.freifunk", package.seeall) + +function index() + local page = node() + page.target = alias("freifunk") + + local page = node("freifunk") + page.title = "Freifunk" + page.target = alias("freifunk", "index") + page.order = 5 + page.setuser = "nobody" + page.setgroup = "nogroup" + + local page = node("freifunk", "index") + page.target = template("freifunk/index") + page.title = "Übersicht" + page.order = 10 + + local page = node("freifunk", "index", "contact") + page.target = template("freifunk/contact") + page.title = "Kontakt" + + + local page = node("freifunk", "status") + page.target = action_status + page.title = "Status" + page.order = 20 + page.setuser = false + page.setgroup = false + + local page = node("freifunk", "status", "routes") + page.target = template("public_status/routes") + page.title = "Routingtabelle" + page.order = 10 + + local page = node("freifunk", "status", "iwscan") + page.target = template("public_status/iwscan") + page.title = "WLAN-Scan" + page.order = 20 + + + local page = node("admin", "index", "wizard") + page.target = action_wizard + page.title = "Freifunkassistent" + page.order = 20 + + local page = node("admin", "index", "freifunk") + page.target = cbi("freifunk/freifunk") + page.title = "Freifunk" + page.order = 30 + + local page = node("admin", "index", "contact") + page.target = cbi("freifunk/contact") + page.title = "Kontakt" + page.order = 40 +end + +function action_status() + local data = {} + + data.s, data.m, data.r = ffluci.sys.sysinfo() + + data.wifi = ffluci.sys.wifi.getiwconfig() + + data.routes = {} + for i, r in pairs(ffluci.sys.net.routes()) do + if r.Destination == "00000000" then + table.insert(data.routes, r) + end + end + + + ffluci.template.render("public_status/index", data) +end + +function action_wizard() + if ffluci.http.formvalue("ip") then + return configure_freifunk() + end + + local ifaces = {} + local wldevs = ffluci.model.uci.sections("wireless") + + if wldevs then + for k, v in pairs(wldevs) do + if v[".type"] == "wifi-device" then + table.insert(ifaces, k) + end + end + end + + ffluci.template.render("freifunk/wizard", {ifaces=ifaces}) +end + +function configure_freifunk() + local ip = ffluci.http.formvalue("ip") + local uci = ffluci.model.uci.Session() + + -- Load UCI + uci:t_load("network") + uci:t_load("dhcp") + uci:t_load("freifunk") + uci:t_load("luci_splash") + uci:t_load("olsr") + uci:t_load("wireless") + uci:t_load("luci_fw") + + + -- Configure FF-Interface + uci:t_del("network", "ff") + uci:t_del("network", "ffdhcp") + + uci:t_set("network", "ff", nil, "interface") + uci:t_set("network", "ff", "type", "bridge") + uci:t_set("network", "ff", "proto", "static") + uci:t_set("network", "ff", "ipaddr", ip) + uci:t_set("network", "ff", "netmask", uci:t_get("freifunk", "community", "mask")) + uci:t_set("network", "ff", "dns", uci:t_get("freifunk", "community", "dns")) + + -- Reset Routing + local routing = uci:t_sections("luci_fw") + if routing then + for k, v in pairs(routing) do + if v[".type"] == "routing" and (v.iface == "ff" or v.oface == "ff") then + uci:t_del("luci_fw", k) + end + end + + local int = uci:t_add("luci_fw", "routing") + uci:t_set("luci_fw", int, "iface", "ff") + uci:t_set("luci_fw", int, "oface", "ff") + uci:t_set("luci_fw", int, "fwd", "1") + end + + -- Routing from Internal + local iface = ffluci.http.formvalue("frominternal") + if iface and iface ~= "" then + local routing = uci:t_sections("luci_fw") + if routing then + for k, v in pairs(routing) do + if v[".type"] == "routing" and (v.iface == iface and v.oface == "ff") then + uci:t_del("luci_fw", k) + end + end + + local int = uci:t_add("luci_fw", "routing") + uci:t_set("luci_fw", int, "iface", iface) + uci:t_set("luci_fw", int, "oface", "ff") + uci:t_set("luci_fw", int, "fwd", "1") + uci:t_set("luci_fw", int, "nat", "1") + end + end + + -- Routing to External + local iface = ffluci.http.formvalue("toexternal") + if iface and iface ~= "" then + local routing = uci:t_sections("luci_fw") + if routing then + for k, v in pairs(routing) do + if v[".type"] == "routing" and (v.oface == iface and v.iface == "ff") then + uci:t_del("luci_fw", k) + end + end + + local int = uci:t_add("luci_fw", "routing") + uci:t_set("luci_fw", int, "iface", "ff") + uci:t_set("luci_fw", int, "oface", iface) + uci:t_set("luci_fw", int, "fwd", "1") + uci:t_set("luci_fw", int, "nat", "1") + end + end + + -- Configure DHCP + if ffluci.http.formvalue("dhcp") then + local dhcpnet = uci:t_get("freifunk", "community", "dhcp"):match("^([0-9]+)") + local dhcpip = ip:gsub("^[0-9]+", dhcpnet) + + uci:t_set("network", "ffdhcp", nil, "interface") + uci:t_set("network", "ffdhcp", "proto", "static") + uci:t_set("network", "ffdhcp", "ifname", "br-ff:dhcp") + uci:t_set("network", "ffdhcp", "ipaddr", dhcpip) + uci:t_set("network", "ffdhcp", "netmask", uci:t_get("freifunk", "community", "dhcpmask")) + + local dhcp = uci:t_sections("dhcp") + if dhcp then + for k, v in pairs(dhcp) do + if v[".type"] == "dhcp" and v.interface == "ffdhcp" then + uci:t_del("dhcp", k) + end + end + + local dhcpbeg = 48 + tonumber(ip:match("[0-9]+$")) * 4 + + local sk = uci:t_add("dhcp", "dhcp") + uci:t_set("dhcp", sk, "interface", "ffdhcp") + uci:t_set("dhcp", sk, "start", dhcpbeg) + uci:t_set("dhcp", sk, "limit", (dhcpbeg < 252) and 3 or 2) + uci:t_set("dhcp", sk, "leasetime", "30m") + end + + local splash = uci:t_sections("luci_splash") + if splash then + for k, v in pairs(splash) do + if v[".type"] == "iface" then + uci:t_del("luci_splash", k) + end + end + + local sk = uci:t_add("luci_splash", "iface") + uci:t_set("luci_splash", sk, "network", "ffdhcp") + end + + local routing = uci:t_sections("luci_fw") + if routing then + for k, v in pairs(routing) do + if v[".type"] == "routing" and (v.iface == "ffdhcp" or v.oface == "ffdhcp") then + uci:t_del("luci_fw", k) + end + end + + local int = uci:t_add("luci_fw", "routing") + uci:t_set("luci_fw", int, "iface", "ffdhcp") + uci:t_set("luci_fw", int, "oface", "ff") + uci:t_set("luci_fw", int, "nat", "1") + + local iface = ffluci.http.formvalue("toexternal") + if iface and iface ~= "" then + local int = uci:t_add("luci_fw", "routing") + uci:t_set("luci_fw", int, "iface", "ffdhcp") + uci:t_set("luci_fw", int, "oface", iface) + uci:t_set("luci_fw", int, "nat", "1") + end + end + end + + -- Configure OLSR + if ffluci.http.formvalue("olsr") and uci:t_sections("olsr") then + for k, v in pairs(uci:t_sections("olsr")) do + if v[".type"] == "Interface" or v[".type"] == "LoadPlugin" then + uci:t_del("olsr", k) + end + end + + if ffluci.http.formvalue("shareinet") then + uci:t_set("olsr", "dyn_gw", nil, "LoadPlugin") + uci:t_set("olsr", "dyn_gw", "Library", "olsrd_dyn_gw.so.0.4") + end + + uci:t_set("olsr", "nameservice", nil, "LoadPlugin") + uci:t_set("olsr", "nameservice", "Library", "olsrd_nameservice.so.0.3") + uci:t_set("olsr", "nameservice", "name", ip:gsub("%.", "-")) + uci:t_set("olsr", "nameservice", "hosts_file", "/var/etc/hosts") + uci:t_set("olsr", "nameservice", "suffix", ".olsr") + uci:t_set("olsr", "nameservice", "latlon_infile", "/tmp/latlon.txt") + + uci:t_set("olsr", "txtinfo", nil, "LoadPlugin") + uci:t_set("olsr", "txtinfo", "Library", "olsrd_txtinfo.so.0.1") + uci:t_set("olsr", "txtinfo", "Accept", "127.0.0.1") + + local oif = uci:t_add("olsr", "Interface") + uci:t_set("olsr", oif, "Interface", "ff") + uci:t_set("olsr", oif, "HelloInterval", "6.0") + uci:t_set("olsr", oif, "HelloValidityTime", "108.0") + uci:t_set("olsr", oif, "TcInterval", "4.0") + uci:t_set("olsr", oif, "TcValidityTime", "324.0") + uci:t_set("olsr", oif, "MidInterval", "18.0") + uci:t_set("olsr", oif, "MidValidityTime", "324.0") + uci:t_set("olsr", oif, "HnaInterval", "18.0") + uci:t_set("olsr", oif, "HnaValidityTime", "108.0") + end + + -- Configure Wifi + local wcfg = uci:t_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, j in pairs(wcfg) do + if j[".type"] == "wifi-iface" and j.device == iface then + uci:t_del("wireless", k) + end + end + + uci:t_set("wireless", iface, "disabled", "0") + uci:t_set("wireless", iface, "mode", "11g") + uci:t_set("wireless", iface, "txantenna", 1) + uci:t_set("wireless", iface, "rxantenna", 1) + uci:t_set("wireless", iface, "channel", uci:t_get("freifunk", "community", "channel")) + + local wif = uci:t_add("wireless", "wifi-iface") + uci:t_set("wireless", wif, "device", iface) + uci:t_set("wireless", wif, "network", "ff") + uci:t_set("wireless", wif, "mode", "adhoc") + uci:t_set("wireless", wif, "ssid", uci:t_get("freifunk", "community", "essid")) + uci:t_set("wireless", wif, "bssid", uci:t_get("freifunk", "community", "bssid")) + uci:t_set("wireless", wif, "txpower", 13) + end + end + end + + -- Save UCI + uci:t_save("network") + uci:t_save("dhcp") + uci:t_save("freifunk") + uci:t_save("luci_splash") + uci:t_save("olsr") + uci:t_save("wireless") + uci:t_save("luci_fw") + + ffluci.http.redirect(ffluci.dispatcher.build_url("admin", "uci", "changes")) +end \ No newline at end of file diff --git a/modules/freifunk/src/controller/freifunk/luciinfo.lua b/modules/freifunk/src/controller/freifunk/luciinfo.lua new file mode 100644 index 000000000..bc45898d9 --- /dev/null +++ b/modules/freifunk/src/controller/freifunk/luciinfo.lua @@ -0,0 +1,45 @@ +module("ffluci.controller.freifunk.luciinfo", package.seeall) + +function index() + node("freifunk", "luciinfo").target = action_index +end + +function action_index() + local uci = ffluci.model.uci.StateSession() + + ffluci.http.prepare_content("text/plain") + + -- General + print("luciinfo.api=1") + print("luciinfo.version=" .. tostring(require("ffluci").__version__)) + + -- Sysinfo + local s, m, r = ffluci.sys.sysinfo() + local dr = ffluci.sys.net.defaultroute() + dr = dr and ffluci.sys.net.hexip4(dr.Gateway) or "" + local l1, l5, l15 = ffluci.sys.loadavg() + + print("sysinfo.system=" .. sanitize(s)) + print("sysinfo.cpu=" .. sanitize(m)) + print("sysinfo.ram=" .. sanitize(r)) + print("sysinfo.hostname=" .. sanitize(ffluci.sys.hostname())) + print("sysinfo.load1=" .. tostring(l1)) + print("sysinfo.load5=" .. tostring(l5)) + print("sysinfo.load15=" .. tostring(l15)) + print("sysinfo.defaultgw=" .. dr) + + + -- Freifunk + local ff = uci:sections("freifunk") or {} + for k, v in pairs(ff) do + for i, j in pairs(v) do + if i:sub(1, 1) ~= "." then + print("freifunk." .. k .. "." .. i .. "=" .. j) + end + end + end +end + +function sanitize(val) + return val:gsub("\n", "\t") +end \ No newline at end of file diff --git a/modules/freifunk/src/controller/freifunk/olsr.lua b/modules/freifunk/src/controller/freifunk/olsr.lua new file mode 100644 index 000000000..6031cd431 --- /dev/null +++ b/modules/freifunk/src/controller/freifunk/olsr.lua @@ -0,0 +1,164 @@ +module("ffluci.controller.freifunk.olsr", package.seeall) +require("ffluci.sys") + +function index() + local page = node("freifunk", "olsr") + page.target = action_index + page.title = "OLSR" + page.order = 30 + + local page = node("freifunk", "olsr", "routes") + page.target = action_routes + page.title = "Routen" + page.order = 10 + + local page = node("freifunk", "olsr", "topology") + page.target = action_topology + page.title = "Topologie" + page.order = 20 + + local page = node("freifunk", "olsr", "hna") + page.target = action_hna + page.title = "HNA" + page.order = 30 + + local page = node("freifunk", "olsr", "mid") + page.target = action_mid + page.title = "MID" + page.order = 50 +end + +function action_index() + local data = fetch_txtinfo("links") + + if not data or not data.Links then + ffluci.template.render("freifunk-olsr/error_olsr") + return nil + end + + local function compare(a, b) + if tonumber(a.ETX) == 0 then + return false + end + + if tonumber(b.ETX) == 0 then + return true + end + + return tonumber(a.ETX) < tonumber(b.ETX) + end + + table.sort(data.Links, compare) + + ffluci.template.render("freifunk-olsr/index", {links=data.Links}) +end + +function action_routes() + local data = fetch_txtinfo("routes") + + if not data or not data.Routes then + ffluci.template.render("freifunk-olsr/error_olsr") + return nil + end + + local function compare(a, b) + if tonumber(a.ETX) == 0 then + return false + end + + if tonumber(b.ETX) == 0 then + return true + end + + return tonumber(a.ETX) < tonumber(b.ETX) + end + + table.sort(data.Routes, compare) + + ffluci.template.render("freifunk-olsr/routes", {routes=data.Routes}) +end + +function action_topology() + local data = fetch_txtinfo("topology") + + if not data or not data.Topology then + ffluci.template.render("freifunk-olsr/error_olsr") + return nil + end + + local function compare(a, b) + return a["Destination IP"] < b["Destination IP"] + end + + table.sort(data.Topology, compare) + + ffluci.template.render("freifunk-olsr/topology", {routes=data.Topology}) +end + +function action_hna() + local data = fetch_txtinfo("hna") + + if not data or not data.HNA then + ffluci.template.render("freifunk-olsr/error_olsr") + return nil + end + + local function compare(a, b) + return a.Network < b.Network + end + + table.sort(data.HNA, compare) + + ffluci.template.render("freifunk-olsr/hna", {routes=data.HNA}) +end + +function action_mid() + local data = fetch_txtinfo("mid") + + if not data or not data.MID then + ffluci.template.render("freifunk-olsr/error_olsr") + return nil + end + + local function compare(a, b) + return a.IP < b.IP + end + + table.sort(data.MID, compare) + + ffluci.template.render("freifunk-olsr/mid", {mids=data.MID}) +end + + +-- Internal +function fetch_txtinfo(otable) + otable = otable or "" + local rawdata = ffluci.sys.httpget("http://127.0.0.1:2006/"..otable) + + if #rawdata == 0 then + return nil + end + + local data = {} + + local tables = ffluci.util.split(ffluci.util.trim(rawdata), "\n\n") + + + for i, tbl in ipairs(tables) do + local lines = ffluci.util.split(tbl, "\n") + local name = table.remove(lines, 1):sub(8) + local keys = ffluci.util.split(table.remove(lines, 1), "\t") + + data[name] = {} + + for j, line in ipairs(lines) do + local fields = ffluci.util.split(line, "\t") + data[name][j] = {} + for k, key in pairs(keys) do + data[name][j][key] = fields[k] + end + end + end + + return data +end \ No newline at end of file diff --git a/modules/freifunk/src/controller/public/index.lua b/modules/freifunk/src/controller/public/index.lua deleted file mode 100644 index f65478c05..000000000 --- a/modules/freifunk/src/controller/public/index.lua +++ /dev/null @@ -1 +0,0 @@ -module("ffluci.controller.public.index", package.seeall) \ No newline at end of file diff --git a/modules/freifunk/src/controller/public/olsr.lua b/modules/freifunk/src/controller/public/olsr.lua deleted file mode 100644 index d41f5ed41..000000000 --- a/modules/freifunk/src/controller/public/olsr.lua +++ /dev/null @@ -1,137 +0,0 @@ -module("ffluci.controller.public.olsr", package.seeall) -require("ffluci.sys") - -function action_index() - local data = fetch_txtinfo("links") - - if not data or not data.Links then - ffluci.template.render("public_olsr/error_olsr") - return nil - end - - local function compare(a, b) - if tonumber(a.ETX) == 0 then - return false - end - - if tonumber(b.ETX) == 0 then - return true - end - - return tonumber(a.ETX) < tonumber(b.ETX) - end - - table.sort(data.Links, compare) - - ffluci.template.render("public_olsr/index", {links=data.Links}) -end - -function action_routes() - local data = fetch_txtinfo("routes") - - if not data or not data.Routes then - ffluci.template.render("public_olsr/error_olsr") - return nil - end - - local function compare(a, b) - if tonumber(a.ETX) == 0 then - return false - end - - if tonumber(b.ETX) == 0 then - return true - end - - return tonumber(a.ETX) < tonumber(b.ETX) - end - - table.sort(data.Routes, compare) - - ffluci.template.render("public_olsr/routes", {routes=data.Routes}) -end - -function action_topology() - local data = fetch_txtinfo("topology") - - if not data or not data.Topology then - ffluci.template.render("public_olsr/error_olsr") - return nil - end - - local function compare(a, b) - return a["Destination IP"] < b["Destination IP"] - end - - table.sort(data.Topology, compare) - - ffluci.template.render("public_olsr/topology", {routes=data.Topology}) -end - -function action_hna() - local data = fetch_txtinfo("hna") - - if not data or not data.HNA then - ffluci.template.render("public_olsr/error_olsr") - return nil - end - - local function compare(a, b) - return a.Network < b.Network - end - - table.sort(data.HNA, compare) - - ffluci.template.render("public_olsr/hna", {routes=data.HNA}) -end - -function action_mid() - local data = fetch_txtinfo("mid") - - if not data or not data.MID then - ffluci.template.render("public_olsr/error_olsr") - return nil - end - - local function compare(a, b) - return a.IP < b.IP - end - - table.sort(data.MID, compare) - - ffluci.template.render("public_olsr/mid", {mids=data.MID}) -end - - --- Internal -function fetch_txtinfo(otable) - otable = otable or "" - local rawdata = ffluci.sys.httpget("http://127.0.0.1:2006/"..otable) - - if #rawdata == 0 then - return nil - end - - local data = {} - - local tables = ffluci.util.split(ffluci.util.trim(rawdata), "\n\n") - - - for i, tbl in ipairs(tables) do - local lines = ffluci.util.split(tbl, "\n") - local name = table.remove(lines, 1):sub(8) - local keys = ffluci.util.split(table.remove(lines, 1), "\t") - - data[name] = {} - - for j, line in ipairs(lines) do - local fields = ffluci.util.split(line, "\t") - data[name][j] = {} - for k, key in pairs(keys) do - data[name][j][key] = fields[k] - end - end - end - - return data -end \ No newline at end of file diff --git a/modules/freifunk/src/controller/public/status.lua b/modules/freifunk/src/controller/public/status.lua deleted file mode 100644 index 8d2f7a303..000000000 --- a/modules/freifunk/src/controller/public/status.lua +++ /dev/null @@ -1,21 +0,0 @@ -module("ffluci.controller.public.status", package.seeall) - -function action_index() - local data = {} - - data.s, data.m, data.r = ffluci.sys.sysinfo() - - data.wifi = ffluci.sys.wifi.getiwconfig() - - data.routes = {} - for i, r in pairs(ffluci.sys.net.routes()) do - if r.Destination == "00000000" then - table.insert(data.routes, r) - end - end - - - ffluci.template.render("public_status/index", data) -end - - diff --git a/modules/freifunk/src/controller/rpc/luciinfo.lua b/modules/freifunk/src/controller/rpc/luciinfo.lua deleted file mode 100644 index 611423fbb..000000000 --- a/modules/freifunk/src/controller/rpc/luciinfo.lua +++ /dev/null @@ -1,41 +0,0 @@ -module("ffluci.controller.rpc.luciinfo", package.seeall) - -function action_index() - local uci = ffluci.model.uci.StateSession() - - ffluci.http.prepare_content("text/plain") - - -- General - print("luciinfo.api=1") - print("luciinfo.version=" .. tostring(ffluci.__version__)) - - -- Sysinfo - local s, m, r = ffluci.sys.sysinfo() - local dr = ffluci.sys.net.defaultroute() - dr = dr and ffluci.sys.net.hexip4(dr.Gateway) or "" - local l1, l5, l15 = ffluci.sys.loadavg() - - print("sysinfo.system=" .. sanitize(s)) - print("sysinfo.cpu=" .. sanitize(m)) - print("sysinfo.ram=" .. sanitize(r)) - print("sysinfo.hostname=" .. sanitize(ffluci.sys.hostname())) - print("sysinfo.load1=" .. tostring(l1)) - print("sysinfo.load5=" .. tostring(l5)) - print("sysinfo.load15=" .. tostring(l15)) - print("sysinfo.defaultgw=" .. dr) - - - -- Freifunk - 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) - return val:gsub("\n", "\t") -end \ No newline at end of file diff --git a/modules/freifunk/src/controller/sudo/status.lua b/modules/freifunk/src/controller/sudo/status.lua deleted file mode 100644 index fd5127d2c..000000000 --- a/modules/freifunk/src/controller/sudo/status.lua +++ /dev/null @@ -1 +0,0 @@ -module("ffluci.controller.sudo.status", package.seeall) \ No newline at end of file diff --git a/modules/freifunk/src/model/cbi/admin_index/contact.lua b/modules/freifunk/src/model/cbi/admin_index/contact.lua deleted file mode 100644 index 66a1ec4bd..000000000 --- a/modules/freifunk/src/model/cbi/admin_index/contact.lua +++ /dev/null @@ -1,18 +0,0 @@ --- Todo: Translate -m = Map("freifunk", translate("contact", "Kontakt"), translate("contact1", [[Diese Daten sind -auf der öffentlichen Kontaktseite sichtbar. Bitte gib an, wie man dich am besten kontaktieren kann. -Diese Informationen sollten nach der Picopeering Vereinbarung mindestens deine E-Mail-Adresse enthalten. -Damit dein Knoten durch Topographieprogramme erfasst werden kann, gib bitte deine Geokoordinaten oder -zumindest deine Straße und Hausnummer unter Standort an.]])) - -c = m:section(NamedSection, "contact", "public") - -c:option(Value, "nickname", translate("nickname", "Pseudonym")) -c:option(Value, "name", translate("name", "Name")) -c:option(Value, "mail", translate("mail", "E-Mail"), translate("mail1", "Bitte unbedingt angeben!")) -c:option(Value, "phone", translate("phone", "Telefon")) -c:option(Value, "location", translate("location", "Standort")) -c:option(Value, "geo", translate("coord", "Koordinaten"), translate("coord1", "Bitte als Breite;Länge (z.B: 51.5;12.9) angeben")) -c:option(Value, "note", translate("note", "Notiz")) - -return m \ No newline at end of file diff --git a/modules/freifunk/src/model/cbi/admin_index/freifunk.lua b/modules/freifunk/src/model/cbi/admin_index/freifunk.lua deleted file mode 100644 index fe9e285b4..000000000 --- a/modules/freifunk/src/model/cbi/admin_index/freifunk.lua +++ /dev/null @@ -1,19 +0,0 @@ --- Todo: Translate -m = Map("freifunk", "Freifunk") - -c = m:section(NamedSection, "community", "public", "Gemeinschaft", [[Dies sind die Grundeinstellungen -für die lokale Freifunkgemeinschaft. Diese Werte wirken sich NICHT auf die Konfiguration -des Routers aus, sondern definieren nur die Vorgaben für den Freifunkassistenten.]]) -c:option(Value, "name", "Gemeinschaft") -c:option(Value, "homepage", "Webseite") -c:option(Value, "essid", "ESSID") -c:option(Value, "bssid", "BSSID") -c:option(Value, "channel", "Funkkanal") -c:option(Value, "realm", "Realm") -c:option(Value, "net", "Adressbereich") -c:option(Value, "mask", "Netzmaske") -c:option(Value, "dns", "DNS-Server") -c:option(Value, "dhcp", "DHCP-Bereich") -c:option(Value, "dhcpmask", "DHCP-Maske") - -return m \ No newline at end of file diff --git a/modules/freifunk/src/model/cbi/freifunk/contact.lua b/modules/freifunk/src/model/cbi/freifunk/contact.lua new file mode 100644 index 000000000..66a1ec4bd --- /dev/null +++ b/modules/freifunk/src/model/cbi/freifunk/contact.lua @@ -0,0 +1,18 @@ +-- Todo: Translate +m = Map("freifunk", translate("contact", "Kontakt"), translate("contact1", [[Diese Daten sind +auf der öffentlichen Kontaktseite sichtbar. Bitte gib an, wie man dich am besten kontaktieren kann. +Diese Informationen sollten nach der Picopeering Vereinbarung mindestens deine E-Mail-Adresse enthalten. +Damit dein Knoten durch Topographieprogramme erfasst werden kann, gib bitte deine Geokoordinaten oder +zumindest deine Straße und Hausnummer unter Standort an.]])) + +c = m:section(NamedSection, "contact", "public") + +c:option(Value, "nickname", translate("nickname", "Pseudonym")) +c:option(Value, "name", translate("name", "Name")) +c:option(Value, "mail", translate("mail", "E-Mail"), translate("mail1", "Bitte unbedingt angeben!")) +c:option(Value, "phone", translate("phone", "Telefon")) +c:option(Value, "location", translate("location", "Standort")) +c:option(Value, "geo", translate("coord", "Koordinaten"), translate("coord1", "Bitte als Breite;Länge (z.B: 51.5;12.9) angeben")) +c:option(Value, "note", translate("note", "Notiz")) + +return m \ No newline at end of file diff --git a/modules/freifunk/src/model/cbi/freifunk/freifunk.lua b/modules/freifunk/src/model/cbi/freifunk/freifunk.lua new file mode 100644 index 000000000..fe9e285b4 --- /dev/null +++ b/modules/freifunk/src/model/cbi/freifunk/freifunk.lua @@ -0,0 +1,19 @@ +-- Todo: Translate +m = Map("freifunk", "Freifunk") + +c = m:section(NamedSection, "community", "public", "Gemeinschaft", [[Dies sind die Grundeinstellungen +für die lokale Freifunkgemeinschaft. Diese Werte wirken sich NICHT auf die Konfiguration +des Routers aus, sondern definieren nur die Vorgaben für den Freifunkassistenten.]]) +c:option(Value, "name", "Gemeinschaft") +c:option(Value, "homepage", "Webseite") +c:option(Value, "essid", "ESSID") +c:option(Value, "bssid", "BSSID") +c:option(Value, "channel", "Funkkanal") +c:option(Value, "realm", "Realm") +c:option(Value, "net", "Adressbereich") +c:option(Value, "mask", "Netzmaske") +c:option(Value, "dns", "DNS-Server") +c:option(Value, "dhcp", "DHCP-Bereich") +c:option(Value, "dhcpmask", "DHCP-Maske") + +return m \ No newline at end of file diff --git a/modules/freifunk/src/model/menu/10freifunk.lua b/modules/freifunk/src/model/menu/10freifunk.lua deleted file mode 100644 index 3adbe8985..000000000 --- a/modules/freifunk/src/model/menu/10freifunk.lua +++ /dev/null @@ -1,18 +0,0 @@ -add("public", "index", "Übersicht", 10) -act("contact", "Kontakt") - -add("public", "status", "Status", 20) -act("routes", "Routingtabelle") -act("iwscan", "WLAN-Scan") - -add("public", "olsr", "OLSR", 30) -act("routes", "Routen") -act("topology", "Topologie") -act("hna", "HNA") -act("mid", "MID") - - -sel("admin", "index") -act("wizard", "Freifunkassistent") -act("contact", "Kontakt") -act("freifunk", "Freifunk") \ No newline at end of file diff --git a/modules/freifunk/src/view/admin_index/wizard.htm b/modules/freifunk/src/view/admin_index/wizard.htm deleted file mode 100644 index b08703ffe..000000000 --- a/modules/freifunk/src/view/admin_index/wizard.htm +++ /dev/null @@ -1,58 +0,0 @@ -<%+header%> -

<%:ffwizard Freifunkassistent%>

-

<%:ffwizard1 Dieser Assistent konfiguriert den Router für die Benutzung im Freifunknetz%>

-
-
-
-
-
<%:ip IP-Adresse%>:  -
-
- <% for i, k in ipairs(ifaces) do %> -
-
<%:wificfg Drahtlosgerät einrichten%>: <%=k%>
-
-
- <% end %> -
-
<%:cfgolsr OLSR konfigurieren%>
-
-
-
-
<%:cfgdhcp Drahtlos DHCP konfigurieren%>
-
-
-
-
<%:cfginternal Erlaube Zugriff von internem Netzwerk%>:
-
-
-
-
<%:cfgexternal Erlaube Zugriff auf externes Netzwerk%>:
-
-
-
-
<%:shareinet Internetzugang ankündigen%>
-
-
-
-
-
- - -
-
-<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/freifunk-olsr/error_olsr.htm b/modules/freifunk/src/view/freifunk-olsr/error_olsr.htm new file mode 100644 index 000000000..25426f50d --- /dev/null +++ b/modules/freifunk/src/view/freifunk-olsr/error_olsr.htm @@ -0,0 +1,6 @@ +<%+header%> +

<%:olsr OLSR%>

+

<%:olsrerror1 Es konnte keine Verbindung zum OLSR-Daemon hergestellt werden!%>

+

<%:olsrerror2 Um die Statusinformationen abfragen zu können muss der OLSR-Daemon gestartet +und das Plugin "txtinfo" geladen sein.%>

+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/freifunk-olsr/hna.htm b/modules/freifunk/src/view/freifunk-olsr/hna.htm new file mode 100644 index 000000000..c13369f42 --- /dev/null +++ b/modules/freifunk/src/view/freifunk-olsr/hna.htm @@ -0,0 +1,17 @@ +<%+header%> +

<%:olsrhna OLSR-HNA%>

+
+ + + + + +<% for k, route in ipairs(routes) do %> + + + + +<% end %> +
<%:destination Ziel%><%:gateway Gateway%>
<%=route.Network%>/<%=route.Netmask%><%=route.Gateway%>
+
+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/freifunk-olsr/index.htm b/modules/freifunk/src/view/freifunk-olsr/index.htm new file mode 100644 index 000000000..0633d1f45 --- /dev/null +++ b/modules/freifunk/src/view/freifunk-olsr/index.htm @@ -0,0 +1,43 @@ +<%+header%> +

<%:olsrlinks OLSR-Verbindungen%>

+

<%:olsrlinks1 Übersicht über aktuell bestehende OLSR-Verbindungen%>

+
+ + + + + + + + +<% for k, link in ipairs(links) do + local color = "#bb3333" + + link.ETX = tonumber(link.ETX) + if link.ETX == 0 then + color = "#bb3333" + elseif link.ETX < 4 then + color = "#00cc00" + elseif link.ETX < 10 then + color = "#ffcb05" + elseif link.ETX < 100 then + color = "#ff6600" + end +%> + + + + + + + +<% end %> +
<%:destination Ziel%><%:local Lokal%>LQNLQETX
"><%=link["remote IP"]%><%=link["Local IP"]%><%=link.LinkQuality%><%=link.NLQ%><%=link.ETX%>
+
+

<%:legend Legende%>:

+ +<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/freifunk-olsr/mid.htm b/modules/freifunk/src/view/freifunk-olsr/mid.htm new file mode 100644 index 000000000..6553237ea --- /dev/null +++ b/modules/freifunk/src/view/freifunk-olsr/mid.htm @@ -0,0 +1,17 @@ +<%+header%> +

<%:olsrmid OLSR-MID%>

+
+ + + + + +<% for k, mid in ipairs(mids) do %> + + + + +<% end %> +
<%:node Knoten%><%:aliases Aliasse%>
<%=mid.IP%><%=mid.Aliases%>
+
+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/freifunk-olsr/routes.htm b/modules/freifunk/src/view/freifunk-olsr/routes.htm new file mode 100644 index 000000000..f3a0fd336 --- /dev/null +++ b/modules/freifunk/src/view/freifunk-olsr/routes.htm @@ -0,0 +1,36 @@ +<%+header%> +

<%:olsrlinks OLSR-Routen%>

+
+ + + + + + + + +<% for k, route in ipairs(routes) do + local color = "#bb3333" + + route.ETX = tonumber(route.ETX) + if route.ETX == 0 then + color = "#bb3333" + elseif route.ETX < 4 then + color = "#00cc00" + elseif route.ETX < 10 then + color = "#ffcb05" + elseif route.ETX < 100 then + color = "#ff6600" + end +%> + + + + + + + +<% end %> +
<%:destination Ziel%><%:gateway Gateway%><%:interface Schnittstelle%><%:metric Metrik%>ETX
<%=route.Destination%><%=route.Gateway%><%=route.Interface%><%=route.Metric%><%=route.ETX%>
+
+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/freifunk-olsr/topology.htm b/modules/freifunk/src/view/freifunk-olsr/topology.htm new file mode 100644 index 000000000..c622026d4 --- /dev/null +++ b/modules/freifunk/src/view/freifunk-olsr/topology.htm @@ -0,0 +1,23 @@ +<%+header%> +

<%:olsrtopo OLSR-Topologie%>

+
+ + + + + + + + +<% for k, route in ipairs(routes) do %> + + + + + + + +<% end %> +
<%:destination Ziel%><%:lasthop Letzter Router%>LQILQETX
"><%=route["Destination IP"]%>"><%=route["Last hop IP"]%><%=route.LQ%><%=route.ILQ%><%=route.ETX%>
+
+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/freifunk/contact.htm b/modules/freifunk/src/view/freifunk/contact.htm new file mode 100644 index 000000000..221dc89cc --- /dev/null +++ b/modules/freifunk/src/view/freifunk/contact.htm @@ -0,0 +1,13 @@ +<%+header%> +<% local contact = ffluci.model.uci.sections("freifunk").contact %> +

<%:contact Kontakt%>

+ + + + + + + + +
<%:nickname Pseudonym%>:<%=contact.nickname%>
<%:name Name%>:<%=contact.name%>
<%:mail E-Mail%>:<%=contact.mail%>
<%:phone Telefon%>:<%=contact.phone%>
<%:location Standort%>:<%=contact.location%>
<%:geocoord Geokoordinaten%>:<%=contact.geo%>
<%:note Notiz%>:<%=contact.note%>
+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/freifunk/index.htm b/modules/freifunk/src/view/freifunk/index.htm new file mode 100644 index 000000000..6c7fe8588 --- /dev/null +++ b/modules/freifunk/src/view/freifunk/index.htm @@ -0,0 +1,11 @@ +<%+header%> +<% local ff = ffluci.model.uci.sections("freifunk") %> +

<%:hellonet Hallo und willkommen im Netz von%> <%=ff.community.name%>!

+

<%:public1 Wir sind eine Initiative zur Schaffung eines freien, offenen und unabhängigen Funknetzwerks auf WLAN-Basis.%>
+<%:public2 Dies ist der Zugangspunkt %><%=ffluci.sys.hostname()%>. <%:public3 Er wird betrieben von %> +<%=ff.contact.nickname%>.

+

<%:public4 Weitere Informationen zur globalen Freifunkinitiative findest du unter%> Freifunk.net.
+<%:public5 Hast du Interesse an diesem Projekt, dann wende dich an deine lokale Gemeinschaft%> <%=ff.community.name%>.

+

<%:note Hinweis%>: <%:public6 Der Internetzugang über das experimentelle Freifunknetz ist an technische und organisatorische Bedingungen geknüpft und deshalb möglicherweise +nicht (immer) gewährleistet.%>

+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/freifunk/wizard.htm b/modules/freifunk/src/view/freifunk/wizard.htm new file mode 100644 index 000000000..b08703ffe --- /dev/null +++ b/modules/freifunk/src/view/freifunk/wizard.htm @@ -0,0 +1,58 @@ +<%+header%> +

<%:ffwizard Freifunkassistent%>

+

<%:ffwizard1 Dieser Assistent konfiguriert den Router für die Benutzung im Freifunknetz%>

+
+
+
+
+
<%:ip IP-Adresse%>:  +
+
+ <% for i, k in ipairs(ifaces) do %> +
+
<%:wificfg Drahtlosgerät einrichten%>: <%=k%>
+
+
+ <% end %> +
+
<%:cfgolsr OLSR konfigurieren%>
+
+
+
+
<%:cfgdhcp Drahtlos DHCP konfigurieren%>
+
+
+
+
<%:cfginternal Erlaube Zugriff von internem Netzwerk%>:
+
+
+
+
<%:cfgexternal Erlaube Zugriff auf externes Netzwerk%>:
+
+
+
+
<%:shareinet Internetzugang ankündigen%>
+
+
+
+
+
+ + +
+
+<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_index/contact.htm b/modules/freifunk/src/view/public_index/contact.htm deleted file mode 100644 index 221dc89cc..000000000 --- a/modules/freifunk/src/view/public_index/contact.htm +++ /dev/null @@ -1,13 +0,0 @@ -<%+header%> -<% local contact = ffluci.model.uci.sections("freifunk").contact %> -

<%:contact Kontakt%>

- - - - - - - - -
<%:nickname Pseudonym%>:<%=contact.nickname%>
<%:name Name%>:<%=contact.name%>
<%:mail E-Mail%>:<%=contact.mail%>
<%:phone Telefon%>:<%=contact.phone%>
<%:location Standort%>:<%=contact.location%>
<%:geocoord Geokoordinaten%>:<%=contact.geo%>
<%:note Notiz%>:<%=contact.note%>
-<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_index/index.htm b/modules/freifunk/src/view/public_index/index.htm deleted file mode 100644 index 6c7fe8588..000000000 --- a/modules/freifunk/src/view/public_index/index.htm +++ /dev/null @@ -1,11 +0,0 @@ -<%+header%> -<% local ff = ffluci.model.uci.sections("freifunk") %> -

<%:hellonet Hallo und willkommen im Netz von%> <%=ff.community.name%>!

-

<%:public1 Wir sind eine Initiative zur Schaffung eines freien, offenen und unabhängigen Funknetzwerks auf WLAN-Basis.%>
-<%:public2 Dies ist der Zugangspunkt %><%=ffluci.sys.hostname()%>. <%:public3 Er wird betrieben von %> -<%=ff.contact.nickname%>.

-

<%:public4 Weitere Informationen zur globalen Freifunkinitiative findest du unter%> Freifunk.net.
-<%:public5 Hast du Interesse an diesem Projekt, dann wende dich an deine lokale Gemeinschaft%> <%=ff.community.name%>.

-

<%:note Hinweis%>: <%:public6 Der Internetzugang über das experimentelle Freifunknetz ist an technische und organisatorische Bedingungen geknüpft und deshalb möglicherweise -nicht (immer) gewährleistet.%>

-<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_olsr/error_olsr.htm b/modules/freifunk/src/view/public_olsr/error_olsr.htm deleted file mode 100644 index 25426f50d..000000000 --- a/modules/freifunk/src/view/public_olsr/error_olsr.htm +++ /dev/null @@ -1,6 +0,0 @@ -<%+header%> -

<%:olsr OLSR%>

-

<%:olsrerror1 Es konnte keine Verbindung zum OLSR-Daemon hergestellt werden!%>

-

<%:olsrerror2 Um die Statusinformationen abfragen zu können muss der OLSR-Daemon gestartet -und das Plugin "txtinfo" geladen sein.%>

-<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_olsr/hna.htm b/modules/freifunk/src/view/public_olsr/hna.htm deleted file mode 100644 index c13369f42..000000000 --- a/modules/freifunk/src/view/public_olsr/hna.htm +++ /dev/null @@ -1,17 +0,0 @@ -<%+header%> -

<%:olsrhna OLSR-HNA%>

-
- - - - - -<% for k, route in ipairs(routes) do %> - - - - -<% end %> -
<%:destination Ziel%><%:gateway Gateway%>
<%=route.Network%>/<%=route.Netmask%><%=route.Gateway%>
-
-<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_olsr/index.htm b/modules/freifunk/src/view/public_olsr/index.htm deleted file mode 100644 index 0633d1f45..000000000 --- a/modules/freifunk/src/view/public_olsr/index.htm +++ /dev/null @@ -1,43 +0,0 @@ -<%+header%> -

<%:olsrlinks OLSR-Verbindungen%>

-

<%:olsrlinks1 Übersicht über aktuell bestehende OLSR-Verbindungen%>

-
- - - - - - - - -<% for k, link in ipairs(links) do - local color = "#bb3333" - - link.ETX = tonumber(link.ETX) - if link.ETX == 0 then - color = "#bb3333" - elseif link.ETX < 4 then - color = "#00cc00" - elseif link.ETX < 10 then - color = "#ffcb05" - elseif link.ETX < 100 then - color = "#ff6600" - end -%> - - - - - - - -<% end %> -
<%:destination Ziel%><%:local Lokal%>LQNLQETX
"><%=link["remote IP"]%><%=link["Local IP"]%><%=link.LinkQuality%><%=link.NLQ%><%=link.ETX%>
-
-

<%:legend Legende%>:

- -<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_olsr/mid.htm b/modules/freifunk/src/view/public_olsr/mid.htm deleted file mode 100644 index 6553237ea..000000000 --- a/modules/freifunk/src/view/public_olsr/mid.htm +++ /dev/null @@ -1,17 +0,0 @@ -<%+header%> -

<%:olsrmid OLSR-MID%>

-
- - - - - -<% for k, mid in ipairs(mids) do %> - - - - -<% end %> -
<%:node Knoten%><%:aliases Aliasse%>
<%=mid.IP%><%=mid.Aliases%>
-
-<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_olsr/routes.htm b/modules/freifunk/src/view/public_olsr/routes.htm deleted file mode 100644 index f3a0fd336..000000000 --- a/modules/freifunk/src/view/public_olsr/routes.htm +++ /dev/null @@ -1,36 +0,0 @@ -<%+header%> -

<%:olsrlinks OLSR-Routen%>

-
- - - - - - - - -<% for k, route in ipairs(routes) do - local color = "#bb3333" - - route.ETX = tonumber(route.ETX) - if route.ETX == 0 then - color = "#bb3333" - elseif route.ETX < 4 then - color = "#00cc00" - elseif route.ETX < 10 then - color = "#ffcb05" - elseif route.ETX < 100 then - color = "#ff6600" - end -%> - - - - - - - -<% end %> -
<%:destination Ziel%><%:gateway Gateway%><%:interface Schnittstelle%><%:metric Metrik%>ETX
<%=route.Destination%><%=route.Gateway%><%=route.Interface%><%=route.Metric%><%=route.ETX%>
-
-<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_olsr/topology.htm b/modules/freifunk/src/view/public_olsr/topology.htm deleted file mode 100644 index c622026d4..000000000 --- a/modules/freifunk/src/view/public_olsr/topology.htm +++ /dev/null @@ -1,23 +0,0 @@ -<%+header%> -

<%:olsrtopo OLSR-Topologie%>

-
- - - - - - - - -<% for k, route in ipairs(routes) do %> - - - - - - - -<% end %> -
<%:destination Ziel%><%:lasthop Letzter Router%>LQILQETX
"><%=route["Destination IP"]%>"><%=route["Last hop IP"]%><%=route.LQ%><%=route.ILQ%><%=route.ETX%>
-
-<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/public_status/index.htm b/modules/freifunk/src/view/public_status/index.htm index be0b96888..3ea120c1e 100644 --- a/modules/freifunk/src/view/public_status/index.htm +++ b/modules/freifunk/src/view/public_status/index.htm @@ -34,7 +34,25 @@ <%:signal Signal%> <%:noise Rausch%> -<%=ffluci.sys.httpget("http://127.0.0.1" .. controller .. "/sudo/status/iwconfig")%> +<%for k, v in pairs(ffluci.sys.wifi.getiwconfig()) do +%> + +<%=k%> +<%=v[1]%> +<%=v.Frequency%> +<%=v["Tx-Power"]%> +<%=v["Bit Rate"]%> +<%=v["RTS thr"]%> +<%=v["Fragment thr"]%> +<%=v["Link Quality"]%> +<%=v["Signal level"]%> +<%=v["Noise level"]%> + + +ESSID: <%=v.ESSID%> +BSSID: <%=(v.Cell or v["Access Point"])%> + +<%end%>

diff --git a/modules/freifunk/src/view/public_status/iwscan.htm b/modules/freifunk/src/view/public_status/iwscan.htm index a8924c892..c5acdb9ac 100644 --- a/modules/freifunk/src/view/public_status/iwscan.htm +++ b/modules/freifunk/src/view/public_status/iwscan.htm @@ -15,7 +15,24 @@ <%:signal Signal%> <%:noise Rausch%> -<%=ffluci.sys.httpget("http://127.0.0.1" .. controller .. "/sudo/status/iwscan")%> +<%for iface, cells in pairs(ffluci.sys.wifi.iwscan()) do + for i, cell in ipairs(cells) do +%> + +<%=iface%> +<%=cell.ESSID%> +<%=cell.Address%> +<%=cell.Mode%> +<%=(cell.Channel or cell.Frequency or "")%> +<%=cell["Encryption key"]%> +<%=cell.Quality%> +<%=cell["Signal level"]%> +<%=cell["Noise level"]%> + +<% + end +end +%>
<%+footer%> \ No newline at end of file diff --git a/modules/freifunk/src/view/sudo_status/iwconfig.htm b/modules/freifunk/src/view/sudo_status/iwconfig.htm deleted file mode 100644 index 6f5dede70..000000000 --- a/modules/freifunk/src/view/sudo_status/iwconfig.htm +++ /dev/null @@ -1,21 +0,0 @@ -<% -ffluci.http.prepare_content("text/plain") -for k, v in pairs(ffluci.sys.wifi.getiwconfig()) do -%> - -<%=k%> -<%=v[1]%> -<%=v.Frequency%> -<%=v["Tx-Power"]%> -<%=v["Bit Rate"]%> -<%=v["RTS thr"]%> -<%=v["Fragment thr"]%> -<%=v["Link Quality"]%> -<%=v["Signal level"]%> -<%=v["Noise level"]%> - - -ESSID: <%=v.ESSID%> -BSSID: <%=(v.Cell or v["Access Point"])%> - -<%end%> diff --git a/modules/freifunk/src/view/sudo_status/iwscan.htm b/modules/freifunk/src/view/sudo_status/iwscan.htm deleted file mode 100644 index 6f321ae9e..000000000 --- a/modules/freifunk/src/view/sudo_status/iwscan.htm +++ /dev/null @@ -1,22 +0,0 @@ -<% -ffluci.http.prepare_content("text/plain") -for iface, cells in pairs(ffluci.sys.wifi.iwscan()) do - for i, cell in ipairs(cells) do -%> - -<%=iface%> -<%=cell.ESSID%> -<%=cell.Address%> -<%=cell.Mode%> -<%=(cell.Channel or cell.Frequency or "")%> -<%=cell["Encryption key"]%> -<%=cell.Quality%> -<%=cell["Signal level"]%> -<%=cell["Noise level"]%> - -<% - end -end -%> - - -- cgit v1.2.3