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
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
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
-<%- 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 = '';
}
}