Skip to content

Commit

Permalink
luci app zerotier: path bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsnowwolf committed May 16, 2019
1 parent 0935c47 commit 2915c44
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 55 deletions.
2 changes: 1 addition & 1 deletion package/lean/luci-app-zerotier/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LUCI_TITLE:=LuCI for Zerotier
LUCI_DEPENDS:=+zerotier
LUCI_PKGARCH:=all
PKG_VERSION:=1.0
PKG_RELEASE:=13
PKG_RELEASE:=15

include $(TOPDIR)/feeds/luci/luci.mk

Expand Down
9 changes: 7 additions & 2 deletions package/lean/luci-app-zerotier/luasrc/controller/zerotier.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ return
end

entry({"admin","vpn"}, firstchild(), "VPN", 45).dependent = false
entry({"admin","vpn","zerotier"},cbi("zerotier"),_("ZeroTier"),90).dependent=true
entry({"admin","vpn","zerotier","status"},call("act_status")).leaf=true

entry({"admin", "vpn", "zerotier"},firstchild(), _("ZeroTier")).dependent = false

entry({"admin", "vpn", "zerotier", "general"},cbi("zerotier/settings"), _("Base Setting"), 1)
entry({"admin", "vpn", "zerotier", "log"},form("zerotier/info"), _("Interface Info"), 2)

entry({"admin","vpn","zerotier","status"},call("act_status"))
end

function act_status()
Expand Down
50 changes: 0 additions & 50 deletions package/lean/luci-app-zerotier/luasrc/model/cbi/zerotier.lua

This file was deleted.

15 changes: 15 additions & 0 deletions package/lean/luci-app-zerotier/luasrc/model/cbi/zerotier/info.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
local fs = require "nixio.fs"
local conffile = "/tmp/zero.info"

f = SimpleForm("logview")

t = f:field(TextValue, "conf")
t.rmempty = true
t.rows = 15
function t.cfgvalue()
luci.sys.exec("ifconfig $(ifconfig | grep zt | awk '{print $1}') > /tmp/zero.info")
return fs.readfile(conffile) or ""
end
t.readonly="readonly"

return f
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

a=Map("zerotier",translate("ZeroTier"),translate("Zerotier is an open source, cross-platform and easy to use virtual LAN"))
a:section(SimpleSection).template = "zerotier/zerotier_status"

t=a:section(NamedSection,"sample_config","zerotier")
t.anonymous=true
t.addremove=false

e=t:option(Flag,"enabled",translate("Enable"))
e.default=0
e.rmempty=false

e=t:option(DynamicList,"join",translate('ZeroTier Network ID'))
e.password=true
e.rmempty=false

e=t:option(Flag,"nat",translate("Auto NAT Clients"))
e.default=0
e.rmempty=false
e.description = translate("Allow zerotier clients access your LAN network")

e=t:option(DummyValue,"opennewwindow" ,
translate("<input type=\"button\" class=\"cbi-button cbi-button-apply\" value=\"Zerotier.com\" onclick=\"window.open('https://my.zerotier.com/network')\" />"))
e.description = translate("Create or manage your zerotier network, and auth clients who could access")

return a
6 changes: 4 additions & 2 deletions package/lean/luci-app-zerotier/root/etc/init.d/zerotier
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ start_instance() {
echo "disabled in config"
return 1
fi

config_get config_path $cfg 'config_path'

[ -d /etc/config/zero ] || mkdir -p /etc/config/zero
config_path=/etc/config/zero

config_get_bool port $cfg 'port'
config_get secret $cfg 'secret'

Expand Down

0 comments on commit 2915c44

Please sign in to comment.