1 -- Copyright 2017-2019 Xingwang Liao <kuoruan@gmail.com>
2 -- Licensed to the public under the MIT License.
6 local fs = require "nixio.fs"
7 local util = require "luci.util"
8 local uci = require "luci.model.uci".cursor()
10 local config_dir = uci:get("aria2", "main", "config_dir") or "/var/etc/aria2"
11 local config_file = "%s/aria2.conf.main" % config_dir
12 local session_file = "%s/aria2.session.main" % config_dir
14 m = SimpleForm("aria2", "%s - %s" % { translate("Aria2"), translate("Files") },
15 translate("Here shows the files used by aria2."))
19 s = m:section(SimpleSection, nil, translatef("Content of config file: <code>%s</code>", config_file))
21 o = s:option(TextValue, "_config")
24 o.cfgvalue = function()
25 local v = fs.readfile(config_file) or translate("File does not exist.")
26 return util.trim(v) ~= "" and v or translate("Empty file.")
29 s = m:section(SimpleSection, nil, translatef("Content of session file: <code>%s</code>", session_file))
31 o = s:option(TextValue, "_session")
34 o.cfgvalue = function()
35 local v = fs.readfile(session_file) or translate("File does not exist.")
36 return util.trim(v) ~= "" and v or translate("Empty file.")