1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00
This commit is contained in:
suyuan 2023-01-18 21:21:55 +08:00
parent 6b7f0b4dba
commit fd8b7384d5
104 changed files with 13356 additions and 31 deletions

View file

@ -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"

View 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

View file

@ -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