1 -- Copyright 2017 Dirk Brenken (dev@brenken.org)
2 -- This is free software, licensed under the Apache License, Version 2.0
4 local nxfs = require("nixio.fs")
5 local util = require("luci.util")
6 local uci_input = "/etc/config/dnscrypt-proxy"
8 if not nxfs.access(uci_input) then
9 m = SimpleForm("error", nil, translate("Input file not found, please check your configuration."))
15 m = SimpleForm("input", nil)
16 m:append(Template("dnscrypt-proxy/config_css"))
17 m.submit = translate("Save")
20 s = m:section(SimpleSection, nil,
21 translate("This form allows you to modify the content of the main DNSCrypt-Proxy configuration file (/etc/config/dnscrypt-proxy)."))
23 f = s:option(TextValue, "data")
28 return nxfs.readfile(uci_input) or ""
31 function f.write(self, section, data)
32 return nxfs.writefile(uci_input, "\n" .. util.trim(data:gsub("\r\n", "\n")) .. "\n")
35 function s.handle(self, state, data)