Freufunk: I CAN HAZ ZEROES PLZKTHX
[project/luci.git] / modules / freifunk / luasrc / controller / freifunk / freifunk.lua
index 847083b..6c8911b 100644 (file)
@@ -41,16 +41,18 @@ function index()
        page.target = template("freifunk/contact")
        page.title  = "Kontakt"
 
+       entry({"freifunk", "status"}, alias("freifunk", "status", "status"), "Status", 20)
 
-       local page  = node("freifunk", "status")
+       local page  = node("freifunk", "status", "status")
        page.target = form("freifunk/public_status")
-       page.title  = "Status"
+       page.title  = i18n("overview")
        page.order  = 20
        page.i18n   = "admin-core"
        page.setuser  = false
        page.setgroup = false
 
        entry({"freifunk", "status.json"}, call("jsonstatus"))
+       entry({"freifunk", "status", "zeroes"}, call("zeroes"), "Testdownload") 
 
        assign({"freifunk", "olsr"}, {"admin", "status", "olsr"}, "OLSR", 30)
 
@@ -120,6 +122,21 @@ local function fetch_olsrd()
        return data
 end
 
+function zeroes()
+       local string = require "string"
+       local http = require "luci.http"
+       local zeroes = string.rep(string.char(0), 8192)
+       local cnt = 0
+       local lim = 1024 * 1024 * 1024
+       
+       http.prepare_content("application/x-many-zeroes")
+
+       while cnt < lim do
+               http.write(zeroes)
+               cnt = cnt + #zeroes
+       end
+end
+
 function jsonstatus()
        local root = {}
        local sys = require "luci.sys"
@@ -128,6 +145,7 @@ function jsonstatus()
        local http = require "luci.http"
        local json = require "luci.json"
        local ltn12 = require "luci.ltn12"
+       local version = require "luci.version"
        local webadmin = require "luci.tools.webadmin"
 
        local cursor = uci.cursor_state()
@@ -146,7 +164,12 @@ function jsonstatus()
                hostname = sys.hostname()
        }
 
-       root.brand = cursor:get_all("luci", "brand")
+       root.firmware = {
+               luciname=version.luciname,
+               luciversion=version.luciversion,
+               distname=version.distname,
+               distversion=version.distversion
+       }
 
        root.freifunk = {}
        cursor:foreach("freifunk", "public", function(s)