From f11c311535ee26684308cff9132d405be66d7d39 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Sat, 19 Apr 2008 20:09:38 +0000 Subject: * Added public webif pages: --- module/public-core/src/controller/public/index.lua | 2 +- .../public-core/src/controller/public/status.lua | 22 +++++++ module/public-core/src/controller/sudo/status.lua | 1 + module/public-core/src/model/menu/00public.lua | 5 ++ .../public-core/src/view/public_index/contact.htm | 16 ++--- module/public-core/src/view/public_index/index.htm | 2 +- .../public-core/src/view/public_status/index.htm | 74 ++++++++++++++++++++++ .../src/view/public_status/internet.htm | 32 ++++++++++ .../public-core/src/view/public_status/iwscan.htm | 21 ++++++ .../public-core/src/view/public_status/routes.htm | 24 +++++++ module/public-core/src/view/sudo_status/iwscan.htm | 22 +++++++ 11 files changed, 211 insertions(+), 10 deletions(-) create mode 100644 module/public-core/src/controller/public/status.lua create mode 100644 module/public-core/src/controller/sudo/status.lua create mode 100644 module/public-core/src/view/public_status/index.htm create mode 100644 module/public-core/src/view/public_status/internet.htm create mode 100644 module/public-core/src/view/public_status/iwscan.htm create mode 100644 module/public-core/src/view/public_status/routes.htm create mode 100644 module/public-core/src/view/sudo_status/iwscan.htm (limited to 'module') diff --git a/module/public-core/src/controller/public/index.lua b/module/public-core/src/controller/public/index.lua index 4f8160a4c9..f65478c05f 100644 --- a/module/public-core/src/controller/public/index.lua +++ b/module/public-core/src/controller/public/index.lua @@ -1 +1 @@ -module(..., package.seeall) \ No newline at end of file +module("ffluci.controller.public.index", package.seeall) \ No newline at end of file diff --git a/module/public-core/src/controller/public/status.lua b/module/public-core/src/controller/public/status.lua new file mode 100644 index 0000000000..a786eb2d7e --- /dev/null +++ b/module/public-core/src/controller/public/status.lua @@ -0,0 +1,22 @@ +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 + r.Gateway = ffluci.sys.net.hexip4(r.Gateway) + table.insert(data.routes, r) + end + end + + + ffluci.template.render("public_status/index", data) +end + + diff --git a/module/public-core/src/controller/sudo/status.lua b/module/public-core/src/controller/sudo/status.lua new file mode 100644 index 0000000000..fd5127d2cf --- /dev/null +++ b/module/public-core/src/controller/sudo/status.lua @@ -0,0 +1 @@ +module("ffluci.controller.sudo.status", package.seeall) \ No newline at end of file diff --git a/module/public-core/src/model/menu/00public.lua b/module/public-core/src/model/menu/00public.lua index c488f43997..2e96a5b3c8 100644 --- a/module/public-core/src/model/menu/00public.lua +++ b/module/public-core/src/model/menu/00public.lua @@ -1,2 +1,7 @@ add("public", "index", "Übersicht", 10) act("contact", "Kontakt") + +add("public", "status", "Status", 20) +act("routes", "Routingtabelle") +act("internet", "Internetzugang") +act("iwscan", "WLAN-Scan") \ No newline at end of file diff --git a/module/public-core/src/view/public_index/contact.htm b/module/public-core/src/view/public_index/contact.htm index e5aee19065..d19df7e4c0 100644 --- a/module/public-core/src/view/public_index/contact.htm +++ b/module/public-core/src/view/public_index/contact.htm @@ -1,13 +1,13 @@ <%+header%> <% local contact = ffluci.model.uci.show("freifunk", "contact").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%>
+ + + + + + +
<%: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/module/public-core/src/view/public_index/index.htm b/module/public-core/src/view/public_index/index.htm index 838bf02ee0..a8a469ec31 100644 --- a/module/public-core/src/view/public_index/index.htm +++ b/module/public-core/src/view/public_index/index.htm @@ -6,6 +6,6 @@ <%=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 +

<%: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/module/public-core/src/view/public_status/index.htm b/module/public-core/src/view/public_status/index.htm new file mode 100644 index 0000000000..d81125de25 --- /dev/null +++ b/module/public-core/src/view/public_status/index.htm @@ -0,0 +1,74 @@ +<%+header%> +

<%:status Status%>

+

<%:system System%>

+ +
+ + + + + + + + + + + + + +
<%:system_type Systemtyp%>:<%=s%>
<%:cpu Prozessor%>:<%=m%>
<%:ram Hauptspeicher%>:<%=r%>
+

