mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add LuCI interface to bypass hosts
This commit is contained in:
parent
1a6ce527be
commit
0a1b3f2f97
7 changed files with 116 additions and 0 deletions
27
luci-app-omr-bypass/luasrc/controller/omr-bypass.lua
Normal file
27
luci-app-omr-bypass/luasrc/controller/omr-bypass.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
local ucic = uci.cursor()
|
||||
module("luci.controller.omr-bypass", package.seeall)
|
||||
|
||||
function index()
|
||||
entry({"admin", "services", "omr-bypass"}, alias("admin", "services", "omr-bypass", "index"), _("OMR-Bypass"))
|
||||
entry({"admin", "services", "omr-bypass", "index"}, template("omr-bypass/bypass"))
|
||||
entry({"admin", "services", "omr-bypass", "add"}, post("bypass_add"))
|
||||
end
|
||||
|
||||
function bypass_add()
|
||||
local hosts = luci.http.formvalue("cbid.omr-bypass.hosts")
|
||||
if (type(hosts) ~= "table") then
|
||||
hosts = {hosts}
|
||||
end
|
||||
local ipset = ""
|
||||
for _, k in pairs(hosts) do
|
||||
if k ~= "" then
|
||||
ipset = ipset .. '/' .. k
|
||||
end
|
||||
end
|
||||
ucic:set_list("dhcp",ucic:get_first("dhcp","dnsmasq"),"ipset",ipset .. "/ss_rules_dst_bypass")
|
||||
ucic:save("dhcp")
|
||||
ucic:commit("dhcp")
|
||||
luci.sys.exec("/etc/init.d/dnsmasq restart")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin/services/omr-bypass"))
|
||||
return
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue