add interface info tab for zerotier luci

This commit is contained in:
coolsnowwolf 2018-10-15 03:28:55 +08:00
parent 9a12e03e17
commit e762a25bba
4 changed files with 38 additions and 8 deletions

View File

@ -10,7 +10,7 @@ LUCI_TITLE:=LuCI for Zerotier
LUCI_DEPENDS:=+zerotier
LUCI_PKGARCH:=all
PKG_VERSION:=1.0
PKG_RELEASE:=11
PKG_RELEASE:=12
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -10,21 +10,41 @@ t=a:section(NamedSection,"sample_config","zerotier")
t.anonymous=true
t.addremove=false
e=t:option(Flag,"enabled",translate("Enable"))
t:tab("basic", translate("Base Setting"))
e=t:taboption("basic", Flag,"enabled",translate("Enable"))
e.default=0
e.rmempty=false
e=t:option(DynamicList,"join",translate('ZeroTier Network ID'))
e=t:taboption("basic", DynamicList,"join",translate('ZeroTier Network ID'))
e.password=true
e.rmempty=false
e=t:option(Flag,"nat",translate("Auto NAT Clients"))
e=t:taboption("basic", 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" ,
e=t:taboption("basic", 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")
local dog = "/tmp/zero.info"
t:tab("watchdog", translate("Interface Info"))
log = t:taboption("watchdog", TextValue, "sylogtext")
log.template = "cbi/tvalue"
log.rows = 8
log.wrap = "off"
log.readonly="readonly"
function log.cfgvalue(self, section)
luci.sys.exec("ifconfig $(ifconfig | grep zt | awk '{print $1}') > /tmp/zero.info")
return nixio.fs.readfile(dog) or ""
end
function log.write(self, section, value)
value = value:gsub("\r\n?", "\n")
nixio.fs.writefile(dog, value)
end
return a

View File

@ -1,3 +1,11 @@
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Gtranslator 2.91.7\n"
"Plural-Forms: nplurals=1; plural=0;\n"
msgid "Zerotier is an open source, cross-platform and easy to use virtual LAN"
msgstr "Zerotier是一个开源跨平台而且适合内网穿透互联的傻瓜配置虚拟 VPN LAN"
@ -5,7 +13,10 @@ msgid "Auto NAT Clients"
msgstr "自动允许客户端NAT"
msgid "Allow zerotier clients access your LAN network"
msgstr "允许Zerotier的拨入客户端访问LAN局域网"
msgstr "允许Zerotier的拨入客户端访问路由器LAN资源需要在 Zerotier管理页面设定到LAN网段的路由表"
msgid "Create or manage your zerotier network, and auth clients who could access"
msgstr "点击跳转到Zerotier官网管理平台新建或者管理网络并允许客户端接入访问你私人网路新接入的节点默认不允许访问"
msgid "Interface Info"
msgstr "接口信息"

View File

@ -7,8 +7,7 @@ if [ $zero_enable -eq 1 ]; then
if [ -f /tmp/zero.log ];then
while [ "$(ifconfig | grep zt | awk '{print $1}')" = "" ]
do
echo "zt interface not started yet, try build rules after 5s"
sleep 5
sleep 1
done
fi