+ +

<%:wifi Drahtlos%>

+
+ + + + + + + + + + + + + +<%for k, v in pairs(wifi) do%> + + + + + + + + + + + + + + + + +<%end%> +
<%:name Name%><%:protocol Protokoll%><%:frequency Frequenz%><%:power Leistung%><%:bitrate Bitrate%><%:rts RTS%><%:frag Frag.%><%:link Verb.%><%:signal Signal%><%:noise Rausch%>
<%=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 ESSID%>: <%=v.ESSID%><%:bssid BSSID%>: <%=(v.Cell or v["Access Point"])%>
+
+
+

<%:defroutes Standardrouten%>

+
+ + + + + + +<% for i, rt in pairs(routes) do%> + + +<% end %> +
<%:gateway Gateway%><%:metric Metrik%><%:iface Schnittstelle%>
<%=rt.Gateway%> +<%=rt.Metric%> +<%=rt.Iface%> +
+<%+footer%> \ No newline at end of file diff --git a/module/public-core/src/view/public_status/internet.htm b/module/public-core/src/view/public_status/internet.htm new file mode 100644 index 0000000000..afa8fbf235 --- /dev/null +++ b/module/public-core/src/view/public_status/internet.htm @@ -0,0 +1,32 @@ +<%+header%> +

<%:inetaccess Internetzugangstest%>

+
+ + + + + + + +<% +local tests = {} +tests[1] = {descr = "Chaos Computer Club Deutschland", target = "213.73.91.29"} +tests[2] = {descr = "Kernel.org - Mirror Niederlande", target = "199.6.1.164"} +tests[3] = {descr = "Debian.org - Mirror Deutschland", target = "www.de.debian.org"} +tests[4] = {descr = "Wikimedia Deutschland", target = "www.wikimedia.de"} + +for i, t in ipairs(tests) do +%> + + + +<% if ffluci.sys.net.pingtest(t.target) == 0 then %> + +<% else %> + +<% end %> + +<% end %> +
<%:target Ziel%><%:host Host%><%:result Ergebnis%>
<%=t.descr%><%=t.target%><%:ok OK%><%:failed fehlgeschlagen%>
+
+<%+footer%> \ No newline at end of file diff --git a/module/public-core/src/view/public_status/iwscan.htm b/module/public-core/src/view/public_status/iwscan.htm new file mode 100644 index 0000000000..a8924c8925 --- /dev/null +++ b/module/public-core/src/view/public_status/iwscan.htm @@ -0,0 +1,21 @@ +<%+header%> +

<%:iwscan WLAN-Scan%>

+

<%:iwscan1 Drahtlosnetzwerke in der lokalen Umgebung des Routers:%>

+ +
+ + + + + + + + + + + + +<%=ffluci.sys.httpget("http://127.0.0.1" .. controller .. "/sudo/status/iwscan")%> +
<%:interface Schnittstelle%><%:essid ESSID%><%:bssid BSSID%><%:mode Modus%><%:channel Kanal%><%:encr Vers.%><%:link Verb.%><%:signal Signal%><%:noise Rausch%>
+
+<%+footer%> \ No newline at end of file diff --git a/module/public-core/src/view/public_status/routes.htm b/module/public-core/src/view/public_status/routes.htm new file mode 100644 index 0000000000..046c789f91 --- /dev/null +++ b/module/public-core/src/view/public_status/routes.htm @@ -0,0 +1,24 @@ +<%+header%> +

<%:routes Routen%>

+ +
+ + + + + + + + +<% for i, r in pairs(ffluci.sys.net.routes()) do %> + + + + + + + +<% end %> +
<%:target Ziel%><%:netmask Netzmaske%><%:gateway Gateway%><%:metric Metrik%><%:iface Schnittstelle%>
<%=ffluci.sys.net.hexip4(r.Destination)%><%=ffluci.sys.net.hexip4(r.Mask)%><%=ffluci.sys.net.hexip4(r.Gateway)%><%=r.Metric%><%=r.Iface%>
+
+<%+footer%> \ No newline at end of file diff --git a/module/public-core/src/view/sudo_status/iwscan.htm b/module/public-core/src/view/sudo_status/iwscan.htm new file mode 100644 index 0000000000..483039f4ee --- /dev/null +++ b/module/public-core/src/view/sudo_status/iwscan.htm @@ -0,0 +1,22 @@ +<% +ffluci.http.textheader() +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%> +<%=cell["Encryption key"]%> +<%=cell.Quality%> +<%=cell["Signal level"]%> +<%=cell["Noise level"]%> + +<% + end +end +%> + + -- cgit v1.2.3