diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2014-06-11 12:37:19 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2014-06-11 12:37:19 +0000 |
commit | 91b97bc9f625d09431dc1c753209a037d7c42fbc (patch) | |
tree | 428230e6d8f0d7ac47dcccebabccd09667d58ea5 /modules | |
parent | 2d05a6135a0d29a82148f9bfc215b2de5b609dd5 (diff) |
Remove unmaintained components: lucid, fastindex, niu
Diffstat (limited to 'modules')
52 files changed, 0 insertions, 3073 deletions
diff --git a/modules/niu/COPYING.icons b/modules/niu/COPYING.icons deleted file mode 100644 index c87ac56a2..000000000 --- a/modules/niu/COPYING.icons +++ /dev/null @@ -1,48 +0,0 @@ -The Oxygen Icon Theme - Copyright (C) 2007 David Vignoni <david@icon-king.com> - Copyright (C) 2007 Johann Ollivier Lapeyre <johann@oxygen-icons.org> - Copyright (C) 2007 Kenneth Wimer <kwwii@bootsplash.org> - Copyright (C) 2007 Nuno Fernades Pinheiro <nf.pinheiro@gmail.com> - Copyright (C) 2007 Riccardo Iaconelli <riccardo@oxygen-icons.org> - Copyright (C) 2007 David Miller <miller@oxygen-icons.org> - -and others - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library. If not, see <http://www.gnu.org/licenses/>. - -Clarification: - - The GNU Lesser General Public License or LGPL is written for - software libraries in the first place. We expressly want the LGPL to - be valid for this artwork library too. - - KDE Oxygen theme icons is a special kind of software library, it is an - artwork library, it's elements can be used in a Graphical User Interface, or - GUI. - - Source code, for this library means: - - where they exist, SVG; - - otherwise, if applicable, the multi-layered formats xcf or psd, or - otherwise png. - - The LGPL in some sections obliges you to make the files carry - notices. With images this is in some cases impossible or hardly useful. - - With this library a notice is placed at a prominent place in the directory - containing the elements. You may follow this practice. - - The exception in section 5 of the GNU Lesser General Public License covers - the use of elements of this art library in a GUI. - - kde-artists [at] kde.org diff --git a/modules/niu/Makefile b/modules/niu/Makefile deleted file mode 100644 index 81a96f6a8..000000000 --- a/modules/niu/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file diff --git a/modules/niu/htdocs/luci-static/resources/icons32/folder.png b/modules/niu/htdocs/luci-static/resources/icons32/folder.png Binary files differdeleted file mode 100644 index 6919f984f..000000000 --- a/modules/niu/htdocs/luci-static/resources/icons32/folder.png +++ /dev/null diff --git a/modules/niu/htdocs/luci-static/resources/icons32/network-wireless.png b/modules/niu/htdocs/luci-static/resources/icons32/network-wireless.png Binary files differdeleted file mode 100644 index 94e754615..000000000 --- a/modules/niu/htdocs/luci-static/resources/icons32/network-wireless.png +++ /dev/null diff --git a/modules/niu/htdocs/luci-static/resources/icons32/network-workgroup.png b/modules/niu/htdocs/luci-static/resources/icons32/network-workgroup.png Binary files differdeleted file mode 100644 index 860ffb95e..000000000 --- a/modules/niu/htdocs/luci-static/resources/icons32/network-workgroup.png +++ /dev/null diff --git a/modules/niu/htdocs/luci-static/resources/icons32/preferences-system-network.png b/modules/niu/htdocs/luci-static/resources/icons32/preferences-system-network.png Binary files differdeleted file mode 100644 index 0e16fd703..000000000 --- a/modules/niu/htdocs/luci-static/resources/icons32/preferences-system-network.png +++ /dev/null diff --git a/modules/niu/htdocs/luci-static/resources/icons32/preferences-system.png b/modules/niu/htdocs/luci-static/resources/icons32/preferences-system.png Binary files differdeleted file mode 100644 index 2afbd23cc..000000000 --- a/modules/niu/htdocs/luci-static/resources/icons32/preferences-system.png +++ /dev/null diff --git a/modules/niu/htdocs/luci-static/resources/niu.css b/modules/niu/htdocs/luci-static/resources/niu.css deleted file mode 100644 index 6f895c957..000000000 --- a/modules/niu/htdocs/luci-static/resources/niu.css +++ /dev/null @@ -1,26 +0,0 @@ -fieldset.dbbox { - float: left; - margin: 1em; - padding: 0.5em; - background: #eeeeee; - border: 1px solid #cccccc; - border-radius: 5px; - -khtml-border-radius: 5px; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - -o-border-radius: 5px; -} - -fieldset.dbbox h2 { - background: url(icons32/folder.png) no-repeat right; - min-height: 24px; -} - -table.dbstattbl { - text-align: left; - width: 100%; -} - -table.dbstattbl th { - margin-right: 0.5em; -}
\ No newline at end of file diff --git a/modules/niu/luasrc/controller/niu/dashboard.lua b/modules/niu/luasrc/controller/niu/dashboard.lua deleted file mode 100644 index 757024df0..000000000 --- a/modules/niu/luasrc/controller/niu/dashboard.lua +++ /dev/null @@ -1,42 +0,0 @@ ---[[ -LuCI - Lua Development Framework - -Copyright 2009 Steven Barth <steven@midlink.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -local req = require -module "luci.controller.niu.dashboard" - -function index() - local uci = require "luci.model.uci" - - local root = node() - if not root.lock then - root.target = alias("niu") - root.index = true - end - - entry({"niu"}, alias("niu", "dashboard"), "NIU", 10) - entry({"niu", "dashboard"}, call("dashboard"), "Dashboard", 1).css = - "niu.css" -end - -local require = req - -function dashboard() - local dsp = require "luci.dispatcher" - local tpl = require "luci.template" - local utl = require "luci.util" - local uci = require "luci.model.uci" - - local nds = dsp.node("niu").nodes - tpl.render("niu/dashboard", {utl = utl, nodes = nds, dsp = dsp, tpl = tpl}) -end diff --git a/modules/niu/luasrc/controller/niu/network.lua b/modules/niu/luasrc/controller/niu/network.lua deleted file mode 100644 index 78a45a605..000000000 --- a/modules/niu/luasrc/controller/niu/network.lua +++ /dev/null @@ -1,42 +0,0 @@ ---[[ -LuCI - Lua Development Framework - -Copyright 2009 Steven Barth <steven@midlink.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -module "luci.controller.niu.network" - -function index() - local toniu = {on_success_to={"niu"}} - - local e = entry({"niu", "network"}, alias("niu"), "Network", 10) - e.niu_dbtemplate = "niu/network" - e.niu_dbtasks = true - e.niu_dbicon = "icons32/network-workgroup.png" - - entry({"niu", "network", "wan"}, - cbi("niu/network/wan", toniu), "Configure Internet Connection", 1) - - entry({"niu", "network", "lan"}, - cbi("niu/network/lan", toniu), "Configure Local Network", 2) - - uci.inst_state:foreach("dhcp", "dhcp", function(s) - if s.interface == "lan" and s.ignore ~= "1" then - entry({"niu", "network", "assign"}, cbi("niu/network/assign", - toniu), "Manage Address Assignment", 30) - end - end) - - if fs.access("/etc/config/ddns") then - entry({"niu", "network", "ddns"}, cbi("niu/network/ddns", toniu), - "Configure Dynamic-DNS names", 60) - end -end diff --git a/modules/niu/luasrc/controller/niu/system.lua b/modules/niu/luasrc/controller/niu/system.lua deleted file mode 100644 index 127a311c5..000000000 --- a/modules/niu/luasrc/controller/niu/system.lua +++ /dev/null @@ -1,265 +0,0 @@ ---[[ -LuCI - Lua Development Framework - -Copyright 2009 Steven Barth <steven@midlink.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -local require, pairs, unpack, tonumber = require, pairs, unpack, tonumber -module "luci.controller.niu.system" - -function index() - local toniu = {on_success_to={"niu"}} - - local e = entry({"niu", "system"}, alias("niu"), "System", 40) - e.niu_dbtemplate = "niu/system" - e.niu_dbtasks = true - e.niu_dbicon = "icons32/preferences-system.png" - - entry({"niu", "system", "general"}, - cbi("niu/system/general", toniu), "Configure Device", 1) - - entry({"niu", "system", "backup"}, call("backup"), "Backup or Restore Settings", 2) - entry({"niu", "system", "upgrade"}, call("upgrade"), "Upgrade Firmware", 30) -end - -function backup() - local dsp = require "luci.dispatcher" - local os, io = require "os", require "io" - local uci = require "luci.model.uci".inst - local nixio, nutl = require "nixio", require "nixio.util" - local fs = require "nixio.fs" - local http = require "luci.http" - local tpl = require "luci.template" - - local restore_fpi - http.setfilehandler( - function(meta, chunk, eof) - if not restore_fpi then - restore_fpi = io.popen("tar -xzC/ >/dev/null 2>&1", "w") - end - if chunk then - restore_fpi:write(chunk) - end - if eof then - restore_fpi:close() - end - end - ) - - local reset_avail = (fs.readfile("/proc/mtd") or ""):find('"rootfs_data"') - local upload = http.formvalue("archive") - local backup = http.formvalue("backup") - local reset = reset_avail and http.formvalue("reset") - local backup_cmd = "tar -cz %s 2>/dev/null" - - if http.formvalue("cancel") then - return http.redirect(dsp.build_url("niu")) - end - - if backup then - local call = {"/bin/tar", "-cz"} - for k, v in pairs(uci:get_all("luci", "flash_keep")) do - if k:byte() ~= 46 then -- k[1] ~= "." - nutl.consume(fs.glob(v), call) - end - end - - - http.header( - 'Content-Disposition', 'attachment; filename="backup-%s-%s.tar.gz"' % { - nixio.uname().nodename, os.date("%Y-%m-%d") - } - ) - http.prepare_content("application/x-targz") - - - local fdin, fdout = nixio.pipe() - local devnull = nixio.open("/dev/null", "r+") - local proc = nixio.fork() - - if proc == 0 then - fdin:close() - nixio.dup(devnull, nixio.stdin) - nixio.dup(devnull, nixio.stderr) - nixio.dup(fdout, nixio.stdout) - nixio.exec(unpack(call)) - os.exit(1) - end - - fdout:close() - http.splice(fdin) - http.close() - elseif (upload and #upload > 0) or reset then - tpl.render("niu/system/reboot") - if nixio.fork() == 0 then - nixio.nanosleep(1) - if reset then - nixio.execp("mtd", "-r", "erase", "rootfs_data") - else - nixio.execp("reboot") - end - os.exit(1) - end - else - tpl.render("niu/system/backup", {reset_avail = reset_avail}) - end -end - -function upgrade() - local io, os, table = require "io", require "os", require "table" - local uci = require "luci.store".uci_state - local http = require "luci.http" - local util = require "luci.util" - local tpl = require "luci.template" - local nixio = require "nixio", require "nixio.util", require "nixio.fs" - - - local tmpfile = "/tmp/firmware.img" - - local function image_supported() - -- XXX: yay... - return ( 0 == os.execute( - ". /lib/functions.sh; " .. - "include /lib/upgrade; " .. - "platform_check_image %q >/dev/null" - % tmpfile - ) ) - end - - local function image_checksum() - return (util.exec("md5sum %q" % tmpfile):match("^([^%s]+)")) - end - - local function storage_size() - local size = 0 - if nixio.fs.access("/proc/mtd") then - for l in io.lines("/proc/mtd") do - local d, s, e, n = l:match('^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+"([^%s]+)"') - if n == "linux" then - size = tonumber(s, 16) - break - end - end - elseif nixio.fs.access("/proc/partitions") then - for l in io.lines("/proc/partitions") do - local x, y, b, n = l:match('^%s*(%d+)%s+(%d+)%s+([^%s]+)%s+([^%s]+)') - if b and n and not n:match('[0-9]') then - size = tonumber(b) * 1024 - break - end - end - end - return size - end - - - -- Install upload handler - local file - http.setfilehandler( - function(meta, chunk, eof) - if not nixio.fs.access(tmpfile) and not file and chunk and #chunk > 0 then - file = io.open(tmpfile, "w") - end - if file and chunk then - file:write(chunk) - end - if file and eof then - file:close() - end - end - ) - - - -- Determine state - local keep_avail = true - local step = tonumber(http.formvalue("step") or 1) - local has_image = nixio.fs.access(tmpfile) - local has_support = image_supported() - local has_platform = nixio.fs.access("/lib/upgrade/platform.sh") - local has_upload = http.formvalue("image") - - -- This does the actual flashing which is invoked inside an iframe - -- so don't produce meaningful errors here because the the - -- previous pages should arrange the stuff as required. - if step == 4 then - if has_platform and has_image and has_support then - -- Mimetype text/plain - http.prepare_content("text/plain") - - local call = {} - for k, v in pairs(uci:get_all("luci", "flash_keep")) do - if k:byte() ~= 46 then -- k[1] ~= "." - nixio.util.consume(nixio.fs.glob(v), call) - end - end - - -- Now invoke sysupgrade - local keepcfg = keep_avail and http.formvalue("keepcfg") == "1" - local fd = io.popen("/sbin/luci-flash %s %q" %{ - keepcfg and "-k %q" % table.concat(call, " ") or "", tmpfile - }) - - if fd then - while true do - local ln = fd:read("*l") - if not ln then break end - http.write(ln .. "\n") - end - fd:close() - end - - -- Make sure the device is rebooted - if nixio.fork() == 0 then - nixio.nanosleep(1) - nixio.execp("reboot") - os.exit(1) - end - end - - - -- - -- This is step 1-3, which does the user interaction and - -- image upload. - -- - - -- Step 1: file upload, error on unsupported image format - elseif not has_image or not has_support or step == 1 then - -- If there is an image but user has requested step 1 - -- or type is not supported, then remove it. - if has_image then - nixio.fs.unlink(tmpfile) - end - - tpl.render("niu/system/upgrade", { - step=1, - bad_image=(has_image and not has_support or false), - keepavail=keep_avail, - supported=has_platform - } ) - - -- Step 2: present uploaded file, show checksum, confirmation - elseif step == 2 then - tpl.render("niu/system/upgrade", { - step=2, - checksum=image_checksum(), - filesize=nixio.fs.stat(tmpfile).size, - flashsize=storage_size(), - keepconfig=(keep_avail and http.formvalue("keepcfg") == "1") - } ) - - -- Step 3: load iframe which calls the actual flash procedure - elseif step == 3 then - tpl.render("niu/system/upgrade", { - step=3, - keepconfig=(keep_avail and http.formvalue("keepcfg") == "1") - } ) - end -end diff --git a/modules/niu/luasrc/controller/niu/traffic.lua b/modules/niu/luasrc/controller/niu/traffic.lua deleted file mode 100644 index ffc8d9ade..000000000 --- a/modules/niu/luasrc/controller/niu/traffic.lua +++ /dev/null @@ -1,45 +0,0 @@ ---[[ -LuCI - Lua Development Framework - -Copyright 2009 Steven Barth <steven@midlink.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -local require = require -module "luci.controller.niu.traffic" - -function index() - local toniu = {on_success_to={"niu"}} - - local e = entry({"niu", "traffic"}, alias("niu"), "Network Traffic", 30) - e.niu_dbtemplate = "niu/traffic" - e.niu_dbtasks = true - e.niu_dbicon = "icons32/preferences-system-network.png" - - if fs.access("/etc/config/firewall") then - entry({"niu", "traffic", "portfw"}, cbi("niu/traffic/portfw", - toniu), "Manage Port Forwarding", 1) - end - - if fs.access("/etc/config/qos") then - entry({"niu", "traffic", "qos"}, cbi("niu/traffic/qos", - toniu), "Manage Prioritization (QoS)", 2) - end - - entry({"niu", "traffic", "routes"}, cbi("niu/traffic/routes", - toniu), "Manage Traffic Routing", 30) - - entry({"niu", "traffic", "conntrack"}, call("cnntrck"), - "Display Local Network Activity", 50) -end - -function cnntrck() - require "luci.template".render("niu/traffic/conntrack") -end diff --git a/modules/niu/luasrc/controller/niu/wireless.lua b/modules/niu/luasrc/controller/niu/wireless.lua deleted file mode 100644 index 92ebffdfc..000000000 --- a/modules/niu/luasrc/controller/niu/wireless.lua +++ /dev/null @@ -1,40 +0,0 @@ ---[[ -LuCI - Lua Development Framework - -Copyright 2009 Steven Barth <steven@midlink.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -module "luci.controller.niu.wireless" - -function index() - if not fs.access("/etc/config/wireless") then - return - end - - local toniu = {on_success_to={"niu"}} - - local e = entry({"niu", "wireless"}, alias("niu"), _("Wireless"), 20) - --e.niu_dbtemplate = "niu/wireless" - e.niu_dbtasks = true - e.niu_dbicon = "icons32/network-wireless.png" - - entry({"niu", "wireless", "ap"}, - cbi("niu/wireless/ap", toniu), _("Configure Private Access Point"), 1) - - local bridge = false - uci.inst:foreach("wireless", "wifi-device", function(s) - if not bridge and (s.type == "mac80211" or s.type == "atheros") then - entry({"niu", "wireless", "bridge"}, - cbi("niu/wireless/bridge", toniu), _("Join a local WDS network"), 2) - bridge = true - end - end) -end diff --git a/modules/niu/luasrc/model/cbi/niu/network/assign.lua b/modules/niu/luasrc/model/cbi/niu/network/assign.lua deleted file mode 100644 index b61e4f400..000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/assign.lua +++ /dev/null @@ -1,17 +0,0 @@ -local cursor = require "luci.model.uci".cursor() -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("assign1", load("niu/network/assign1")) - -function d.on_cancel() - cursor:revert("dhcp") -end - -function d.on_done() - cursor:commit("dhcp") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/network/assign1.lua b/modules/niu/luasrc/model/cbi/niu/network/assign1.lua deleted file mode 100644 index 0fee331e1..000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/assign1.lua +++ /dev/null @@ -1,96 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -local uci = require "luci.model.uci".cursor() -local sys = require "luci.sys" -local fs = require "nixio.fs" - - -local function date_format(secs) - local suff = {"min", "h", "d"} - local mins = 0 - local hour = 0 - local days = 0 - - secs = math.floor(secs) - if secs > 60 then - mins = math.floor(secs / 60) - secs = secs % 60 - end - - if mins > 60 then - hour = math.floor(mins / 60) - mins = mins % 60 - end - - if hour > 24 then - days = math.floor(hour / 24) - hour = hour % 24 - end - - if days > 0 then - return string.format("%.0fd %02.0fh %02.0fmin %02.0fs", days, hour, mins, secs) - else - return string.format("%02.0fh %02.0fmin %02.0fs", hour, mins, secs) - end -end - -m2 = Map("dhcp", "Manage Address Assignment") - -local leasefn, leasefp, leases -uci:foreach("dhcp", "dnsmasq", - function(section) - leasefn = section.leasefile - end -) -local leasefp = leasefn and fs.access(leasefn) and io.lines(leasefn) -if leasefp then - leases = {} - for lease in leasefp do - table.insert(leases, luci.util.split(lease, " ")) - end -end - -if leases then - v = m2:section(Table, leases, translate("Active Leases")) - ip = v:option(DummyValue, 3, translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address")) - - mac = v:option(DummyValue, 2, translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address")) - - ltime = v:option(DummyValue, 1, translate("Leasetime remaining")) - function ltime.cfgvalue(self, ...) - local value = DummyValue.cfgvalue(self, ...) - return date_format(os.difftime(tonumber(value), os.time())) - end -end - -s = m2:section(TypedSection, "host", "Static Assignment", -"You can assign fixed addresses and DNS names to devices in you local network to make reaching them more easy.") -s.addremove = true -s.anonymous = true -s.template = "cbi/tblsection" - -hn = s:option(Value, "name", translate("Hostname")) -mac = s:option(Value, "mac", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address")) -ip = s:option(Value, "ip", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address")) -sys.net.arptable(function(entry) - ip:value(entry["IP address"]) - mac:value( - entry["HW address"], - entry["HW address"] .. " (" .. entry["IP address"] .. ")" - ) -end) - - -return m2 diff --git a/modules/niu/luasrc/model/cbi/niu/network/ddns.lua b/modules/niu/luasrc/model/cbi/niu/network/ddns.lua deleted file mode 100644 index 0ee821a23..000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/ddns.lua +++ /dev/null @@ -1,18 +0,0 @@ -local uci = require "luci.model.uci" -local cursor = uci.cursor() -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("ddns1", load("niu/network/ddns1")) - -function d.on_cancel() - cursor:revert("ddns") -end - -function d.on_done() - cursor:commit("ddns") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/network/ddns1.lua b/modules/niu/luasrc/model/cbi/niu/network/ddns1.lua deleted file mode 100644 index c0873bb2f..000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/ddns1.lua +++ /dev/null @@ -1,71 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- -local nxo = require "nixio" - -m = Map("ddns", translate("Dynamic DNS"), translate("Dynamic DNS allows that this device can be reached with a fixed hostname while having a dynamically changing IP-Address.")) - -s = m:section(TypedSection, "service", "") -s:depends("enabled", "1") -s.addremove = true - -s.defaults.enabled = "1" -s.defaults.ip_network = "wan" -s.defaults.ip_url = "http://checkip.dyndns.org http://www.whatismyip.com/automation/n09230945.asp" - - -s:tab("general", translate("General Settings")) - -svc = s:taboption("general", ListValue, "service_name", translate("Service")) -svc:value("dyndns.org") -svc:value("no-ip.com") -svc:value("changeip.com") -svc:value("zoneedit.com") - - -s:taboption("general", Value, "username", translate("Username")) -pw = s:taboption("general", Value, "password", translate("Password")) -pw.password = true -local dom = s:taboption("general", Value, "domain", translate("Hostname")) - -local current = s:taboption("general", DummyValue, "_current", "Current IP-Address") - -function current.render(self, section, ...) - if dom:cfgvalue(section) then - return DummyValue.render(self, section, ...) - end -end - -function current.value(self, section) - local dns = nxo.getaddrinfo(dom:cfgvalue(section)) - if dns then - for _, v in ipairs(dns) do - if v.family == "inet" then - return v.address - end - end - end - return "" -end - -s:tab("expert", translate("Expert Settings")) - -local src = s:taboption("expert", ListValue, "ip_source", "External IP Determination") -src.default = "web" -src:value("web", "CheckIP / WhatIsMyIP webservice") -src:value("network", "External Address as seen locally") - - - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/network/etherwan.lua b/modules/niu/luasrc/model/cbi/niu/network/etherwan.lua deleted file mode 100644 index 56350b3ff..000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/etherwan.lua +++ /dev/null @@ -1,161 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> -Copyright 2009 Jo-Philipp Wich <xm@subsignal.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -local fs = require "nixio.fs" - -local has_ipv6 = fs.access("/proc/net/ipv6_route") -local has_pptp = fs.access("/usr/sbin/pptp") -local has_pppd = fs.access("/usr/sbin/pppd") -local has_pppoe = fs.glob("/usr/lib/pppd/*/rp-pppoe.so")() -local has_pppoa = fs.glob("/usr/lib/pppd/*/pppoatm.so")() - - -m = Map("network", "Configure Ethernet Adapter for Internet Connection") - -s = m:section(NamedSection, "wan", "interface") -s.addremove = false - -s:tab("general", translate("General Settings")) -s:tab("expert", translate("Expert Settings")) - -p = s:taboption("general", ListValue, "proto", translate("Connection Protocol")) -p.override_scheme = true -p.default = "dhcp" -p:value("dhcp", translate("Cable / Ethernet / DHCP")) -if has_pppoe then p:value("pppoe", "DSL / PPPoE") end -if has_pppoa then p:value("pppoa", "PPPoA") end -if has_pptp then p:value("pptp", "PPTP") end -p:value("static", translate("Static Ethernet")) - - - -ipaddr = s:taboption("general", Value, "ipaddr", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address")) -ipaddr.rmempty = true -ipaddr:depends("proto", "static") - -nm = s:taboption("general", Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask")) -nm.rmempty = true -nm:depends("proto", "static") -nm:value("255.255.255.0") -nm:value("255.255.0.0") -nm:value("255.0.0.0") - -gw = s:taboption("general", Value, "gateway", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Gateway")) -gw:depends("proto", "static") -gw.rmempty = true - -bcast = s:taboption("expert", Value, "bcast", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Broadcast")) -bcast:depends("proto", "static") - -if has_ipv6 then - ip6addr = s:taboption("expert", Value, "ip6addr", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Address"), translate("<abbr title=\"Classless Inter-Domain Routing\">CIDR</abbr>-Notation: address/prefix")) - ip6addr:depends("proto", "static") - - ip6gw = s:taboption("expert", Value, "ip6gw", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Gateway")) - ip6gw:depends("proto", "static") -end - -dns = s:taboption("expert", Value, "dns", translate("<abbr title=\"Domain Name System\">DNS</abbr>-Server")) -dns:depends("peerdns", "") - -mtu = s:taboption("expert", Value, "mtu", "MTU") -mtu.isinteger = true - -mac = s:taboption("expert", Value, "macaddr", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address")) - - -srv = s:taboption("general", Value, "server", translate("<abbr title=\"Point-to-Point Tunneling Protocol\">PPTP</abbr>-Server")) -srv:depends("proto", "pptp") -srv.rmempty = true - -if has_pppd or has_pppoe or has_pppoa or has_pptp then - user = s:taboption("general", Value, "username", translate("Username")) - user.rmempty = true - user:depends("proto", "pptp") - user:depends("proto", "pppoe") - user:depends("proto", "pppoa") - - pass = s:taboption("general", Value, "password", translate("Password")) - pass.rmempty = true - pass.password = true - pass:depends("proto", "pptp") - pass:depends("proto", "pppoe") - pass:depends("proto", "pppoa") - - ka = s:taboption("expert", Value, "keepalive", - translate("Keep-Alive"), - translate("Number of failed connection tests to initiate automatic reconnect") - ) - ka.default = "5" - ka:depends("proto", "pptp") - ka:depends("proto", "pppoe") - ka:depends("proto", "pppoa") - - demand = s:taboption("expert", Value, "demand", - translate("Automatic Disconnect"), - translate("Time (in seconds) after which an unused connection will be closed") - ) - demand:depends("proto", "pptp") - demand:depends("proto", "pppoe") - demand:depends("proto", "pppoa") -end - -if has_pppoa then - encaps = s:taboption("expert", ListValue, "encaps", translate("PPPoA Encapsulation")) - encaps:depends("proto", "pppoa") - encaps:value("", translate("-- Please choose --")) - encaps:value("vc", "VC") - encaps:value("llc", "LLC") - - vpi = s:taboption("expert", Value, "vpi", "VPI") - vpi:depends("proto", "pppoa") - - vci = s:taboption("expert", Value, "vci", "VCI") - vci:depends("proto", "pppoa") -end - -if has_pptp or has_pppd or has_pppoe or has_pppoa or has_3g then ---[[ - defaultroute = s:taboption("expert", Flag, "defaultroute", - translate("Replace default route"), - translate("Let pppd replace the current default route to use the PPP interface after successful connect") - ) - defaultroute:depends("proto", "pppoa") - defaultroute:depends("proto", "pppoe") - defaultroute:depends("proto", "pptp") - defaultroute.rmempty = false - function defaultroute.cfgvalue(...) - return ( AbstractValue.cfgvalue(...) or '1' ) - end -]] - peerdns = s:taboption("expert", Flag, "peerdns", - translate("Use peer DNS"), - translate("Configure the local DNS server to use the name servers adverticed by the PPP peer") - ) - peerdns:depends("proto", "pppoa") - peerdns:depends("proto", "pppoe") - peerdns:depends("proto", "pptp") - peerdns.rmempty = false - peerdns.default = "1" - - if has_ipv6 then - ipv6 = s:taboption("expert", Flag, "ipv6", translate("Enable IPv6 on PPP link") ) - ipv6:depends("proto", "pppoa") - ipv6:depends("proto", "pppoe") - ipv6:depends("proto", "pptp") - end -end - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/network/lan.lua b/modules/niu/luasrc/model/cbi/niu/network/lan.lua deleted file mode 100644 index ee70dd2cc..000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/lan.lua +++ /dev/null @@ -1,44 +0,0 @@ -local uci = require "luci.model.uci" -local cursor = uci.cursor() -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("lan1", "niu/network/lan1") - -function d.on_cancel() - cursor:revert("network") - cursor:revert("dhcp") -end - -function d.on_done() - if uci.inst_state:get("network", "lan", "ipaddr") ~= cursor:get("network", "lan", "ipaddr") then - local cs = uci.cursor_state() - cs:set("network", "lan", "_ipchanged", "1") - cs:save("network") - end - - if cursor:get("network", "lan", "proto") == "dhcp" then - local emergv4 = cursor:get("network", "lan", "_emergv4") - if emergv4 then - if cursor:get("network", "lan_ea") then - cursor:set("network", "lan_ea", "ipaddr", emergv4) - else - cursor:section("network", "alias", "lan_ea", { - ipaddr = emergv4, - netmask = "255.255.255.0", - network = "lan" - }) - end - else - cursor:delete("network", "lan_ea") - end - end - - cursor:set("network", "lan", "type", "bridge") - cursor:commit("network") - cursor:commit("dhcp") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/network/lan1.lua b/modules/niu/luasrc/model/cbi/niu/network/lan1.lua deleted file mode 100644 index 62795da15..000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/lan1.lua +++ /dev/null @@ -1,131 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> -Copyright 2009 Jo-Philipp Wich <xm@subsignal.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -local bridge = (arg[1] == "bridgelan") -local niulib = require "luci.niulib" -local fs = require "nixio.fs" -local has_ipv6 = fs.access("/proc/net/ipv6_route") - -m = Map("network", translate("Configure Local Network"), bridge and -translate([[The wireless network will be connected directly to your local network. -Make sure you to assign any address to this device that is in the same subnet -of the other devices in your network but that is not already occupied. -If you have a DHCP-Server in this network you may also choose DHCP for address configuration.]]) -or translate("These settings affect the devices in your local network. ".. -"Usually you do not need to change anything here for this device to work correctly.")) - -s = m:section(NamedSection, "lan", "interface", "Network Settings") -s.addremove = false - -s:tab("general", translate("General Settings")) -s:tab("expert", translate("Expert Settings")) - -p = s:taboption("expert", ListValue, "proto", translate("Address Configuration")) -p.default = "static" -p:value("static", translate("Static Configuration")) -p:value("dhcp", "DHCP") - - -ipaddr = s:taboption("general", Value, "ipaddr", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address")) -ipaddr.default = "192.168.0.1" -ipaddr:depends("proto", "static") - -nm = s:taboption("general", Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask")) -nm.default = "255.255.255.0" -nm:value("255.255.255.0") -nm:value("255.255.0.0") -nm:value("255.0.0.0") -nm:depends("proto", "static") - - -mac = s:taboption("expert", Value, "macaddr", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address")) - -mtu = s:taboption("expert", Value, "mtu", "MTU") -mtu.isinteger = true - -dns = s:taboption("expert", Value, "dns", translate("<abbr title=\"Domain Name System\">DNS</abbr>-Server")) -dns:depends("peerdns", "") - - -gw = s:taboption(bridge and "general" or "expert", Value, "gateway", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Gateway")) -gw:depends("proto", "static") - -bcast = s:taboption("expert", Value, "bcast", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Broadcast")) -bcast:depends("proto", "static") - - -if has_ipv6 then - ip6addr = s:taboption("expert", Value, "ip6addr", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Address"), translate("<abbr title=\"Classless Inter-Domain Routing\">CIDR</abbr>-Notation: address/prefix")) - ip6addr:depends("proto", "static") - ip6gw = s:taboption("expert", Value, "ip6gw", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Gateway")) - ip6gw:depends("proto", "static") -end - -emerg = s:taboption("expert", Value, "_emergv4", translate("Emergency Access Address"), -translate([[In case the DHCP request fails you will still be able to access this device using given IP -by configuring your computer to an address in the same subnet and netmask 255.255.255.0.]])) -emerg:depends("proto", "dhcp") -emerg:value("", translate("disable")) -emerg.default = "169.254.255.169" - - -stp = s:taboption("expert", Flag, "stp", translate("Enable <abbr title=\"Spanning Tree Protocol\">STP</abbr>"), - translate("Enables the Spanning Tree Protocol on this bridge")) - -ifname_multi = s:taboption("expert", MultiValue, "ifname", translate("Interface")) -ifname_multi.widget = "checkbox" -for _, eth in ipairs(niulib.eth_get_available("lan")) do - ifname_multi:value(eth, translate("Ethernet-Adapter (%s)") % eth) -end - - -m2 = Map("dhcp") - -s = m2:section(TypedSection, "dhcp", "DHCP") -s.anonymous = true -s.addremove = false -s.dynamic = false - -s:tab("general", translate("General Settings")) - -s:depends("interface", "lan") - -enable = s:taboption("general", ListValue, "ignore", translate("Automatic address assignment for network devices"), -bridge and -translate("Note: Be careful that you do not accidently two DHCP servers in the same network with overlapping address ranges.") -or "") -enable:value(0, translate("enable"), {["network.lan.proto"] = "static"}) -enable:value(1, translate("disable")) - - -s:tab("expert", translate("Expert Settings")) -start = s:taboption("expert", Value, "start", translate("First leased address")) -start:depends("ignore", "0") -start.default = "100" - -limit = s:taboption("expert", Value, "limit", translate("Number of leased addresses"), "") -limit:depends("ignore", "0") -limit.default = "150" - -time = s:taboption("expert", Value, "leasetime", translate("Lease Time")) -time:depends("ignore", "0") -time.default = "12h" - -local dd = s:taboption("expert", Flag, "dynamicdhcp", translate("Also generate addresses for unknown devices")) -dd.rmempty = false -dd.default = "1" -dd:depends("ignore", "0") - -return m, m2
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/network/wan.lua b/modules/niu/luasrc/model/cbi/niu/network/wan.lua deleted file mode 100644 index b8d572d83..000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/wan.lua +++ /dev/null @@ -1,88 +0,0 @@ -local cursor = require "luci.model.uci".cursor() - -if not cursor:get("network", "wan") then - cursor:section("network", "interface", "wan", {proto = "none"}) - cursor:save("network") -end - -if not cursor:get("wireless", "client") then - cursor:section("wireless", "wifi-iface", "client", - {device = "_", doth = "1", _niu = "1", mode = "sta"}) - cursor:save("wireless") -end - -local function deviceroute(self) - cursor:unload("network") - local wd = cursor:get("network", "wan", "_wandev") or "" - - if wd == "none" then - cursor:set("network", "wan", "proto", "none") - end - - if wd:find("ethernet:") == 1 then - cursor:set("network", "wan", "defaultroute", "1") - if wd:find("!", 10) == 10 then --Unbridge from LAN - local ethdev = wd:sub(11) - local ifname = cursor:get("network", "lan", "ifname") - local newifname = {} - for k in ifname:gmatch("[^ ]+") do - if k ~= ifname then - newifname[#newifname+1] = k - end - end - cursor:set("network", "lan", "ifname", table.concat(newifname, " ")) - cursor:set("network", "wan", "_wandev", "ethernet:" .. ethdev) - cursor:set("network", "wan", "ifname", ethdev) - else - cursor:set("network", "wan", "ifname", wd:sub(10)) - end - self:set_route("etherwan") - else - cursor:delete("network", "wan", "ifname") - end - - if wd:find("wlan:") == 1 then - local widev = wd:sub(6) - if cursor:get("wireless", "client", "device") ~= widev then - cursor:delete("wireless", "client", "network") - cursor:set("wireless", "client", "mode", "sta") - cursor:set("wireless", "client", "device", widev) - cursor:delete_all("wireless", "wifi-iface", function(s) - return s.device == widev and s._niu ~= "1" - end) - cursor:set("wireless", widev, "disabled", 0) - end - self:set_route("wlanwan1", "wlanwan2") - else - cursor:delete("wireless", "client", "device") - cursor:delete("wireless", "client", "network") - end - - - cursor:save("wireless") - cursor:save("network") -end - - -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("device", "niu/network/wandevice") -d:add("deviceroute", deviceroute) -d:set("etherwan", "niu/network/etherwan") -d:set("wlanwan1", "niu/network/wlanwanscan") -d:set("wlanwan2", "niu/network/wlanwan") - -function d.on_cancel() - cursor:revert("network") - cursor:revert("wireless") -end - -function d.on_done() - cursor:commit("network") - cursor:commit("wireless") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/network/wandevice.lua b/modules/niu/luasrc/model/cbi/niu/network/wandevice.lua deleted file mode 100644 index 8917b97c0..000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/wandevice.lua +++ /dev/null @@ -1,47 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -local niulib = require "luci.niulib" - -m = Map("network", "Configure Internet Connection") -s = m:section(NamedSection, "wan", "interface", "Internet Connection Device") -s.anonymous = true -s.addremove = false - -s:tab("general", translate("General Settings")) -s:tab("expert", translate("Expert Settings")) - -l = s:taboption("general", ListValue, "_wandev", "Internet Connection via") - -for _, ifc in ipairs(niulib.eth_get_available("wan")) do - l:value("ethernet:%s" % ifc, "Cable / DSL / Ethernet-Adapter (%s)" % ifc) -end - -for _, wifi in ipairs(niulib.wifi_get_available("client")) do - l:value("wlan:%s" % wifi, "WLAN-Adapter (%s)" % wifi) -end - -for _, ifc in ipairs(niulib.eth_get_bridged("lan")) do - l:value("ethernet:!%s" % ifc, "Used Ethernet-Adapter (%s)" % ifc, {_showused = "1"}) -end - -l:value("none", "No Internet Connection") - -v = s:taboption("expert", ListValue, "_showused", translate("Show ethernet adapters in use")) -v:value("", translate("never")) -v:value("1", translate("from LAN-bridge, unbridge on-demand")) - - - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/network/wlanwan.lua b/modules/niu/luasrc/model/cbi/niu/network/wlanwan.lua deleted file mode 100644 index 40d2486bc..000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/wlanwan.lua +++ /dev/null @@ -1,284 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> -Copyright 2009 Jo-Philipp Wich <xm@subsignal.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -local fs = require "nixio.fs" -local uci = require "luci.model.uci" -local nixio = require "nixio" -local iwinfo = require "iwinfo" - -local bridge -local iface = "client" -local net = "wan" -if arg[1] == "bridge" then - bridge = true - iface = "bridge" - net = "lan" -end - -local cursor = uci.inst -local state = uci.inst_state -cursor:unload("wireless") -state:unload("wireless") - -local has_ipv6 = fs.access("/proc/net/ipv6_route") -local device = cursor:get("wireless", iface, "device") -local hwtype = cursor:get("wireless", device, "type") - - --- Bring up interface and scan -- - -if not state:get("wireless", iface, "network") then - local olduci = uci.cursor(nil, "") - local oldcl = olduci:get_all("wireless", iface) - olduci:unload("wireless") - - local newuci = uci.cursor() - local newcl = newuci:get_all("wireless", iface) - newcl.network = net - - local proc = nixio.fork() - if proc == 0 then - newuci:delete("wireless", iface, "ssid") - newuci:commit("wireless") - nixio.exec("/sbin/wifi", "up", device) - os.exit(1) - end - nixio.wait(proc) - - newuci:delete("wireless", iface) - newuci:section("wireless", "wifi-iface", iface, oldcl) - newuci:commit("wireless") - newuci:tset("wireless", iface, newcl) - newuci:save("wireless") - newuci:unload("wireless") - - state:unload("wireless") -end - -local ifname = state:get("wireless", iface, "ifname") or "wlan0dummy" -local iwlib = iwinfo.type(ifname) and iwinfo[iwinfo.type(ifname)] -local suggest = {} -local encrdep = { - none = {{["!default"] = 1}}, - wep = {{["!default"] = 1}}, - psk = {{["!default"] = 1}}, - psk2 = {{["!default"] = 1}}, - wpa = {{["!default"] = 1}}, - wpa2 = {{["!default"] = 1}} -} - -if iwlib then - suggest = iwlib.scanlist(ifname) -end - - - --- Form definition -- - -m2 = Map("wireless", translate("Configure WLAN-Adapter for Client Connection"), -bridge and ("<strong>" .. translate([[It is absolutely necessary that the network you are joining -supports and allows bridging (WDS) otherwise your connection will fail.]]) .. "</strong> " .. -translate([[Note: You can use the access point wizard to configure your -private access point to increase the range of the network you are connected to.]])) or "") - -s = m2:section(NamedSection, iface, "wifi-iface", translate("Wireless Settings")) -s.addremove = false - -s:tab("general", translate("General Settings")) -s:tab("expert", translate("Expert Settings")) - -local ssid = s:taboption("general", Value, "ssid", translate("Network Name (<abbr title=\"Extended Service Set Identifier\">ESSID</abbr>)")) -ssid.rmempty = false - -for _, v in ipairs(suggest) do - if v.mode == "Master" then - ssid:value(v.ssid) - - if not v.wep then - encrdep.wep[#encrdep.wep+1] = {ssid = v.ssid, ["!reverse"] = 1} - end - if v.wpa ~= 1 or (v.wpa == 1 and v.auth_suites[1] ~= "802.1x") then - encrdep.wpa[#encrdep.wpa+1] = {ssid = v.ssid, ["!reverse"] = 1} - end - if v.wpa ~= 1 or (v.wpa == 1 and v.auth_suites[1] ~= "PSK") then - encrdep.psk[#encrdep.psk+1] = {ssid = v.ssid, ["!reverse"] = 1} - end - if not v.wpa or v.wpa < 2 or (v.wpa >= 2 and v.auth_suites[1] ~= "802.1x") then - encrdep.wpa2[#encrdep.wpa2+1] = {ssid = v.ssid, ["!reverse"] = 1} - end - if not v.wpa or v.wpa < 2 or (v.wpa >= 2 and v.auth_suites[1] ~= "PSK") then - encrdep.psk2[#encrdep.psk2+1] = {ssid = v.ssid, ["!reverse"] = 1} - end - if v.wpa or v.wep then - encrdep.none[#encrdep.none+1] = {ssid = v.ssid, ["!reverse"] = 1} - end - end -end - -mode = s:taboption("expert", ListValue, "mode", translate("Operating Mode")) -mode.override_values = true -mode:value("sta", translate("Client")) - -encr = s:taboption("general", ListValue, "encryption", translate("Encryption")) - - -if hwtype == "mac80211" then - if not bridge then - mode:value("mesh", translate("Mesh (802.11s)")) - local meshid = s:taboption("expert", Value, "mesh_id", translate("Mesh ID")) - meshid:depends("mode", "mesh") - end - - local ps = s:taboption("expert", Flag, "powersave", translate("Enable Powersaving")) - ps:depends("mode", "sta") -elseif hwtype == "atheros" then - s:taboption("expert", Flag, "bursting", translate("Allow Burst Transmissions")) -end - - - --- Encryption -- - -encr.override_values = true -encr.override_depends = true -encr:value("none", "No Encryption", unpack(encrdep.none)) -encr:value("wep", "WEP", unpack(encrdep.wep)) - -if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then - local supplicant = fs.access("/usr/sbin/wpa_supplicant") or os.getenv("LUCI_SYSROOT") - if supplicant then - encr:value("psk", "WPA", unpack(encrdep.psk)) - encr:value("wpa", "WPA-EAP", unpack(encrdep.wpa)) - encr:value("psk2", "WPA2", unpack(encrdep.psk2)) - encr:value("wpa2", "WPA2-EAP (802.11i)", unpack(encrdep.wpa2)) - end -elseif hwtype == "broadcom" then - encr:value("psk", "WPA", unpack(encrdep.psk)) - encr:value("psk2", "WPA2", unpack(encrdep.psk2)) -end - -key = s:taboption("general", Value, "key", translate("Password")) -key:depends("encryption", "wep") -key:depends("encryption", "psk") -key:depends("encryption", "psk2") -key.rmempty = true -key.password = true - -if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then - eaptype = s:taboption("general", ListValue, "eap_type", translate("EAP-Method")) - eaptype:value("TLS") - eaptype:value("TTLS") - eaptype:value("PEAP") - eaptype:depends({encryption="wpa"}) - eaptype:depends({encryption="wpa2"}) - - cacert = s:taboption("general", FileUpload, "ca_cert", translate("Path to CA-Certificate")) - cacert:depends({encryption="wpa"}) - cacert:depends({encryption="wpa2"}) - - privkey = s:taboption("general", FileUpload, "priv_key", translate("Path to Private Key")) - privkey:depends({eap_type="TLS", encryption="wpa2"}) - privkey:depends({eap_type="TLS", encryption="wpa"}) - - privkeypwd = s:taboption("general", Value, "priv_key_pwd", translate("Password of Private Key")) - privkeypwd:depends({eap_type="TLS", encryption="wpa2"}) - privkeypwd:depends({eap_type="TLS", encryption="wpa"}) - - - auth = s:taboption("general", Value, "auth", translate("Authentication")) - auth:value("PAP") - auth:value("CHAP") - auth:value("MSCHAP") - auth:value("MSCHAPV2") - auth:depends({eap_type="PEAP", encryption="wpa2"}) - auth:depends({eap_type="PEAP", encryption="wpa"}) - auth:depends({eap_type="TTLS", encryption="wpa2"}) - auth:depends({eap_type="TTLS", encryption="wpa"}) - - - identity = s:taboption("general", Value, "identity", translate("Identity")) - identity:depends({eap_type="PEAP", encryption="wpa2"}) - identity:depends({eap_type="PEAP", encryption="wpa"}) - identity:depends({eap_type="TTLS", encryption="wpa2"}) - identity:depends({eap_type="TTLS", encryption="wpa"}) - - password = s:taboption("general", Value, "password", translate("Password")) - password:depends({eap_type="PEAP", encryption="wpa2"}) - password:depends({eap_type="PEAP", encryption="wpa"}) - password:depends({eap_type="TTLS", encryption="wpa2"}) - password:depends({eap_type="TTLS", encryption="wpa"}) -end - - - -if not bridge then - -m = Map("network") - -s = m:section(NamedSection, net, "interface", translate("Address Settings")) -s.addremove = false - -s:tab("general", translate("General Settings")) -s:tab("expert", translate("Expert Settings")) - -p = s:taboption("general", ListValue, "proto", "Connection Type") -p.override_scheme = true -p.default = "dhcp" -p:value("dhcp", "Automatic Configuration (DHCP)") -p:value("static", "Static Configuration") - - - -ipaddr = s:taboption("general", Value, "ipaddr", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address")) -ipaddr.rmempty = true -ipaddr:depends("proto", "static") - -nm = s:taboption("general", Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask")) -nm.rmempty = true -nm:depends("proto", "static") -nm:value("255.255.255.0") -nm:value("255.255.0.0") -nm:value("255.0.0.0") - -gw = s:taboption("general", Value, "gateway", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Gateway")) -gw:depends("proto", "static") -gw.rmempty = true - -bcast = s:taboption("expert", Value, "bcast", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Broadcast")) -bcast:depends("proto", "static") - -if has_ipv6 then - ip6addr = s:taboption("expert", Value, "ip6addr", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Address"), translate("<abbr title=\"Classless Inter-Domain Routing\">CIDR</abbr>-Notation: address/prefix")) - ip6addr:depends("proto", "static") - - ip6gw = s:taboption("expert", Value, "ip6gw", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Gateway")) - ip6gw:depends("proto", "static") -end - -dns = s:taboption("expert", Value, "dns", translate("<abbr title=\"Domain Name System\">DNS</abbr>-Server")) -dns:depends("peerdns", "") - -mtu = s:taboption("expert", Value, "mtu", "MTU") -mtu.isinteger = true - -mac = s:taboption("expert", Value, "macaddr", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address")) - -return m2, m - -else - -return m2 - -end
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/network/wlanwanscan.lua b/modules/niu/luasrc/model/cbi/niu/network/wlanwanscan.lua deleted file mode 100644 index 4035ff415..000000000 --- a/modules/niu/luasrc/model/cbi/niu/network/wlanwanscan.lua +++ /dev/null @@ -1,12 +0,0 @@ -local t = Template("niu/network/wlanwanscan") -function t.parse(self, ...) - local state = Template.parse(self, ...) - if Map.formvalue({readinput = true}, "cbi.delg.back") then - return FORM_SKIP - end - if state == FORM_NODATA then - self.delegator.disallow_pageactions = true - end - return state -end -return t
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/system/general.lua b/modules/niu/luasrc/model/cbi/niu/system/general.lua deleted file mode 100644 index 046691c9c..000000000 --- a/modules/niu/luasrc/model/cbi/niu/system/general.lua +++ /dev/null @@ -1,34 +0,0 @@ -local cursor = require "luci.model.uci".cursor() -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("general1", load("niu/system/general1")) - -function d.on_cancel() - cursor:revert("luci") -end - -function d.on_done() - local pw1 = cursor:get("luci", "main", "_pw1") - if pw1 and pw1 ~= "**********" then - cursor:delete("luci", "main", "_pw1") - require "luci.sys".user.setpasswd("root", pw1) - end - - local hn = cursor:get("luci", "main", "_uniquename") - if hn then - cursor:foreach("system", "system", function(s) - cursor:set("system", s[".name"], "hostname", hn) - end) - cursor:commit("system") - - require "nixio.fs".writefile("/proc/sys/kernel/hostname", hn) - cursor:delete("luci", "main", "_uniquename") - end - - cursor:commit("luci") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/system/general1.lua b/modules/niu/luasrc/model/cbi/niu/system/general1.lua deleted file mode 100644 index 83481888c..000000000 --- a/modules/niu/luasrc/model/cbi/niu/system/general1.lua +++ /dev/null @@ -1,45 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -local fs = require "nixio.fs" -local i18n = require "luci.i18n" -local util = require "luci.util" -local config = require "luci.config" - -m = Map("luci", "Device Settings") - -c = m:section(NamedSection, "main", "core", translate("Local Settings")) - -hn = c:option(Value, "_uniquename", translate("Unique Devicename")) -function hn:cfgvalue(self) - return require "nixio.fs".readfile("/proc/sys/kernel/hostname") -end - -l = c:option(ListValue, "lang", translate("System Language")) -l:value("auto") - -local i18ndir = i18n.i18ndir .. "default." -for k, v in util.kspairs(config.languages) do - local file = i18ndir .. k:gsub("_", "-") - if k:sub(1, 1) ~= "." and fs.access(file .. ".lmo") then - l:value(k, v) - end -end - -pw1 = c:option(Value, "_pw1", translate("Administrator Password")) -pw1.password = true -pw1.default = "**********" - - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/system/reboot.lua b/modules/niu/luasrc/model/cbi/niu/system/reboot.lua deleted file mode 100644 index d8f852bdc..000000000 --- a/modules/niu/luasrc/model/cbi/niu/system/reboot.lua +++ /dev/null @@ -1 +0,0 @@ -local f = Form("reboot", "Rebooting Device", "Device is rebooting. Please wait...")
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/traffic/portfw.lua b/modules/niu/luasrc/model/cbi/niu/traffic/portfw.lua deleted file mode 100644 index bf4e132df..000000000 --- a/modules/niu/luasrc/model/cbi/niu/traffic/portfw.lua +++ /dev/null @@ -1,20 +0,0 @@ -local uci = require "luci.model.uci" -local cursor = uci.cursor() -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("portfw1", load("niu/traffic/portfw1")) - -function d.on_cancel() - cursor:revert("firewall") - cursor:revert("upnpd") -end - -function d.on_done() - cursor:commit("firewall") - cursor:commit("upnpd") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/traffic/portfw1.lua b/modules/niu/luasrc/model/cbi/niu/traffic/portfw1.lua deleted file mode 100644 index 11ed4aa92..000000000 --- a/modules/niu/luasrc/model/cbi/niu/traffic/portfw1.lua +++ /dev/null @@ -1,65 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- -local fs = require "nixio.fs" -local sys = require "luci.sys" - -m = Map("firewall", translate("Manage Port Forwarding")) - -s = m:section(TypedSection, "redirect", translate("Manual Port Forwarding"), -translate([[To manually define a forwarding rule you have to specify at least -the internal IP-address and port of the service that should be forwarded. -If you ommit the external port it will be the same as the internal port. -You also can forward a range of ports by using the syntax first-last Port -(e.g. 1024-1030) in the port field.]])) -s.template = "cbi/tblsection" -s.addremove = true -s.anonymous = true - -name = s:option(Value, "_name", translate("Name"), translate("optional")) -name.size = 10 - -iface = s:option(ListValue, "src", translate("Zone")) -iface:value("wan", "Internet") -iface.default = "wan" - -proto = s:option(ListValue, "proto", translate("Protocol")) -proto:value("tcp", "TCP") -proto:value("udp", "UDP") -proto:value("tcpudp", "TCP+UDP") - -dport = s:option(Value, "src_dport", translate("Internal Port")) -dport.size = 5 - -to = s:option(Value, "dest_ip", translate("Internal Address"), translate("Device running the service")) -for i, dataset in ipairs(sys.net.arptable()) do - to:value(dataset["IP address"]) -end - -toport = s:option(Value, "dest_port", translate("External Port"), translate("optional")); -toport.size = 5 - -local m2 -if fs.access("/etc/config/upnpd") then - m2 = Map("upnpd") - s = m2:section(NamedSection, "config", "upnpd", translate("Automatic Port Forwarding (UPnP IGD)"), - translate([[Allows UPnP-capable applications to automatically forward ports on the router to their IP-Address. - Be aware that this is a potential security risk as applications are not authenticated.]])) - s.addremove = false - - on = s:option(ListValue, "external_iface", translate("Port Forwarding Restrictions")) - on:value("none", translate("Manual Forwarding Only")) - on:value("wan", translate("Automatic and Manual Forwarding")) -end - -return m, m2 diff --git a/modules/niu/luasrc/model/cbi/niu/traffic/qos.lua b/modules/niu/luasrc/model/cbi/niu/traffic/qos.lua deleted file mode 100644 index aa1f3f89e..000000000 --- a/modules/niu/luasrc/model/cbi/niu/traffic/qos.lua +++ /dev/null @@ -1,36 +0,0 @@ -local uci = require "luci.model.uci" -local cursor = uci.cursor() - -if not cursor:get("qos", "wan", "_niuinit") then - -- Load some more sensible default classifications - cursor:delete_all("qos", "classify") - cursor:section("qos", "classify", "dns", - {target = "Priority", ports = "53", _name = "DNS"} - ) - cursor:section("qos", "classify", "inet1", - {target = "Normal", ports = "20,21,22,80,443", _name = "WWW, SSH, FTP"} - ) - cursor:section("qos", "classify", "inet2", - {target = "Normal", ports = "25,110,119,143", _name = "E-Mail, News"} - ) - - cursor:set("qos", "wan", "_niuinit", "1") - cursor:save("qos") -end - -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("qos1", load("niu/traffic/qos1")) - -function d.on_cancel() - cursor:revert("qos") -end - -function d.on_done() - cursor:commit("qos") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/traffic/qos1.lua b/modules/niu/luasrc/model/cbi/niu/traffic/qos1.lua deleted file mode 100644 index 6171dfaa7..000000000 --- a/modules/niu/luasrc/model/cbi/niu/traffic/qos1.lua +++ /dev/null @@ -1,89 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -local sys = require "luci.sys" -local fs = require "nixio.fs" - -m = Map("qos", translate("Manage Prioritization (QoS)"), translate([[Different -kinds of network traffic usually have different transmission requirements. -For example the important factor for a large HTTP-download is bandwith whereas -VoIP has a large focus on low packet latency. Prioritization takes these quality -of service factors into account and optimizes priorities to allow reasonable -performance for time critical services.]])) - -s = m:section(NamedSection, "wan", "interface", translate("General Settings"), -translate([[For QoS to work correctly you need to provide the upload and -download speed of your internet connection. Values are in kilobits per second. -For comparison a standard consumer ADSL connection has between 1000 and 25000 -kbps as donwload speed and between 128 and 1000 kbps upload speed.]])) -s.addremove = false - -local en = s:option(ListValue, "enabled", translate("Prioritization")) -en:value("1", "Enable Quality of Service") -en:value("0", "Disable") - -local dl = s:option(Value, "download", translate("Maximum Download Speed"), "kbps") -dl:depends("enabled", "1") - -local ul = s:option(Value, "upload", translate("Maximum Upload Speed"), "kbps") -ul:depends("enabled", "1") - -s = m:section(TypedSection, "classify", translate("Finetuning"), translate([[ -The QoS application provides different useful default prioritization rules not -listed here that cover many common use-cases. You however can add custom rules -to finetune the prioritization process.]])) -s.template = "cbi/tblsection" - -s.anonymous = true -s.addremove = true - -n = s:option(Value, "_name", translate("Name"), translate("optional")) - -srch = s:option(Value, "srchost", translate("Local IP-Address")) -srch.rmempty = true -srch:value("", translate("all")) -for i, dataset in ipairs(sys.net.arptable()) do - srch:value(dataset["IP address"]) -end - -p = s:option(ListValue, "proto", translate("Protocol")) -p:value("", translate("all")) -p:value("tcp", "TCP") -p:value("udp", "UDP") -p.rmempty = true - -ports = s:option(Value, "ports", translate("Ports")) -ports.rmempty = true -ports:value("", translate("any")) - -if fs.access("/etc/l7-protocols") then - l7 = s:option(ListValue, "layer7", translate("Service")) - l7.rmempty = true - l7:value("", translate("all")) - for f in fs.glob("/etc/l7-protocols/*.pat") do - l7:value(f:sub(19, #f-4)) - end -end - -s:option(Value, "connbytes", translate("Bytes sent"), translate("from[-to]")) - -t = s:option(ListValue, "target", translate("Priority")) -t:value("Priority", translate("Highest")) -t:value("Express", translate("High")) -t:value("Normal", translate("Normal")) -t:value("Bulk", translate("Low")) -t.default = "Normal" - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/traffic/routes.lua b/modules/niu/luasrc/model/cbi/niu/traffic/routes.lua deleted file mode 100644 index f8e8a8af9..000000000 --- a/modules/niu/luasrc/model/cbi/niu/traffic/routes.lua +++ /dev/null @@ -1,17 +0,0 @@ -local cursor = require "luci.model.uci".cursor() -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("routes1", load("niu/traffic/routes1")) - -function d.on_cancel() - cursor:revert("network") -end - -function d.on_done() - cursor:commit("network") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/traffic/routes1.lua b/modules/niu/luasrc/model/cbi/niu/traffic/routes1.lua deleted file mode 100644 index f09cf076c..000000000 --- a/modules/niu/luasrc/model/cbi/niu/traffic/routes1.lua +++ /dev/null @@ -1,57 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth <steven@midlink.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -m = Map("network", translate("Manage Traffic Routing"), -translate("With additional static routes you allow computers on your network to reach unannounced remote hosts or networks.")) - -local routes6 = luci.sys.net.routes6() -local bit = require "bit" - -m:append(Template("niu/network/rtable")) - -s = m:section(TypedSection, "route", "Static IPv4 Routes") -s.addremove = true -s.anonymous = true - -s.template = "cbi/tblsection" - -iface1 = s:option(ListValue, "interface", translate("Interface")) - -s:option(Value, "target", translate("Target"), translate("Host-<abbr title=\"Internet Protocol Address\">IP</abbr> or Network")) -s:option(Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask"), translate("if target is a network")).rmemepty = true -s:option(Value, "gateway", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Gateway")) - -if routes6 then - s = m:section(TypedSection, "route6", "Static IPv6 Routes") - s.addremove = true - s.anonymous = true - - s.template = "cbi/tblsection" - - iface2 = s:option(ListValue, "interface", translate("Interface")) - - s:option(Value, "target", translate("Target"), translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Address or Network (CIDR)")) - s:option(Value, "gateway", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Gateway")).rmempty = true -end - -m.uci:foreach("network", "interface", function(s) - if s[".name"] ~= "loopback" then - iface:value(s[".name"]) - if iface2 then - iface2:value(s[".name"]) - end - end -end) - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/wireless/ap.lua b/modules/niu/luasrc/model/cbi/niu/wireless/ap.lua deleted file mode 100644 index 77325d30c..000000000 --- a/modules/niu/luasrc/model/cbi/niu/wireless/ap.lua +++ /dev/null @@ -1,52 +0,0 @@ -local cursor = require "luci.model.uci".cursor() - -if not cursor:get("wireless", "ap") then - cursor:section("wireless", "wifi-iface", "ap", - {device = "_", doth = "1", _niu = "1", mode = "ap"}) - cursor:save("wireless") -end - -local function deviceroute(self) - cursor:unload("wireless") - local d = cursor:get("wireless", "ap", "device") - local t = cursor:get("wireless", "ap", "_cfgtpl") - if d ~= "none" then - cursor:delete_all("wireless", "wifi-iface", function(s) - return s.device == d and s._niu ~= "1" - end) - cursor:set("wireless", d, "disabled", 0) - cursor:set("wireless", "ap", "network", "lan") - if t and #t > 0 then - cursor:delete("wireless", "ap", "_cfgtpl") - cursor:set("wireless", "ap", "ssid", cursor:get("wireless", "bridge", "ssid")) - cursor:set("wireless", "ap", "encryption", cursor:get("wireless", "bridge", "encryption")) - cursor:set("wireless", "ap", "key", cursor:get("wireless", "bridge", "key")) - cursor:set("wireless", "ap", "wds", "1") - end - - self:set_route("ap1") - else - cursor:delete("wireless", "ap", "network") - end - cursor:save("wireless") -end - - -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("device", "niu/wireless/apdevice") -d:add("deviceroute", deviceroute) -d:set("ap1", "niu/wireless/ap1") - -function d.on_cancel() - cursor:revert("wireless") -end - -function d.on_done() - cursor:commit("wireless") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/wireless/ap1.lua b/modules/niu/luasrc/model/cbi/niu/wireless/ap1.lua deleted file mode 100644 index 3ecbf5f4a..000000000 --- a/modules/niu/luasrc/model/cbi/niu/wireless/ap1.lua +++ /dev/null @@ -1,310 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> -Copyright 2009 Jo-Philipp Wich <xm@subsignal.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -local iface = "ap" -local ap = true - -local fs = require "nixio.fs" -local sys = require "luci.sys" -local cursor = require "luci.model.uci".inst -local state = require "luci.model.uci".inst_state -cursor:unload("wireless") - - -local device = cursor:get("wireless", iface, "device") -local hwtype = cursor:get("wireless", device, "type") - -local nsantenna = cursor:get("wireless", device, "antenna") - -local iw = nil -local tx_powers = {} -local chan = {} - -state:foreach("wireless", "wifi-iface", - function(s) - if s.device == device and not iw then - iw = sys.wifi.getiwinfo(s.ifname or s.device) - chan = iw and iw.freqlist or { } - tx_powers = iw.txpwrlist or { } - end - end) - -local m - - -if ap then -m = Map("wireless", translate("Configure Access Point")) -end - ---- Device Settings --- -s = m:section(NamedSection, device, "wifi-device", "Device Configuration") -s.addremove = false - -s:tab("general", translate("General Settings")) - -ch = s:taboption("general", Value, "channel", translate("Channel")) -ch:value("auto", translate("automatic")) -for _, f in ipairs(chan) do - ch:value(f.channel, "%i (%.3f GHz)" %{ f.channel, f.mhz / 1000 }) -end - - - -s:tab("expert", translate("Expert Settings")) -if hwtype == "mac80211" then - local macaddr = cursor:get("wireless", device, "macaddr") or "!" - local hwmode = cursor:get("wireless", device, "hwmode") - local modes = {} - local phy - local allowed = {} - for entry in fs.glob("/sys/class/ieee80211/*") do - if (fs.readfile(entry .. "/macaddress") or ""):find(macaddr) == 1 then - phy = entry:sub(22) - end - end - if phy then - local iwp = io.popen("iw phy " .. phy .. " info") - local iwin = iwp:read("*a") - - if iwp then - iwp:close() - local htcap = iwin:match("HT capabilities:%s*0x([0-9a-fA-F]+)") - allowed.n = (htcap and tonumber(htcap, 16) or 0) > 0 - allowed.g = iwin:find("2412 MHz") - allowed.a = iwin:find("5180 MHz") - end - end - - if next(allowed) then - mode = s:taboption("expert", ListValue, "hwmode", translate("Communication Protocol")) - if allowed.n and allowed.g then - mode:value("11ng", "802.11n (2.4 GHz)") - end - if allowed.n and allowed.a then - mode:value("11na", "802.11n (5 GHz)") - end - if allowed.a then - mode:value("11a", "802.11a (5 GHz)") - end - if allowed.g then - mode:value("11g", "802.11g (2.4 GHz)") - mode:value("11bg", "802.11b+g (2.4 GHz)") - mode:value("11b", "802.11b (2.4 GHz)") - end - end - - tp = s:taboption("expert", - (tx_powers and #tx_powers > 0) and ListValue or Value, - "txpower", translate("Transmission Power"), "dBm") - - tp.rmempty = true - tp:value("", translate("automatic")) - for _, p in ipairs(iw and iw.txpwrlist or {}) do - tp:value(p.dbm, "%i dBm (%i mW)" %{ p.dbm, p.mw }) - end -elseif hwtype == "atheros" then - tp = s:taboption("expert", - (#tx_powers > 0) and ListValue or Value, - "txpower", translate("Transmission Power"), "dBm") - - tp.rmempty = true - tp:value("", translate("automatic")) - for _, p in ipairs(iw.txpwrlist) do - tp:value(p.dbm, "%i dBm (%i mW)" %{ p.dbm, p.mw }) - end - - mode = s:taboption("expert", ListValue, "hwmode", translate("Communication Protocol")) - mode:value("", translate("automatic")) - mode:value("11g", "802.11g") - mode:value("11b", "802.11b") - mode:value("11bg", "802.11b+g") - mode:value("11a", "802.11a") - mode:value("11gst", "802.11g + Turbo") - mode:value("11ast", "802.11a + Turbo") - - if nsantenna then -- NanoFoo - local ant = s:taboption("expert", ListValue, "antenna", translate("Transmitter Antenna")) - ant:value("auto") - ant:value("vertical") - ant:value("horizontal") - ant:value("external") - ant.default = "auto" - end -elseif hwtype == "broadcom" then - tp = s:taboption("expert", - (#tx_powers > 0) and ListValue or Value, - "txpower", translate("Transmit Power"), "dBm") - - tp.rmempty = true - tp:value("", translate("automatic")) - for _, p in ipairs(iw.txpwrlist) do - tp:value(p.dbm, "%i dBm (%i mW)" %{ p.dbm, p.mw }) - end - - mp = s:taboption("expert", ListValue, "macfilter", translate("MAC-Address Filter")) - mp:value("", translate("disable")) - mp:value("allow", translate("Allow listed only")) - mp:value("deny", translate("Allow all except listed")) - ml = s:taboption("expert", DynamicList, "maclist", translate("MAC-List")) - ml:depends({macfilter="allow"}) - ml:depends({macfilter="deny"}) - - s:taboption("expert", Flag, "frameburst", translate("Allow Burst Transmissions")) -elseif hwtype == "prism2" then - s:taboption("expert", Value, "txpower", translate("Transmission Power"), "att units").rmempty = true -end - - - - -s = m:section(NamedSection, iface, "wifi-iface", translate("Interface Details")) -s.addremove = false - -s:tab("general", translate("General Settings")) -s:tab("expert", translate("Expert Settings")) - - - -local ssid = s:taboption("general", Value, "ssid", translate("Network Name (<abbr title=\"Extended Service Set Identifier\">ESSID</abbr>)")) - -mode = s:taboption("expert", ListValue, "mode", translate("Operating Mode")) -mode.override_values = true -mode:value("ap", translate("Access Point")) - -encr = s:taboption("expert", ListValue, "encryption", translate("Encryption")) - - -if hwtype == "mac80211" then - mode:value("mesh", translate("Mesh (802.11s)")) - local meshid = s:taboption("expert", Value, "mesh_id", translate("Mesh ID")) - meshid:depends("mode", "mesh") - - s:taboption("expert", Flag, "wds", translate("Enable Bridging and Repeating (WDS)")):depends("mode", "ap") - s:taboption("expert", Flag, "powersave", translate("Enable Powersaving")):depends("mode", "ap") -elseif hwtype == "atheros" then - -- mode:value("wds", translate("Static WDS")) - - mp = s:taboption("expert", ListValue, "macpolicy", translate("MAC-Address Filter")) - mp:value("", translate("disable")) - mp:value("deny", translate("Allow listed only")) - mp:value("allow", translate("Allow all except listed")) - ml = s:taboption("expert", DynamicList, "maclist", translate("MAC-List")) - ml:depends({macpolicy="allow"}) - ml:depends({macpolicy="deny"}) - - s:taboption("expert", Flag, "wds", translate("Enable Bridging and Repeating (WDS)")) - - if ap then - hidden = s:taboption("expert", Flag, "hidden", translate("Hide Access Point")) - hidden:depends({mode="ap"}) - hidden:depends({mode="ap-wds"}) - - isolate = s:taboption("expert", Flag, "isolate", translate("Prevent communication between clients")) - isolate:depends({mode="ap"}) - end - - s:taboption("expert", Flag, "bursting", translate("Allow Burst Transmissions")) -elseif hwtype == "broadcom" then - if ap then - hidden = s:taboption("expert", Flag, "hidden", translate("Hide Access Point")) - hidden:depends({mode="ap"}) - hidden:depends({mode="wds"}) - - isolate = s:taboption("expert", Flag, "isolate", translate("Prevent communication between clients")) - isolate:depends({mode="ap"}) - end -elseif hwtype == "prism2" then - mp = s:taboption("expert", ListValue, "macpolicy", translate("MAC-Address Filter")) - mp:value("", translate("disable")) - mp:value("deny", translate("Allow listed only")) - mp:value("allow", translate("Allow all except listed")) - - ml = s:taboption("expert", DynamicList, "maclist", translate("MAC-List")) - ml:depends({macpolicy="allow"}) - ml:depends({macpolicy="deny"}) - - if ap then - hidden = s:taboption("expert", Flag, "hidden", translate("Hide Access Point")) - hidden:depends({mode="ap"}) - hidden:depends({mode="wds"}) - end -end - --- Encryption -- - -encr.default = "wep" -- Early default -encr.override_values = true -encr.override_depends = true -encr:value("none", "No Encryption") -encr:value("wep", "WEP", {mode="ap"}) - -if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then - local hostapd = fs.access("/usr/sbin/hostapd") or os.getenv("LUCI_SYSROOT") - local supplicant = fs.access("/usr/sbin/wpa_supplicant") or os.getenv("LUCI_SYSROOT") - - if hostapd and not supplicant then - encr:value("psk", "WPA", {mode="ap"}) - encr:value("wpa", "WPA-EAP", {mode="ap"}) - encr:value("psk-mixed", "WPA + WPA2", {mode="ap"}) - encr:value("psk2", "WPA2", {mode="ap"}) - encr:value("wpa2", "WPA2-EAP (802.11i)", {mode="ap"}) - encr.default = "psk-mixed" - elseif not hostapd and supplicant then - encr:value("psk", "WPA", {mode="mesh"}) - encr:value("psk2", "WPA2", {mode="mesh"}) - encr.default = "psk2" - elseif hostapd and supplicant then - encr:value("psk", "WPA", {mode="ap"}, {mode="mesh"}) - encr:value("wpa", "WPA-EAP", {mode="ap"}) - encr:value("psk-mixed", "WPA + WPA2", {mode="ap"}) - encr:value("psk2", "WPA2", {mode="ap"}, {mode="mesh"}) - encr:value("wpa2", "WPA2-EAP (802.11i)", {mode="ap"}) - encr.default = "psk-mixed" - end -elseif hwtype == "broadcom" then - encr:value("psk", "WPA") - encr:value("psk+psk2", "WPA + WPA2") - encr:value("psk2", "WPA2") - encr.default = "psk+psk2" -end - -server = s:taboption("general", Value, "server", translate("Radius-Server")) -server:depends({mode="ap", encryption="wpa"}) -server:depends({mode="ap", encryption="wpa2"}) -server.rmempty = true - -port = s:taboption("general", Value, "port", translate("Radius-Port")) -port:depends({mode="ap", encryption="wpa"}) -port:depends({mode="ap", encryption="wpa2"}) -port.rmempty = true - -key = s:taboption("general", Value, "key", translate("Password")) -key:depends("encryption", "wep") -key:depends("encryption", "psk") -key:depends("encryption", "psk2") -key:depends("encryption", "psk+psk2") -key:depends("encryption", "psk-mixed") -key:depends({mode="ap", encryption="wpa"}) -key:depends({mode="ap", encryption="wpa2"}) -key.rmempty = true -key.password = true - -if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then - nasid = s:taboption("general", Value, "nasid", translate("NAS ID")) - nasid:depends({mode="ap", encryption="wpa"}) - nasid:depends({mode="ap", encryption="wpa2"}) - nasid.rmempty = true -end -return m diff --git a/modules/niu/luasrc/model/cbi/niu/wireless/apdevice.lua b/modules/niu/luasrc/model/cbi/niu/wireless/apdevice.lua deleted file mode 100644 index 66b21ab7a..000000000 --- a/modules/niu/luasrc/model/cbi/niu/wireless/apdevice.lua +++ /dev/null @@ -1,46 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- -local niulib = require "luci.niulib" -local cursor = require "luci.model.uci".inst - -m = Map("wireless", translate("Configure Private Access Point")) -s = m:section(NamedSection, "ap", "wifi-iface", translate("Wireless Radio Device"), -translate( -"Select the wireless radio device that should be used to run the interface.".. -" Note that wireless radios will not show up here if you already use".. -" them for other wireless services and are not capable of being used by".. -" more than one service simultaneously or run this specific service at all.")) -s.anonymous = true -s.addremove = false - -local l = s:option(ListValue, "device", translate("Wireless Device")) - -for _, wifi in ipairs(niulib.wifi_get_available("ap")) do - l:value(wifi, translate("WLAN-Adapter (%s)") % wifi) -end -l:value("none", translate("Disable Private Access Point")) - - -local extend = cursor:get("wireless", "bridge", "network") - and cursor:get("wireless", "bridge", "ssid") - -if extend ~= cursor:get("wireless", "ap", "ssid") then - local templ = s:option(ListValue, "_cfgtpl", translate("Configuration Template")) - templ:depends({["!default"] = 1}) - templ:depends({["!reverse"] = 1, device = "none"}) - templ:value("", translate("Access Point (Current Settings)")) - templ:value("bridge", translate("Extend network %s") % extend) -end - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/wireless/brdevice.lua b/modules/niu/luasrc/model/cbi/niu/wireless/brdevice.lua deleted file mode 100644 index be5c475cc..000000000 --- a/modules/niu/luasrc/model/cbi/niu/wireless/brdevice.lua +++ /dev/null @@ -1,33 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- -local niulib = require "luci.niulib" - -m = Map("wireless", translate("Join a local WDS network")) -s = m:section(NamedSection, "bridge", "wifi-iface", translate("Wireless Radio Device"), -translate( -"Select the wireless radio device that should be used to run the interface.".. -" Note that wireless radios will not show up here if you already use".. -" them for other wireless services and are not capable of being used by".. -" more than one service simultaneously or run this specific service at all.")) -s.anonymous = true -s.addremove = false - -l = s:option(ListValue, "device", translate("Wireless Device")) - -for _, wifi in ipairs(niulib.wifi_get_available("bridge", {atheros = true, mac80211 = true})) do - l:value(wifi, translate("WLAN-Adapter (%s)") % wifi) -end -l:value("none", translate("Disable Bridge")) - -return m diff --git a/modules/niu/luasrc/model/cbi/niu/wireless/bridge.lua b/modules/niu/luasrc/model/cbi/niu/wireless/bridge.lua deleted file mode 100644 index 7ac2fff99..000000000 --- a/modules/niu/luasrc/model/cbi/niu/wireless/bridge.lua +++ /dev/null @@ -1,91 +0,0 @@ -local uci = require "luci.model.uci" -local cursor = uci.cursor() - -if not cursor:get("wireless", "bridge") then - cursor:section("wireless", "wifi-iface", "bridge", - {device = "_", doth = "1", _niu = "1", mode = "sta", wds = "1"}) - cursor:save("wireless") -end - -local function deviceroute(self) - cursor:unload("wireless") - local d = cursor:get("wireless", "bridge", "device") - if d ~= "none" then - local nc = uci.cursor(nil, "") - cursor:delete_all("wireless", "wifi-iface", function(s) - return s.device == d and s._niu ~= "1" - end) - if nc:get("wireless", "bridge", "network") - ~= cursor:get("wireless", "bridge", "network") then - cursor:delete("wireless", "bridge", "network") - end - cursor:set("wireless", d, "disabled", 0) - cursor:foreach("dhcp", "dhcp", function(s) - if s.interface == "lan" and s.ignore ~= "1" then - cursor:set("dhcp", s[".name"], "ignore", "1") - end - end) - self:set_route("scan", "bridge", "bridgelan") - else - if cursor:get("wireless", "bridge", "network") then - cursor:delete("wireless", "bridge", "network") - cursor:foreach("dhcp", "dhcp", function(s) - if s.interface == "lan" and s.ignore == "1" then - cursor:set("dhcp", s[".name"], "ignore", "0") - end - end) - self:set_route("lan") - end - end - cursor:save("dhcp") - cursor:save("wireless") -end - - -local d = Delegator() -d.allow_finish = true -d.allow_back = true -d.allow_cancel = true - -d:add("device", "niu/wireless/brdevice") -d:add("deviceroute", deviceroute) -d:set("scan", "niu/network/wlanwanscan") -d:set("bridge", "niu/network/wlanwan") -d:set("bridgelan", "niu/network/lan1") -d:set("lan", "niu/network/lan1") - -function d.on_cancel() - cursor:revert("network") - cursor:revert("wireless") - cursor:revert("dhcp") -end - -function d.on_done() - if uci.inst_state:get("network", "lan", "ipaddr") ~= cursor:get("network", "lan", "ipaddr") then - local cs = uci.cursor_state() - cs:set("network", "lan", "_ipchanged", "1") - cs:save("network") - end - - if cursor:get("network", "lan", "proto") == "dhcp" then - local emergv4 = cursor:get("network", "lan", "_emergv4") - if emergv4 then - if cursor:get("network", "lan_ea") then - cursor:set("network", "lan_ea", "ipaddr", emergv4) - else - cursor:section("network", "alias", "lan_ea", { - ipaddr = emergv4, - netmask = "255.255.255.0", - network = "lan" - }) - end - else - cursor:delete("network", "lan_ea") - end - end - cursor:commit("network") - cursor:commit("wireless") - cursor:commit("dhcp") -end - -return d
\ No newline at end of file diff --git a/modules/niu/luasrc/niulib.lua b/modules/niu/luasrc/niulib.lua deleted file mode 100644 index 7690294bc..000000000 --- a/modules/niu/luasrc/niulib.lua +++ /dev/null @@ -1,81 +0,0 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2009 Steven Barth <steven@midlink.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- - -local ipairs, pairs, require = ipairs, pairs, require -local os = require "os" - -local uci = require "luci.model.uci" -local cursor = uci.inst -local state = uci.inst_state - - -module "luci.niulib" - -function eth_get_available(except) - local nw = require "luci.model.network" - nw.init(cursor) - - local ifs = {} - for _, iface in ipairs(nw.get_interfaces()) do - if iface:name():find("eth") == 1 then - local net = iface:get_network() - if not net or net:name() == except or os.getenv("LUCI_SYSROOT") then - ifs[#ifs+1] = iface:name() - end - end - end - return ifs -end - -function eth_get_bridged(except) - local devs = state:get("network", except, "device") or "" - - local ifs = {} - local cnt = 0 - for x in devs:gmatch("[^ ]+") do - cnt = cnt + 1 - if x:find("eth") == 1 then - ifs[#ifs+1] = x - end - end - return cnt > 1 and ifs or {} -end - -function wifi_get_available(except, types) - cursor:unload("wireless") - - local iwinfo = require "iwinfo" - local used = {} - cursor:foreach("wireless", "wifi-iface", function(s) - if s[".name"] ~= except and s._niu == 1 then - used[s.device] = 1 - end - end) - - for k in pairs(used) do - local t = iwinfo.type(k) - if t and iwinfo[t] then - used[k] = (iwinfo[t].mbssid_support(k) < 1) - end - end - - local wifis = {} - cursor:foreach("wireless", "wifi-device", function(s) - if not used[s[".name"]] and (not types or types[s.type]) then - wifis[#wifis+1] = s[".name"] - end - end) - return wifis -end - diff --git a/modules/niu/luasrc/view/niu/dashboard.htm b/modules/niu/luasrc/view/niu/dashboard.htm deleted file mode 100644 index 7c387edd2..000000000 --- a/modules/niu/luasrc/view/niu/dashboard.htm +++ /dev/null @@ -1,39 +0,0 @@ -<% -local dsp = require "luci.dispatcher" -local utl = require "luci.util" - -include("header") - -local function cmp(a, b) - return (nodes[a].order or 100) < (nodes[b].order or 100) -end -for k, v in utl.spairs(nodes, cmp) do - if v.niu_dbtemplate or v.niu_dbtasks then - %> - <fieldset class="dbbox"> - <h2<% if v.niu_dbicon then %> style="background-image: url(<%=resource%>/<%=v.niu_dbicon%>)"<% end %>><%=v.title%></h2> - <% if v.niu_dbtemplate then tpl.render(v.niu_dbtemplate) end %> - <% if v.niu_dbtasks then %> - <h4>Tasks:</h4> - <ul> - <% - local nodes = dsp.node("niu", k).nodes - local function cmp(a, b) - return (nodes[a].order or 100) < (nodes[b].order or 100) - end - for k2, v2 in utl.spairs(nodes, cmp) do - %> - <li><a href="<%=dsp.build_url("niu", k, k2)%>"><%=v2.title%></a></li> - <% - end - %> - </ul> - <% end %> - </fieldset> - <% - end -end - -%> - -<%+footer%>
\ No newline at end of file diff --git a/modules/niu/luasrc/view/niu/network.htm b/modules/niu/luasrc/view/niu/network.htm deleted file mode 100644 index 5f48317dc..000000000 --- a/modules/niu/luasrc/view/niu/network.htm +++ /dev/null @@ -1,75 +0,0 @@ -<% -local uci = require "luci.model.uci" -local fs = require "nixio.fs" - -local nws = {} -uci.inst_state:foreach("network", "interface", function(s) - nws[#nws+1] = s -end) - -if uci.inst_state:get("network", "lan", "_ipchanged") and -uci.inst_state:revert("network", "lan", "_ipchanged") then - include("niu/network/warn_ip_change") -end - -local wanon = uci.inst_state:get("network", "wan", "proto") -local wanup = uci.inst_state:get("network", "wan", "up") -local wanip = uci.inst_state:get("network", "wan", "ipaddr") - -local leasefn -uci.inst:foreach("dhcp", "dnsmasq", - function(section) - leasefn = section.leasefile - end -) - -if leasefn then - local ln = fs.access(leasefn, "r") and io.lines(leasefn) - leasefn = 0 - while ln and ln() do - leasefn = leasefn + 1 - end -end - -local arps -if fs.access("/proc/net/arp", "r") then - local ln = io.lines("/proc/net/arp") - arps = -1 - while ln and ln() do - arps = arps + 1 - end - arps = arps >= 0 and arps -end -%> - -<table class="dbstattbl"> -<% if wanon and wanon ~= "none" then %> -<tr> -<% if wanup then %> -<th>Uplink Address:</th> -<td><%=wanip%></td> -<% else %> -<th>Uplink:</th> -<td><span style="color: darkred"><em>offline</em></span> -</td> -<% end %> - -</tr> -<% end %> - -<tr> -<th>Local Address:</th><td> -<%=uci.inst_state:get("network", "lan", "ipaddr")%> -</td> -</tr> - -<% if arps then %> -<tr> -<th>Active IP-Devices:</th><td><%=arps%><% if leasefn then %> -(<%=leasefn%> assigned) -<% end %></td> -</tr> -<% end %> - -</table> -<br />
\ No newline at end of file diff --git a/modules/niu/luasrc/view/niu/network/rtable.htm b/modules/niu/luasrc/view/niu/network/rtable.htm deleted file mode 100644 index 412baa166..000000000 --- a/modules/niu/luasrc/view/niu/network/rtable.htm +++ /dev/null @@ -1,112 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008-2009 Steven Barth <steven@midlink.org> -Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ - --%> - -<%- - local fs = require "nixio.fs" - local bit = require "nixio".bit - local sys = require "luci.sys" - local uci = require "luci.model.uci" - local inst = uci.inst - local state = uci.inst_state - local http = require "luci.http" - local style = true - - - local ifc = {__index = function(self, key) - local net = key - state:foreach("network", "interface", function(s) - if s.ifname == key then - net = s[".name"] - end - end) - rawset(self, key, net) - return net - end} - setmetatable(ifc, ifc) - - if http.formvalue("toggle_rtable") then - local cursor = uci.cursor() - local rt = cursor:get("network", "lan", "_showrtable") or "1" - cursor:set("network", "lan", "_showrtable", rt == "1" and "0" or "1") - cursor:save("network") - cursor:unload("network") - inst:unload("network") - end --%> - -<div><a href="?toggle_rtable=1"> > <%:Toggle display of Routing Information%> < </a></div> -<br /> - -<% if inst:get("network", "lan", "_showrtable") ~= "0" then %> -<div class="cbi-map" id="x-cbi-network"> - - <fieldset class="cbi-section" id="x-cbi-table-table"> - <legend><%_Active <abbr title="Internet Protocol Version 4">IPv4</abbr>-Routes%></legend> - - <div class="cbi-section-node"> - <table class="cbi-section-table"> - <tr class="cbi-section-table-titles"> - <th class="cbi-section-table-cell"><%:Network%></th> - <th class="cbi-section-table-cell"><%:Target%></th> - <th class="cbi-section-table-cell"><%_<abbr title="Internet Protocol Version 4">IPv4</abbr>-Netmask%></th> - <th class="cbi-section-table-cell"><%_<abbr title="Internet Protocol Version 4">IPv4</abbr>-Gateway%></th> - <th class="cbi-section-table-cell"><%:Metric%></th> - </tr> - <% luci.sys.net.routes(function(rt) %> - <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>"> - <td class="cbi-value-field"><%=ifc[rt.device]%></td> - <td class="cbi-value-field"><%=rt.dest:network():string()%></td> - <td class="cbi-value-field"><%=rt.dest:mask():string()%></td> - <td class="cbi-value-field"><%=rt.gateway:string()%></td> - <td class="cbi-value-field"><%=rt.metric%></td> - </tr> - <% style = not style; end) %> - </table> - </div> - </fieldset> - <br /> - - <% if fs.access("/proc/net/ipv6_route") then style = true %> - <fieldset class="cbi-section" id="x-cbi-table-table-2"> - <legend><%_Active <abbr title="Internet Protocol Version 6">IPv6</abbr>-Routes%></legend> - - <div class="cbi-section-node"> - <table class="cbi-section-table"> - <tr class="cbi-section-table-titles"> - <th class="cbi-section-table-cell"><%:Network%></th> - <th class="cbi-section-table-cell"><%:Target%></th> - <th class="cbi-section-table-cell"><%_<abbr title="Internet Protocol Version 6">IPv6</abbr>-Gateway%></th> - <th class="cbi-section-table-cell"><%:Metric%></th> - </tr> - <% luci.sys.net.routes6(function(rt) %> - <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>"> - <td class="cbi-value-field"><%=ifc[rt.device]%></td> - <td class="cbi-value-field"><%=rt.dest:string()%></td> - <td class="cbi-value-field"><%=rt.source:string()%></td> - <td class="cbi-value-field"><%- - local metr = rt.metric - local lower = bit.band(metr, 0xffff) - local higher = bit.rshift(bit.band(metr, 0xffff0000), 16) - write(string.format("%04X%04X", higher, lower)) - -%></td> - </tr> - <% style = not style; end) %> - </table> - </div> - </fieldset> - <br /> - <% end %> -</div> -<% end %> diff --git a/modules/niu/luasrc/view/niu/network/warn_ip_change.htm b/modules/niu/luasrc/view/niu/network/warn_ip_change.htm deleted file mode 100644 index c8a787510..000000000 --- a/modules/niu/luasrc/view/niu/network/warn_ip_change.htm +++ /dev/null @@ -1,11 +0,0 @@ -<% -local http = require "luci.http" -local dsp = require "luci.dispatcher" -local ip = require "luci.model.uci".inst:get("network", "lan", "ipaddr") -local url = (http.getenv("HTTPS") and "https" or "http") .. "://" .. ip .. -dsp.build_url("niu") -%> - -<div style="color: red">Warning! The device IP-address has been changed.<br /> -It will be available in a few seconds at <a href="<%=url%>"><%=url%></a></div> -<br />
\ No newline at end of file diff --git a/modules/niu/luasrc/view/niu/network/wlanwanscan.htm b/modules/niu/luasrc/view/niu/network/wlanwanscan.htm deleted file mode 100644 index f02b32ff5..000000000 --- a/modules/niu/luasrc/view/niu/network/wlanwanscan.htm +++ /dev/null @@ -1,7 +0,0 @@ -<div style="margin: auto"> -<h2>Scanning for wireless networks in range</h2> -<div>This may take a few seconds. Please wait...</div> -</div> -<script type="text/javascript"> -setTimeout(function() { document.forms.cbi.submit(); }, 100); -</script>
\ No newline at end of file diff --git a/modules/niu/luasrc/view/niu/null.htm b/modules/niu/luasrc/view/niu/null.htm deleted file mode 100644 index fe3a0735d..000000000 --- a/modules/niu/luasrc/view/niu/null.htm +++ /dev/null @@ -1 +0,0 @@ -NULL
\ No newline at end of file diff --git a/modules/niu/luasrc/view/niu/system.htm b/modules/niu/luasrc/view/niu/system.htm deleted file mode 100644 index c702214e1..000000000 --- a/modules/niu/luasrc/view/niu/system.htm +++ /dev/null @@ -1,72 +0,0 @@ -<% -local nxo = require "nixio" -local fs = require "nixio.fs" -local sinfo = nxo.sysinfo() -local load1 = nxo.bit.div(sinfo.loads[1] * 100, 1) -local load15 = nxo.bit.div(sinfo.loads[3] * 100, 1) - -local meminfo = fs.readfile("/proc/meminfo") -local totalram = nxo.bit.div(sinfo.totalram, 1024) -local freeram = nxo.bit.div(sinfo.freeram, 1024) -local buffers = nxo.bit.div(sinfo.bufferram, 1024) -local cached = tonumber(meminfo:match("Cached:%s+([0-9]+)%s+")) -local memused = nxo.bit.div(totalram - freeram - cached - buffers, 1024) -totalram = nxo.bit.div(totalram, 1024) - -local totalswap = nxo.bit.div(sinfo.totalswap, 1048576) -local usedswap = totalswap - nxo.bit.div(sinfo.freeswap, 1048576) - - -local function date_format(secs) - local suff = {"min", "h", "d"} - local mins = 0 - local hour = 0 - local days = 0 - - secs = nxo.bit.div(secs, 1) - if secs > 60 then - mins = nxo.bit.div(secs, 60) - secs = secs % 60 - end - - if mins > 60 then - hour = nxo.bit.div(mins, 60) - mins = mins % 60 - end - - if hour > 24 then - days = nxo.bit.div(hour, 24) - hour = hour % 24 - end - - if days > 0 then - return string.format("%.0fd %02.0fh %02.0fmin", days, hour, mins) - else - return string.format("%02.0fh %02.0fmin", hour, mins) - end -end -%> -<table class="dbstattbl"> -<tr> -<th>Load:</th> -<td><%=load1%>% / <%=load15%>%</td> -</tr> -<tr> -<th>Memory:</th> -<td><%=memused%> MiB / <%=totalram%> MiB</td> -</tr> - - -<% if totalswap > 0 then %> -<tr> -<th>Swap:</th> -<td><%=usedswap%> MiB / <%=totalswap%> MiB</td> -</tr> -<% end %> - -<tr> -<th>Uptime:</th> -<td><%=date_format(sinfo.uptime)%></td> -</tr> -</table> -<br />
\ No newline at end of file diff --git a/modules/niu/luasrc/view/niu/system/backup.htm b/modules/niu/luasrc/view/niu/system/backup.htm deleted file mode 100644 index 82b9314be..000000000 --- a/modules/niu/luasrc/view/niu/system/backup.htm +++ /dev/null @@ -1,41 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ - --%> -<%+header%> -<h2><a id="content" name="content"><%:System%></a></h2> -<h3><%:Backup / Restore%></h3> -<p><%:Here you can backup and restore your configuration and - if possible - reset this device to the default settings.%></p> -<br /> -<div> - <ul> - <li><a href="<%=REQUEST_URI%>?backup=kthxbye"><%:Create backup%></a></li> - <% if reset_avail then -%> - <li><a href="<%=REQUEST_URI%>?reset=yarly" onclick="return confirm('<%:Proceed reverting all settings and resetting to firmware defaults?%>')"><%:Reset to defaults%></a></li> - <% end -%> - </ul> -</div> - -<br /> - -<form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data"> - <div class="left"><%:Backup Archive%>:</div> - <div> - <input type="file" size="30" name="archive" /> - </div> - <div> - <input type="submit" name="cancel" class="cbi-button cbi-input-cancel" value="<%:Cancel%>" /> - <input type="submit" class="cbi-button cbi-input-apply" value="<%:Restore backup%>" /> - </div> -</form> -<%+footer%> diff --git a/modules/niu/luasrc/view/niu/system/reboot.htm b/modules/niu/luasrc/view/niu/system/reboot.htm deleted file mode 100644 index 4b356d61e..000000000 --- a/modules/niu/luasrc/view/niu/system/reboot.htm +++ /dev/null @@ -1,14 +0,0 @@ -Rebooting. Please wait... - -<script type="text/javascript"> -window.setInterval(function() { - var xmlHttp = new XMLHttpRequest(); - xmlHttp.open('GET', '/', true); - xmlHttp.onreadystatechange = function () { - if (xmlHttp.readyState == 4 && req.status >= 200 && req.status < 400) { - window.location = "/"; - } - }; - xmlHttp.send(null); -}, 10000); -</script>
\ No newline at end of file diff --git a/modules/niu/luasrc/view/niu/system/upgrade.htm b/modules/niu/luasrc/view/niu/system/upgrade.htm deleted file mode 100644 index 1083a1618..000000000 --- a/modules/niu/luasrc/view/niu/system/upgrade.htm +++ /dev/null @@ -1,105 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth <steven@midlink.org> -Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ - --%> - -<%+header%> - -<h2><a id="content" name="content"><%:System%></a></h2> -<h3><%:Flash Firmware%></h3> - -<% if step == 1 then %> - <% if supported then %> - <form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data"> - <p> - <%:Upload an OpenWrt image file to reflash the device.%> - <% if bad_image then %> - <br /><br /> - <div class="error"><%:The uploaded image file does not - contain a supported format. Make sure that you choose the generic - image format for your platform. %></div> - <% end %> - </p> - <div> - <%:Firmware image%>:<br /> - <input type="hidden" name="step" value="2" /> - <input type="file" size="30" name="image" /> - <br /> - <br /> - <% if keepavail then -%> - <input type="checkbox" name="keepcfg" value="1" checked="checked" /> - <span class="bold"><%:Keep configuration files%></span> - <% end -%> - - <br /> - <input class="cbi-button cbi-button-apply" type="submit" value="<%:Upload image%>" /> - </div> - </form> - <% else %> - <div class="error"><%_ Sorry. - OpenWrt does not support a system upgrade on this platform.<br /> - You need to manually flash your device. %></div> - <% end %> -<% elseif step == 2 then %> - <p> - <%_ The flash image was uploaded. - Below is the checksum and file size listed, - compare them with the original file to ensure data integrity.<br /> - Click "Proceed" below to start the flash procedure. %> - - <% if flashsize > 0 and filesize > flashsize then %> - <br /><br /> - <div class="error"><%:It appears that you try to - flash an image that does not fit into the flash memory, please verify - the image file! %></div> - <% end %> - - <br /> - <ul> - <li><%:Checksum%>: <code><%=checksum%></code></li> - <li><%:Size%>: <% - local w = require "luci.tools.webadmin" - write(w.byte_format(filesize)) - - if flashsize > 0 then - write(luci.i18n.translatef( - " (%s available)", - w.byte_format(flashsize) - )) - end - %></li> - </ul> - </p> - <div class="cbi-page-actions right"> - <form style="display:inline"> - <input type="hidden" name="step" value="3" /> - <input type="hidden" name="keepcfg" value="<%=keepconfig and "1" or "0"%>" /> - <input class="cbi-button cbi-button-apply" type="submit" value="<%:Proceed%>" /> - </form> - <form style="display:inline"> - <input type="hidden" name="step" value="1" /> - <input type="hidden" name="keepcfg" value="<%=keepconfig and "1" or "0"%>" /> - <input class="cbi-button cbi-button-reset" type="submit" value="<%:Cancel%>" /> - </form> - </div> -<% elseif step == 3 then %> - <p><%_ The system is flashing now.<br /> - DO NOT POWER OFF THE DEVICE!<br /> - Wait a few minutes until you try to reconnect. - It might be necessary to renew the address of your computer to reach the device - again, depending on your settings. %></p> - - <iframe src="<%=REQUEST_URI%>?step=4&keepcfg=<%=keepconfig and "1" or "0"%>" style="border:1px solid black; width:100%; height:150px"></iframe> -<% end %> -<%+footer%> - diff --git a/modules/niu/luasrc/view/niu/traffic.htm b/modules/niu/luasrc/view/niu/traffic.htm deleted file mode 100644 index 97a18a151..000000000 --- a/modules/niu/luasrc/view/niu/traffic.htm +++ /dev/null @@ -1,58 +0,0 @@ -<% -local uci = require "luci.model.uci" -local fs = require "nixio.fs" - -local wanon = uci.inst_state:get("network", "wan", "up") == "1" -local wanif = wanon and uci.inst_state:get("network", "wan", "ifname") -local lanif = uci.inst_state:get("network", "lan", "ifname") -local wanul, wandl, lanul, landl -local devstats = fs.readfile("/proc/net/dev") - -local fwav = fs.access("/etc/config/firewall", "r") -local fwon = uci.inst_state:get("firewall", "core", "loaded") == "1" - -if lanif then - local rx, tx = devstats:match("%s*"..lanif.. - ":%s*([0-9]+)%s+[0-9]+%s+[0-9]+%s+[0-9]+%s+".. - "[0-9]+%s+[0-9]+%s+[0-9]+%s+[0-9]+%s+([0-9]+)") - lanul = tx and (tonumber(tx) / 1000000000) - landl = rx and (tonumber(rx) / 1000000000) -end - -if wanif then - local rx, tx = devstats:match("%s*"..wanif.. - ":%s*([0-9]+)%s+[0-9]+%s+[0-9]+%s+[0-9]+%s+".. - "[0-9]+%s+[0-9]+%s+[0-9]+%s+[0-9]+%s+([0-9]+)") - wanul = tx and (tonumber(tx) / 1000000000) - wandl = rx and (tonumber(rx) / 1000000000) -end - -%> - -<table class="dbstattbl"> -<% if wanul and wandl then %> -<tr> -<th>Uplink Traffic: </th><td> -<%=("%.2f"):format(wandl)%> GB⇓ <%=("%.2f"):format(wanul)%> GB⇑ -</td> -</tr> -<% end %> - -<% if lanul and landl then %> -<tr> -<th>Local Traffic: </th><td> -<%=("%.2f"):format(landl)%> GB⇓ <%=("%.2f"):format(lanul)%> GB⇑ -</td> -</tr> -<% end %> - -<% if fwav then %> -<tr> -<th>Firewall: </th><td> -<%=fwon and translate("active") or translate("inactive")%> -</td> -</tr> -<% end %> - -</table> -<br />
\ No newline at end of file diff --git a/modules/niu/luasrc/view/niu/traffic/conntrack.htm b/modules/niu/luasrc/view/niu/traffic/conntrack.htm deleted file mode 100644 index 09b1d6b1c..000000000 --- a/modules/niu/luasrc/view/niu/traffic/conntrack.htm +++ /dev/null @@ -1,75 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008-2009 Steven Barth <steven@midlink.org> -Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal.org> - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ - --%> - -<%- - local sys = require "luci.sys" - local style = true --%> - -<%+header%> - -<div class="cbi-map" id="cbi-conntrack"> - <h2><a id="content" name="content"><%:Active Connections%></a></h2> - <div class="cbi-map-descr"><%:This page gives an overview over currently active network connections.%></div> - - <fieldset class="cbi-section" id="cbi-table-table"> - <legend>ARP</legend> - <div class="cbi-section-node"> - <table class="cbi-section-table"> - <tr class="cbi-section-table-titles"> - <th class="cbi-section-table-cell"><%_<abbr title="Internet Protocol Version 4">IPv4</abbr>-Address%></th> - <th class="cbi-section-table-cell"><%_<abbr title="Media Access Control">MAC</abbr>-Address%></th> - <th class="cbi-section-table-cell"><%:Interface%></th> - </tr> - - <% sys.net.arptable(function(e) %> - <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>"> - <td class="cbi-value-field"><%=e["IP address"]%></td> - <td class="cbi-value-field"><%=e["HW address"]%></td> - <td class="cbi-value-field"><%=e["Device"]%></td> - </tr> - <% style = not style; end) %> - </table> - </div> - </fieldset> - <br /> - - <fieldset class="cbi-section" id="cbi-table-table"> - <legend><%:Active Connections%></legend> - <div class="cbi-section-node"> - <table class="cbi-section-table"> - <tr class="cbi-section-table-titles"> - <th class="cbi-section-table-cell"><%:Network%></th> - <th class="cbi-section-table-cell"><%:Protocol%></th> - <th class="cbi-section-table-cell"><%:Source%></th> - <th class="cbi-section-table-cell"><%:Destination%></th> - </tr> - - <% style = true; sys.net.conntrack(function(c) %> - <tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>"> - <td class="cbi-value-field"><%=c.layer3:upper()%></td> - <td class="cbi-value-field"><%=c.layer4:upper()%></td> - <td class="cbi-value-field"><%=c.src%></td> - <td class="cbi-value-field"><%=c.dst%></td> - </tr> - <% style = not style; end) %> - </table> - </div> - </fieldset> - <br /> -</div> - -<%+footer%> - diff --git a/modules/niu/root/etc/uci-defaults/luci-niu-firstrun b/modules/niu/root/etc/uci-defaults/luci-niu-firstrun deleted file mode 100644 index 3462a38ee..000000000 --- a/modules/niu/root/etc/uci-defaults/luci-niu-firstrun +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# Disable some services by default - -uci get luci.main._niuinit && exit 0 -uci set qos.wan.enabled=0 -uci set upnpd.config.external_iface=none -uci set luci.main._niuinit=1
\ No newline at end of file |