📄 savezone.lua.svn-base
字号:
#!/usr/bin/lua-- Copyright (C) 2008 OpenRB.comrequire('fslib')data = datajson()if (data ~= nil and data['values'] ~= nil) then file = 'firewall' if (data['id'] == nil) then uci.init(file) data['id'] = uci.add(file, 'zone') else uci.init(file, data['id'], 'zone') end fields = { name = 1, input = 1, output = 1, forward = 1, masq = 1 } network = {} ifnames = {} for field, value in pairs(data['values']) do if (fields[ field ] ~= nil) then uci.setvalue(file, data['id'], field, value) elseif (value ~= '') then table.insert(network, value) table.insert(ifnames, field) end end uci.setvalue(file, data['id'], 'network', table.concat(network, ' ')) uci.setvalue(file, data['id'], 'ifnames', table.concat(ifnames, ' ')) uci.commit(file)end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -