mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
fix
This commit is contained in:
parent
6b7f0b4dba
commit
fd8b7384d5
104 changed files with 13356 additions and 31 deletions
|
@ -12,7 +12,7 @@ LUCI_PKGARCH:=all
|
|||
|
||||
PKG_NAME:=luci-app-zerotier
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=20
|
||||
PKG_RELEASE:=21
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
module("luci.controller.zerotier", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/zerotier") then
|
||||
return
|
||||
end
|
||||
if not nixio.fs.access("/etc/config/zerotier") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
|
||||
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
|
||||
|
||||
entry({"admin", "vpn", "zerotier"}, alias("admin", "vpn", "zerotier", "general"), _("ZeroTier"), 99)
|
||||
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"}, alias("admin", "vpn", "zerotier", "general"), _("ZeroTier"), 99)
|
||||
|
||||
entry({"admin", "vpn", "zerotier", "status"}, call("act_status"))
|
||||
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", "manual"}, cbi("zerotier/manual"), _("Manual Config"), 3)
|
||||
|
||||
entry({"admin", "vpn", "zerotier", "status"}, call("act_status"))
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.running = luci.sys.call("pgrep /usr/bin/zerotier-one >/dev/null") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
local e = {}
|
||||
e.running = luci.sys.call("pgrep /usr/bin/zerotier-one >/dev/null") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
|
|
@ -7,8 +7,8 @@ t = f:field(TextValue, "conf")
|
|||
t.rmempty = true
|
||||
t.rows = 19
|
||||
function t.cfgvalue()
|
||||
luci.sys.exec("for i in $(ifconfig | grep 'zt' | awk '{print $1}'); do ifconfig $i; done > /tmp/zero.info")
|
||||
return fs.readfile(conffile) or ""
|
||||
luci.sys.exec("for i in $(ifconfig | grep 'zt' | awk '{print $1}'); do ifconfig $i; done > /tmp/zero.info")
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
t.readonly = "readonly"
|
||||
|
||||
|
|
26
luci-app-zerotier/luasrc/model/cbi/zerotier/manual.lua
Normal file
26
luci-app-zerotier/luasrc/model/cbi/zerotier/manual.lua
Normal file
|
@ -0,0 +1,26 @@
|
|||
local m, s, o
|
||||
local fs = require "nixio.fs"
|
||||
local jsonc = require "luci.jsonc" or nil
|
||||
m = Map("zerotier")
|
||||
s = m:section(NamedSection, "sample_config", "zerotier")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
o = s:option(TextValue, "manualconfig")
|
||||
o.rows = 20
|
||||
o.wrap = "soft"
|
||||
o.rmempty = true
|
||||
o.cfgvalue = function(self, section)
|
||||
return fs.readfile("/etc/config/zero/local.conf")
|
||||
end
|
||||
o.write = function(self, section, value)
|
||||
fs.writefile("/etc/config/zero/local.conf", value:gsub("\r\n", "\n"))
|
||||
end
|
||||
o.validate = function(self, value)
|
||||
if jsonc == nil or jsonc.parse(value) ~= nil then
|
||||
return value
|
||||
end
|
||||
return nil
|
||||
end
|
||||
o.description =
|
||||
'<a href="https://www.zerotier.com/manual/" target="_blank">https://www.zerotier.com/manual/</a><br><a href="https://github.com/zerotier/ZeroTierOne/blob/dev/service/README.md" target="_blank">https://github.com/zerotier/ZeroTierOne/blob/dev/service/README.md</a>'
|
||||
return m
|
|
@ -2,7 +2,7 @@ a = Map("zerotier")
|
|||
a.title = translate("ZeroTier")
|
||||
a.description = translate("Zerotier is an open source, cross-platform and easy to use virtual LAN")
|
||||
|
||||
a:section(SimpleSection).template = "zerotier/zerotier_status"
|
||||
a:section(SimpleSection).template = "zerotier/zerotier_status"
|
||||
|
||||
t = a:section(NamedSection, "sample_config", "zerotier")
|
||||
t.anonymous = true
|
||||
|
@ -21,7 +21,17 @@ e.description = translate("Allow zerotier clients access your LAN network")
|
|||
e.default = 0
|
||||
e.rmempty = false
|
||||
|
||||
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 = t:option(MultiValue, "access", translate("Zerotier Access Control"))
|
||||
e.default = "lanfwzt ztfwwan ztfwlan"
|
||||
e.rmempty = false
|
||||
e:value("lanfwzt", translate("LAN Access Zerotier"))
|
||||
e:value("wanfwzt", translate("WAN Access Zerotier"))
|
||||
e:value("ztfwwan", translate("Remote Access WAN"))
|
||||
e:value("ztfwlan", translate("Remote Access LAN"))
|
||||
e.widget = "checkbox"
|
||||
|
||||
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
|
||||
|
|
|
@ -1,22 +1,29 @@
|
|||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[vpn]], [[zerotier]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('zerotier_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>Zerotier <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>Zerotier <%:NOT RUNNING%></font></b></em>';
|
||||
XHR.poll(3, '<%=url([[admin]], [[vpn]], [[zerotier]], [[status]])%>', null,
|
||||
function (x, data) {
|
||||
var tb = document.getElementById('zerotier_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>Zerotier <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>Zerotier <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<style>
|
||||
.mar-10 {
|
||||
margin-left: 50px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="zerotier_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
<em>
|
||||
<%:Collecting data...%>
|
||||
</em>
|
||||
</p>
|
||||
</fieldset>
|
||||
</fieldset>
|
|
@ -15,3 +15,21 @@ msgstr "基本设置"
|
|||
|
||||
msgid "Interface Info"
|
||||
msgstr "接口信息"
|
||||
|
||||
msgid "Zerotier Access Control"
|
||||
msgstr "Zerotier 准入控制"
|
||||
|
||||
msgid "LAN Access Zerotier"
|
||||
msgstr "LAN 可接入 Zerotier"
|
||||
|
||||
msgid "WAN Access Zerotier"
|
||||
msgstr "WAN 可接入 Zerotier"
|
||||
|
||||
msgid "Remote Access WAN"
|
||||
msgstr "外部访问可接入 WAN"
|
||||
|
||||
msgid "Remote Access LAN"
|
||||
msgstr "外部访问可接入 LAN"
|
||||
|
||||
msgid "Manual Config"
|
||||
msgstr "手动设置"
|
||||
|
|
1
luci-app-zerotier/po/zh_Hans
Normal file
1
luci-app-zerotier/po/zh_Hans
Normal file
|
@ -0,0 +1 @@
|
|||
zh-cn
|
Loading…
Add table
Add a link
Reference in a new issue