luci-app-vpnbypass: remove explicit libuci requirement
[project/luci.git] / applications / luci-app-vpnbypass / luasrc / model / cbi / vpnbypass.lua
index bb27b63..6545154 100644 (file)
@@ -4,19 +4,11 @@ m = Map("vpnbypass", translate("VPN Bypass Settings"))
 s = m:section(NamedSection, "config", "vpnbypass")
 
 -- General options
-e = s:option(Flag, "enabled", translate("Enable/start service"))
+e = s:option(Flag, "enabled", translate("Start VPNBypass service"))
 e.rmempty = false
-
-function e.cfgvalue(self, section)
-       return self.map:get(section, "enabled") == "1" and luci.sys.init.enabled("vpnbypass") and self.enabled or self.disabled
-end
-
 function e.write(self, section, value)
-       if value == "1" then
-               luci.sys.call("/etc/init.d/vpnbypass enable >/dev/null")
-               luci.sys.call("/etc/init.d/vpnbypass start >/dev/null")
-       else
-               luci.sys.call("/etc/init.d/vpnbypass stop >/dev/null")
+       if value ~= "1" then
+               luci.sys.init.stop("vpnbypass")
        end
        return Flag.write(self, section, value)
 end
@@ -38,7 +30,7 @@ p2.optional = false
 -- Local Subnets
 r1 = s:option(DynamicList, "localsubnet", translate("Local IP Addresses to Bypass"), translate("Local IP addresses or subnets with direct internet access (outside of the VPN tunnel)"))
 r1.datatype    = "ip4addr"
--- r1.placeholder = luci.ip.new(uci.cursor():get("network", "lan", "ipaddr") .. "/" .. uci.cursor():get("network", "lan", "netmask"))
+-- r1.placeholder = luci.ip.new(m.uci:get("network", "lan", "ipaddr"), m.uci:get("network", "lan", "netmask"))
 r1.addremove = false
 r1.optional = false