1 -- Copyright 2017 Dirk Brenken (dev@brenken.org)
2 -- This is free software, licensed under the Apache License, Version 2.0
4 local fs = require("nixio.fs")
5 local util = require("luci.util")
6 local trminput = "/etc/config/firewall"
8 if not nixio.fs.access(trminput) then
9 m = SimpleForm("error", nil, translate("Input file not found, please check your configuration."))
13 m = SimpleForm("input", nil)
14 m:append(Template("travelmate/config_css"))
15 m.submit = translate("Save")
18 s = m:section(SimpleSection, nil,
19 translate("This form allows you to modify the content of the main firewall configuration file (/etc/config/firewall)."))
21 f = s:option(TextValue, "data")
26 return nixio.fs.readfile(trminput) or ""
29 function f.write(self, section, data)
30 return nixio.fs.writefile(trminput, "\n" .. util.trim(data:gsub("\r\n", "\n")) .. "\n")
33 function s.handle(self, state, data)