saverule.lua

来自「嵌入式无线路由系统openwrt的web配置工具」· LUA 代码 · 共 37 行

LUA
37
字号
#!/usr/bin/lua-- Copyright (C) 2008 OpenRB.comrequire('fslib')data = datajson()if (data ~= nil and data['values'] ~= nil) then  file = 'qos'  ruletype = data['values']['type']  if (data['id'] == nil) then    uci.init(file)    data['id'] = uci.add(file, ruletype)      else    uci.init(file, data['id'], ruletype, true)  end  if (data['values']['portfilter'] == 'portrange') then    data['values']['ports'] = ''  else    data['values']['portrange'] = ''  end  if (data['values']['layer7'] == 'allp2p') then    data['values']['layer7'] = ''    data['values']['ipp2p'] = 'all'  else    data['values']['ipp2p'] = ''  end  for field, value in pairs(data['values']) do    uci.setvalue(file, data['id'], field, value)  end  uci.commit(file)end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?