1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00
openmptcprouter-feeds/luci-app-zerotier/luasrc/model/cbi/zerotier/manual.lua
2023-01-18 21:21:55 +08:00

26 lines
932 B
Lua

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