diff options
author | Stan Grishin <stangri@melmac.net> | 2019-11-18 16:01:58 -0700 |
---|---|---|
committer | Stan Grishin <stangri@melmac.net> | 2019-11-18 16:01:58 -0700 |
commit | 5a730115856ac8ae4461f402da39b0c05321b712 (patch) | |
tree | 8a2bc2c9cbaed96006931cd6b8fd63fd74415296 /applications/luci-app-vpnbypass/luasrc | |
parent | b1cb0d6d59c84a16f084e8ec91714a3d247a2700 (diff) |
luci-app-vpnbypass: use VPN node by default
Signed-off-by: Stan Grishin <stangri@melmac.net>
Diffstat (limited to 'applications/luci-app-vpnbypass/luasrc')
5 files changed, 28 insertions, 32 deletions
diff --git a/applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua b/applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua index dac02d84d..c971ce651 100644 --- a/applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua +++ b/applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua @@ -1,10 +1,8 @@ module("luci.controller.vpnbypass", package.seeall) function index() if nixio.fs.access("/etc/config/vpnbypass") then - local node = "services" - if luci.dispatcher.lookup("admin/vpn") then node = "vpn" end - entry({"admin", node, "vpnbypass"}, cbi("vpnbypass"), _("VPN Bypass")) - entry({"admin", node, "vpnbypass", "action"}, call("vpnbypass_action"), nil).leaf = true + entry({"admin", "vpn", "vpnbypass"}, cbi("vpnbypass"), _("VPN Bypass")) + entry({"admin", "vpn", "vpnbypass", "action"}, call("vpnbypass_action"), nil).leaf = true end end diff --git a/applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua b/applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua index 08054dc48..8aa222709 100644 --- a/applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua +++ b/applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua @@ -6,11 +6,11 @@ local packageName = "vpnbypass" local tmpfsVersion = tostring(util.trim(sys.exec("opkg list-installed " .. packageName .. " | awk '{print $3}'"))) if not tmpfsVersion or tmpfsVersion == "" then - tmpfsStatusCode = -1 - tmpfsVersion = "" - tmpfsStatus = packageName .. " " .. translate("is not installed or not found") + tmpfsStatusCode = -1 + tmpfsVersion = "" + tmpfsStatus = packageName .. " " .. translate("is not installed or not found") else - tmpfsVersion = " [" .. packageName .. " " .. tmpfsVersion .. "]" + tmpfsVersion = " [" .. packageName .. " " .. tmpfsVersion .. "]" end local tmpfsStatus = "Stopped" if sys.call("iptables -t mangle -L | grep -q VPNBYPASS") == 0 then @@ -60,9 +60,9 @@ d = Map("dhcp") s4 = d:section(TypedSection, "dnsmasq") s4.anonymous = true di = s4:option(DynamicList, "ipset", translate("Domains to Bypass"), - translate("Domains to be accessed directly (outside of the VPN tunnel), see ") + translate("Domains to be accessed directly (outside of the VPN tunnel), see ") .. [[<a href="]] .. readmeURL .. [[#bypass-domains-formatsyntax" target="_blank">]] - .. translate("README") .. [[</a> ]] .. translate("for syntax")) + .. translate("README") .. [[</a> ]] .. translate("for syntax")) function d.on_after_commit(map) util.exec("/etc/init.d/dnsmasq restart >/dev/null 2>&1") end diff --git a/applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm b/applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm index 9f79b9b77..baabb8f2a 100644 --- a/applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm +++ b/applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm @@ -1,5 +1,5 @@ <%# - Copyright 2019 Stan Grishin <stangri@melmac.net> + Copyright 2019 Stan Grishin <stangri@melmac.net> -%> <%- diff --git a/applications/luci-app-vpnbypass/luasrc/view/vpnbypass/js.htm b/applications/luci-app-vpnbypass/luasrc/view/vpnbypass/js.htm index 8e47a9759..e8c076f50 100644 --- a/applications/luci-app-vpnbypass/luasrc/view/vpnbypass/js.htm +++ b/applications/luci-app-vpnbypass/luasrc/view/vpnbypass/js.htm @@ -1,14 +1,12 @@ -<%- if luci.dispatcher.lookup("admin/vpn") then node = "vpn" else node = "services" end -%> - <script type="text/javascript"> //<![CDATA[ function button_action(action) { - var xhr = new XHR(false); - var btn_start = document.getElementById("btn_start"); - var btn_action = document.getElementById("btn_action"); - var btn_stop = document.getElementById("btn_stop"); - var btn_enable = document.getElementById("btn_enable"); - var btn_disable = document.getElementById("btn_disable"); + var xhr = new XHR(false); + var btn_start = document.getElementById("btn_start"); + var btn_action = document.getElementById("btn_action"); + var btn_stop = document.getElementById("btn_stop"); + var btn_enable = document.getElementById("btn_enable"); + var btn_disable = document.getElementById("btn_disable"); var btn_spinner; switch (action.name) { case "start": @@ -32,28 +30,28 @@ btn_stop.disabled = true; btn_enable.disabled = true; btn_disable.disabled = true; - spinner(btn_spinner, 1); - xhr.get('<%=luci.dispatcher.build_url("admin", node, "vpnbypass", "action")%>/' + action.name, null, + spinner(btn_spinner, 1); + xhr.get('<%=luci.dispatcher.build_url("admin", "vpn", "vpnbypass", "action")%>/' + action.name, null, function (x) { if (!x) { return; } - btn_start.disabled = false; - btn_action.disabled = false; - btn_stop.disabled = false; - btn_enable.disabled = false; - btn_disable.disabled = false; + btn_start.disabled = false; + btn_action.disabled = false; + btn_stop.disabled = false; + btn_enable.disabled = false; + btn_disable.disabled = false; spinner(btn_spinner, 0); - location.reload(); - }); + location.reload(); + }); } function spinner(element, state) { if (state === 1) { - element.style.width = "16px"; + element.style.width = "16px"; element.innerHTML = '<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" width="16" height="16" style="vertical-align:middle" />'; } else { - element.style.width = "0px"; + element.style.width = "0px"; element.innerHTML = ''; } } diff --git a/applications/luci-app-vpnbypass/luasrc/view/vpnbypass/status-textarea.htm b/applications/luci-app-vpnbypass/luasrc/view/vpnbypass/status-textarea.htm index 75243e395..4ab2e1129 100644 --- a/applications/luci-app-vpnbypass/luasrc/view/vpnbypass/status-textarea.htm +++ b/applications/luci-app-vpnbypass/luasrc/view/vpnbypass/status-textarea.htm @@ -6,8 +6,8 @@ This is free software, licensed under the Apache License, Version 2.0 <%+cbi/valueheader%> <textarea rows="<%=select(2, self:cfgvalue(section):gsub('\n', '\n'))%>" - style="border:none;box-shadow:none;background:transparent;font-weight:bold;line-height:20px;width:50em;padding:none;margin:6px;resize:none;overflow:hidden;" - disabled="disabled"><%=self:cfgvalue(section):gsub('\n', '\n')%> + style="border:none;box-shadow:none;background:transparent;font-weight:bold;line-height:20px;width:50em;padding:none;margin:6px;resize:none;overflow:hidden;" + disabled="disabled"><%=self:cfgvalue(section):gsub('\n', '\n')%> </textarea> <%+cbi/valuefooter%> |