summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-multiwan/luasrc/controller
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-12-03 15:17:05 +0100
committerJo-Philipp Wich <jow@openwrt.org>2015-01-08 16:26:20 +0100
commit1bb4822dca6113f73e3bc89e2acf15935e6f8e92 (patch)
tree35e16f100466e4e00657199b38bb3d87d52bf73f /applications/luci-multiwan/luasrc/controller
parent9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4 (diff)
Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names * Make each LuCI module its own standalone package * Deploy a shared luci.mk which is used by each module Makefile Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'applications/luci-multiwan/luasrc/controller')
-rw-r--r--applications/luci-multiwan/luasrc/controller/multiwan.lua60
1 files changed, 0 insertions, 60 deletions
diff --git a/applications/luci-multiwan/luasrc/controller/multiwan.lua b/applications/luci-multiwan/luasrc/controller/multiwan.lua
deleted file mode 100644
index b596ef7e3..000000000
--- a/applications/luci-multiwan/luasrc/controller/multiwan.lua
+++ /dev/null
@@ -1,60 +0,0 @@
-module("luci.controller.multiwan", package.seeall)
-
-function index()
- local fs = luci.fs or nixio.fs
- if not fs.access("/etc/config/multiwan") then
- return
- end
-
- local page
-
- page = entry({"admin", "network", "multiwan"}, cbi("multiwan/multiwan"), _("Multi-WAN"))
- page.dependent = true
-
- entry({"admin", "network", "multiwan", "status"}, call("multiwan_status"))
-
- page = entry({"mini", "network", "multiwan"}, cbi("multiwan/multiwanmini", {autoapply=true}), _("Multi-WAN"))
- page.dependent = true
-end
-function multiwan_status()
- local nfs = require "nixio.fs"
- local cachefile = "/tmp/.mwan/cache"
-
- local rv = { }
-
- cachefile = nfs.readfile(cachefile)
- if cachefile then
- local ntm = require "luci.model.network".init()
- _, _, wan_if_map = string.find(cachefile, "wan_if_map=\"([^\"]*)\"")
- _, _, wan_fail_map = string.find(cachefile, "wan_fail_map=\"([^\"]*)\"")
- _, _, wan_recovery_map = string.find(cachefile, "wan_recovery_map=\"([^\"]*)\"")
-
- rv.wans = { }
- wansid = {}
-
- for wanname, wanifname in string.gfind(wan_if_map, "([^%[]+)%[([^%]]+)%]") do
- local wanlink = ntm:get_interface(wanifname)
- wanlink = wanlink and wanlink:get_network()
- wanlink = wanlink and wanlink:adminlink() or "#"
- wansid[wanname] = #rv.wans + 1
- rv.wans[wansid[wanname]] = { name = wanname, link = wanlink, ifname = wanifname, status = "ok", count = 0 }
- end
-
- for wanname, failcount in string.gfind(wan_fail_map, "([^%[]+)%[([^%]]+)%]") do
- if failcount == "x" then
- rv.wans[wansid[wanname]].status = "ko"
- else
- rv.wans[wansid[wanname]].status = "failing"
- rv.wans[wansid[wanname]].count = failcount
- end
- end
-
- for wanname, recoverycount in string.gfind(wan_recovery_map, "([^%[]+)%[([^%]]+)%]") do
- rv.wans[wansid[wanname]].status = "recovering"
- rv.wans[wansid[wanname]].count = recoverycount
- end
- end
-
- luci.http.prepare_content("application/json")
- luci.http.write_json(rv)
-end