📄 save.lua
字号:
#!/usr/bin/lua-- Copyright (C) 2008 OpenRB.comrequire('fslib')data = datajson()-- check data, id and values are passedif (data ~= nil and data['values'] ~= nil) then file = 'ssmtp' uci.init(file, file, file) for field, value in pairs(data['values']) do uci.setvalue(file, data['id'], field, value) end uci.commit(file)end-- convert to plain text formatf = io.open('/etc/ssmtp/ssmtp.conf', 'w')cfg = uci.init(file, file, file)-- file is ready for writing and there are some config values setif (f ~= nil and cfg ~= nil) then fields = {'root', 'Mailhub', 'AuthUser', 'AuthPass', 'Hostname', 'UseTLS', 'UseSTARTTLS'} for i, field in ipairs(fields) do if (cfg[field] ~= nil) then f:write(field .. '=' .. cfg[field], "\n") end end f:close()end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -