diff options
Diffstat (limited to 'applications/luci-app-vpn-policy-routing/luasrc')
5 files changed, 51 insertions, 38 deletions
diff --git a/applications/luci-app-vpn-policy-routing/luasrc/model/cbi/vpn-policy-routing.lua b/applications/luci-app-vpn-policy-routing/luasrc/model/cbi/vpn-policy-routing.lua index 61c16b1efb..8be8df7b96 100644 --- a/applications/luci-app-vpn-policy-routing/luasrc/model/cbi/vpn-policy-routing.lua +++ b/applications/luci-app-vpn-policy-routing/luasrc/model/cbi/vpn-policy-routing.lua @@ -1,6 +1,5 @@ -local readmeURL = "https://github.com/openwrt/packages/tree/master/net/vpn-policy-routing/files/README.md" - local packageName = "vpn-policy-routing" +local readmeURL = "https://docs.openwrt.melmac.net/" .. packageName .. "/" local uci = require "luci.model.uci".cursor() local sys = require "luci.sys" local util = require "luci.util" @@ -133,7 +132,7 @@ m = Map("vpn-policy-routing", translate("VPN and WAN Policy-Based Routing")) h = m:section(NamedSection, "config", packageName, translatef("Service Status [%s %s]", packageName, packageVersion)) status = h:option(DummyValue, "_dummy", translate("Service Status")) -status.template = "vpn-policy-routing/status" +status.template = "vpn-policy-routing/status-service" status.value = statusText if serviceRunning and serviceGateways and serviceGateways ~= "" then gateways = h:option(DummyValue, "_dummy", translate("Service Gateways")) @@ -142,12 +141,12 @@ if serviceRunning and serviceGateways and serviceGateways ~= "" then end if serviceErrors and serviceErrors ~= "" then errors = h:option(DummyValue, "_dummy", translate("Service Errors")) - errors.template = packageName .. "/status-textarea" + errors.template = packageName .. "/status" errors.value = serviceErrors end if serviceWarnings and serviceWarnings ~= "" then warnings = h:option(DummyValue, "_dummy", translate("Service Warnings")) - warnings.template = packageName .. "/status-textarea" + warnings.template = packageName .. "/status" warnings.value = serviceWarnings end if packageVersion ~= "" then @@ -175,18 +174,11 @@ se:value("0", translate("Do not enforce policies when their gateway is down")) se:value("1", translate("Strictly enforce policies when their gateway is down")) se.default = 1 -dest_ipset = config:taboption("basic", ListValue, "dest_ipset", translate("The ipset option for remote policies"), - translatef("Please check the %sREADME%s before changing this option.", "<a href=\"" .. readmeURL .. "#service-configuration-settings" .. "\" target=\"_blank\">", "</a>")) -dest_ipset:value("", translate("Disabled")) -dest_ipset:value("ipset", translate("Use ipset command")) -dest_ipset:value("dnsmasq.ipset", translate("Use DNSMASQ ipset")) -dest_ipset.default = "" -dest_ipset.rmempty = true - -src_ipset = config:taboption("basic", ListValue, "src_ipset", translate("The ipset option for local policies"), +resolver_ipset = config:taboption("basic", ListValue, "resolver_ipset", translate("Use resolver's ipset for domains"), translatef("Please check the %sREADME%s before changing this option.", "<a href=\"" .. readmeURL .. "#service-configuration-settings" .. "\" target=\"_blank\">", "</a>")) -src_ipset:value("0", translate("Disabled")) -src_ipset:value("1", translate("Use ipset command")) +resolver_ipset:value("none", translate("Disabled")) +resolver_ipset:value("dnsmasq.ipset", translate("DNSMASQ ipset")) +resolver_ipset.default = "dnsmasq.ipset" ipv6 = config:taboption("basic", ListValue, "ipv6_enabled", translate("IPv6 Support")) ipv6:value("0", translate("Disabled")) @@ -206,15 +198,23 @@ timeout = config:taboption("advanced", Value, "boot_timeout", translate("Boot Ti timeout.optional = false timeout.rmempty = true +dest_ipset = config:taboption("advanced", ListValue, "dest_ipset", translate("The ipset option for remote policies"), + translatef("Please check the %sREADME%s before changing this option.", "<a href=\"" .. readmeURL .. "#service-configuration-settings" .. "\" target=\"_blank\">", "</a>")) +dest_ipset:value("0", translate("Disabled")) +dest_ipset:value("1", translate("Use ipset command")) +dest_ipset.default = "0" + +src_ipset = config:taboption("advanced", ListValue, "src_ipset", translate("The ipset option for local policies"), + translatef("Please check the %sREADME%s before changing this option.", "<a href=\"" .. readmeURL .. "#service-configuration-settings" .. "\" target=\"_blank\">", "</a>")) +src_ipset:value("0", translate("Disabled")) +src_ipset:value("1", translate("Use ipset command")) +src_ipset.default = "0" + insert = config:taboption("advanced", ListValue, "iptables_rule_option", translate("IPTables rule option"), translate("Select Append for -A and Insert for -I.")) insert:value("append", translate("Append")) insert:value("insert", translate("Insert")) insert.default = "append" -iprule = config:taboption("advanced", ListValue, "iprule_enabled", translate("IP Rules Support"), translate("Add an ip rule, not an iptables entry for policies with just the local address. Use with caution to manipulte policies priorities.")) -iprule:value("0", translate("Disabled")) -iprule:value("1", translate("Enabled")) - icmp = config:taboption("advanced", ListValue, "icmp_interface", translate("Default ICMP Interface"), translate("Force the ICMP protocol interface.")) icmp:value("", translate("No Change")) icmp:value("wan", translate("WAN")) @@ -224,12 +224,6 @@ uci:foreach("network", "interface", function(s) end) icmp.rmempty = true -append_local = config:taboption("advanced", Value, "append_src_rules", translate("Append local IP Tables rules"), translate("Special instructions to append iptables rules for local IPs/netmasks/devices.")) -append_local.rmempty = true - -append_remote = config:taboption("advanced", Value, "append_dest_rules", translate("Append remote IP Tables rules"), translate("Special instructions to append iptables rules for remote IPs/netmasks.")) -append_remote.rmempty = true - wantid = config:taboption("advanced", Value, "wan_tid", translate("WAN Table ID"), translate("Starting (WAN) Table ID number for tables created by the service.")) wantid.rmempty = true wantid.placeholder = "201" @@ -262,12 +256,15 @@ webui_chain_column = config:taboption("webui", ListValue, "webui_chain_column", webui_chain_column:value("0", translate("Disabled")) webui_chain_column:value("1", translate("Enabled")) +webui_show_ignore_target = config:taboption("webui", ListValue, "webui_show_ignore_target", translate("Add IGNORE Target"), translate("Adds `IGNORE` to the list of interfaces for policies, allowing you to skip further processing by VPN Policy Routing.")) +webui_show_ignore_target:value("0", translate("Disabled")) +webui_show_ignore_target:value("1", translate("Enabled")) + webui_sorting = config:taboption("webui", ListValue, "webui_sorting", translate("Show Up/Down Buttons"), translate("Shows the Up/Down buttons for policies, allowing you to move a policy up or down in the list.")) webui_sorting:value("0", translate("Disabled")) webui_sorting:value("1", translate("Enabled")) webui_sorting.default = "1" - -- Policies p = m:section(TypedSection, "policy", translate("Policies"), translate("Comment, interface and at least one other field are required. Multiple local and remote addresses/devices/domains and ports can be space separated. Placeholders below represent just the format/syntax and will not be used if fields are left blank.")) p.template = "cbi/tblsection" @@ -356,6 +353,10 @@ uci:foreach("network", "interface", function(s) gw:value(name, name:upper()) end end) +enc = tonumber(uci:get("vpn-policy-routing", "config", "webui_show_ignore_target")) +if enc and enc ~= 0 then + gw:value("ignore", "IGNORE") +end dscp = m:section(NamedSection, "config", "vpn-policy-routing", translate("DSCP Tagging"), translatef("Set DSCP tags (in range between 1 and 63) for specific interfaces. See the %sREADME%s for details.", "<a href=\"" .. readmeURL .. "#dscp-tag-based-policies" .. "\" target=\"_blank\">", "</a>")) diff --git a/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/buttons.htm b/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/buttons.htm index 37a0b9a414..b1ec6fbf97 100644 --- a/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/buttons.htm +++ b/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/buttons.htm @@ -5,11 +5,13 @@ <%- local packageName = "vpn-policy-routing" + local uci = require "luci.model.uci".cursor() + local sys = require "luci.sys" local serviceRunning, serviceEnabled = false, false; - if luci.sys.call("iptables -t mangle -L | grep -q VPR_PREROUTING") == 0 then + if sys.call("iptables -t mangle -L | grep -q VPR_PREROUTING") == 0 then serviceRunning = true end - if luci.model.uci.cursor():get(packageName, "config", "enabled") == "1" then + if uci:get(packageName, "config", "enabled") == "1" then serviceEnabled = true end @@ -38,23 +40,23 @@ <div class="cbi-value"><label class="cbi-value-title">Service Control</label> <div class="cbi-value-field"> - <input type="button" class="cbi-button cbi-button-apply" id="btn_start" name="start" value="<%:Start%>" + <input type="button" class="btn cbi-button cbi-button-apply" id="btn_start" name="start" value="<%:Start%>" onclick="button_action(this)" /> <span id="btn_start_spinner" class="btn_spinner"></span> - <input type="button" class="cbi-button cbi-button-apply" id="btn_action" name="action" value="<%:Restart%>" + <input type="button" class="btn cbi-button cbi-button-apply" id="btn_action" name="action" value="<%:Restart%>" onclick="button_action(this)" /> <span id="btn_action_spinner" class="btn_spinner"></span> - <input type="button" class="cbi-button cbi-button-reset" id="btn_stop" name="stop" value="<%:Stop%>" + <input type="button" class="btn cbi-button cbi-button-reset" id="btn_stop" name="stop" value="<%:Stop%>" onclick="button_action(this)" /> <span id="btn_stop_spinner" class="btn_spinner"></span> - <input type="button" class="cbi-button cbi-button-apply" id="btn_enable" name="enable" value="<%:Enable%>" + <input type="button" class="btn cbi-button cbi-button-apply" id="btn_enable" name="enable" value="<%:Enable%>" onclick="button_action(this)" /> <span id="btn_enable_spinner" class="btn_spinner"></span> - <input type="button" class="cbi-button cbi-button-reset" id="btn_disable" name="disable" value="<%:Disable%>" + <input type="button" class="btn cbi-button cbi-button-reset" id="btn_disable" name="disable" value="<%:Disable%>" onclick="button_action(this)" /> <span id="btn_disable_spinner" class="btn_spinner"></span> </div> diff --git a/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/status-gateways.htm b/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/status-gateways.htm index 4f77906982..65f3e5d7c6 100644 --- a/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/status-gateways.htm +++ b/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/status-gateways.htm @@ -11,8 +11,8 @@ This is free software, licensed under the Apache License, Version 2.0 </textarea> <div> - <%- local readmeURL = "https://github.com/openwrt/packages/tree/master/net/vpn-policy-routing/files/README.md" -%> - <%=translatef("The %s represents the default gateway. See the %sREADME%s for details.", "<strong>✓</strong>", "<a href=\"" .. readmeURL .. "#a-word-about-default-routing" .. "\" target=\"_blank\">", "</a>")%> + <%- local readmeURL = "https://docs.openwrt.melmac.net/vpn-policy-routing/" -%> + <%=translatef("The %s indicates default gateway. See the %sREADME%s for details.", "<strong>✓</strong>", "<a href=\"" .. readmeURL .. "#a-word-about-default-routing" .. "\" target=\"_blank\">", "</a>")%> </div> <%+cbi/valuefooter%>
\ No newline at end of file diff --git a/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/status-service.htm b/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/status-service.htm new file mode 100644 index 0000000000..c453428405 --- /dev/null +++ b/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/status-service.htm @@ -0,0 +1,10 @@ +<%# +Copyright 2017-2018 Dirk Brenken (dev@brenken.org) +This is free software, licensed under the Apache License, Version 2.0 +-%> + +<%+cbi/valueheader%> + +<input name="status" id="status" type="text" class="cbi-input-text" style="outline:none;border:none;box-shadow:none;background:transparent;font-weight:bold;line-height:30px;height:30px;width:50em;" value="<%=self:cfgvalue(section)%>" disabled="disabled" /> + +<%+cbi/valuefooter%> diff --git a/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/status.htm b/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/status.htm index c453428405..e74206853a 100644 --- a/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/status.htm +++ b/applications/luci-app-vpn-policy-routing/luasrc/view/vpn-policy-routing/status.htm @@ -1,10 +1,10 @@ <%# -Copyright 2017-2018 Dirk Brenken (dev@brenken.org) +Copyright 2017-2019 Stan Grishin (stangri@melmac.net) This is free software, licensed under the Apache License, Version 2.0 -%> <%+cbi/valueheader%> -<input name="status" id="status" type="text" class="cbi-input-text" style="outline:none;border:none;box-shadow:none;background:transparent;font-weight:bold;line-height:30px;height:30px;width:50em;" value="<%=self:cfgvalue(section)%>" disabled="disabled" /> +<%=self:cfgvalue(section):gsub('\n', '<br/>' )%> <%+cbi/valuefooter%> |