luci-app-vpnbypass: use VPN node by default 3329/head
authorStan Grishin <stangri@melmac.net>
Mon, 18 Nov 2019 23:01:58 +0000 (16:01 -0700)
committerStan Grishin <stangri@melmac.net>
Mon, 18 Nov 2019 23:01:58 +0000 (16:01 -0700)
Signed-off-by: Stan Grishin <stangri@melmac.net>
applications/luci-app-vpnbypass/Makefile
applications/luci-app-vpnbypass/luasrc/controller/vpnbypass.lua
applications/luci-app-vpnbypass/luasrc/model/cbi/vpnbypass.lua
applications/luci-app-vpnbypass/luasrc/view/vpnbypass/buttons.htm
applications/luci-app-vpnbypass/luasrc/view/vpnbypass/js.htm
applications/luci-app-vpnbypass/luasrc/view/vpnbypass/status-textarea.htm

index cddcf8536307d5cbf92748ebcf4cd5da0b1c0137..14425ce98f57e2dbf3743457e41c7f2d0b6a9547 100644 (file)
@@ -10,7 +10,7 @@ LUCI_TITLE:=VPN Bypass Web UI
 LUCI_DESCRIPTION:=Provides Web UI for VPNBypass service.
 LUCI_DEPENDS:=+luci-compat +luci-mod-admin-full +vpnbypass
 LUCI_PKGARCH:=all
-PKG_RELEASE:=13
+PKG_RELEASE:=14
 
 include ../../luci.mk
 
index dac02d84d629f440f6e50e791a4297002353ffcd..c971ce65174492497e6af3327f1d78cb1104c4f0 100644 (file)
@@ -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
 
index 08054dc484243b4a5d91137cd5bbb9ab7a96b5d4..8aa222709c85cd03601332146aa9764fc2d2fb7b 100644 (file)
@@ -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
index 9f79b9b779fdebdd1aa8099654d4c1095aec1f9b..baabb8f2a7f855b75b328b232da571ebb3c51d45 100644 (file)
@@ -1,5 +1,5 @@
 <%#
-  Copyright 2019 Stan Grishin <stangri@melmac.net>
+       Copyright 2019 Stan Grishin <stangri@melmac.net>
 -%>
 
 <%-
index 8e47a97590ee3431f9c29496f2a06f73bf731b94..e8c076f50e39356e6a06f02ff1430d7455fba4cb 100644 (file)
@@ -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":
        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 = '';
        }
 }
index 75243e3950432e0d0a2aa5d79b38267dcfc4feb4..4ab2e112917428bcf1c7b647701c596c81752a32 100644 (file)
@@ -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%>