diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl.lua index 26a07ac3b..1eb1ac542 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl.lua @@ -46,7 +46,7 @@ o = s:option(DummyValue, "sources", translate("Source")) o.rawhtml = true o.cfgvalue = function(t, n) local e = '' - local v = Value.cfgvalue(t, n) or '' + local v = Value.cfgvalue(t, n) or '-' string.gsub(v, '[^' .. " " .. ']+', function(w) local a = w if mac_t[w] then @@ -60,4 +60,10 @@ o.cfgvalue = function(t, n) return e end +i = s:option(DummyValue, "interface", translate("Source Interface")) +i.cfgvalue = function(t, n) + local v = Value.cfgvalue(t, n) or '-' + return v +end + return m diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl_config.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl_config.lua index e6c9730c8..2bb7a96d5 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl_config.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl_config.lua @@ -70,6 +70,11 @@ o = s:option(Value, "remarks", translate("Remarks")) o.default = arg[1] o.rmempty = true +use_if = s:option(Flag, "use_interface", translate("Use Interface With ACLs")) +use_if.default = 0 +use_if.rmempty = false + + local mac_t = {} sys.net.mac_hints(function(e, t) mac_t[#mac_t + 1] = { @@ -90,6 +95,17 @@ table.sort(mac_t, function(a,b) return false end) +local device_list = {} +device_list = sys.net.devices() +table.sort(device_list) +interface = s:option(ListValue, "interface", translate("Source Interface")) + +for k, name in ipairs(device_list) do + interface:value(name) +end + +interface:depends({ use_interface = 1 }) + ---- Source sources = s:option(DynamicList, "sources", translate("Source")) sources.description = "