luci-app-aria2: fix bugs and add log option

* Fix unable save authentication method;
* Use luci.dispatcher.build_url(...) to support Chaos Calmer;
* Add log file and log level options;
* Rename files.

Signed-off-by: Hsing-Wang Liao <kuoruan@gmail.com>
This commit is contained in:
Hsing-Wang Liao 2016-09-19 10:20:36 +08:00
parent 3d40befbdd
commit a4c8c20647
4 changed files with 71 additions and 8 deletions

View file

@ -80,19 +80,32 @@ o.rmempty = false
o = s:taboption("general", Value, "rpc_passwd", translate("RPC password")) o = s:taboption("general", Value, "rpc_passwd", translate("RPC password"))
o:depends("rpc_auth_method", "user_pass") o:depends("rpc_auth_method", "user_pass")
o.password = true o.password = true
o.rmempty = false o.rmempty = true
o = s:taboption("general", Value, "rpc_secret", translate("RPC Token"), "<br/>" .. cfgbtn) o = s:taboption("general", Value, "rpc_secret", translate("RPC Token"), "<br/>" .. cfgbtn)
o:depends("rpc_auth_method", "token") o:depends("rpc_auth_method", "token")
o.rmempty = false o.rmempty = true
o = s:taboption("file", Value, "config_dir", translate("Config file directory")) o = s:taboption("file", Value, "config_dir", translate("Config file directory"))
o.placeholder = "/var/etc/aria2" o.placeholder = "/var/etc/aria2"
o = s:taboption("file", Flag, "enable_log", translate("Enable log"), translate("Log file is in the config file dir."))
o.enabled = "true"
o.disabled = "false"
o = s:taboption("file", ListValue, "log_level", translate("Log level"))
o:depends("enable_log", "true")
o:value("debug", translate("Debug"))
o:value("info", translate("Info"))
o:value("notice", translate("Notice"))
o:value("warn", translate("Warn"))
o:value("error", translate("Error"))
o = s:taboption("file", Value, "dir", translate("Default download directory")) o = s:taboption("file", Value, "dir", translate("Default download directory"))
o.rmempty = false o.rmempty = false
s:taboption("file", Value, "disk_cache", translate("Disk cache"), translate("in bytes, You can append K or M.")) o = s:taboption("file", Value, "disk_cache", translate("Disk cache"), translate("in bytes, You can append K or M."))
o.rmempty = true
o = s:taboption("file", ListValue, "file_allocation", translate("Preallocation"), translate("\"Falloc\" is not available in all cases.")) o = s:taboption("file", ListValue, "file_allocation", translate("Preallocation"), translate("\"Falloc\" is not available in all cases."))
o:value("none", translate("Off")) o:value("none", translate("Off"))
@ -101,6 +114,7 @@ o:value("trunc", translate("Trunc"))
o:value("falloc", translate("Falloc")) o:value("falloc", translate("Falloc"))
overall_speed_limit = s:taboption("task", Flag, "overall_speed_limit", translate("Overall speed limit enabled")) overall_speed_limit = s:taboption("task", Flag, "overall_speed_limit", translate("Overall speed limit enabled"))
overall_speed_limit.rmempty = true
o = s:taboption("task", Value, "max_overall_download_limit", translate("Overall download limit"), translate("in bytes/sec, You can append K or M.")) o = s:taboption("task", Value, "max_overall_download_limit", translate("Overall download limit"), translate("in bytes/sec, You can append K or M."))
o:depends("overall_speed_limit", "1") o:depends("overall_speed_limit", "1")
@ -109,6 +123,7 @@ o = s:taboption("task", Value, "max_overall_upload_limit", translate("Overall up
o:depends("overall_speed_limit", "1") o:depends("overall_speed_limit", "1")
task_speed_limit = s:taboption("task", Flag, "task_speed_limit", translate("Per task speed limit enabled")) task_speed_limit = s:taboption("task", Flag, "task_speed_limit", translate("Per task speed limit enabled"))
task_speed_limit.rmempty = true
o = s:taboption("task", Value, "max_download_limit", translate("Per task download limit"), translate("in bytes/sec, You can append K or M.")) o = s:taboption("task", Value, "max_download_limit", translate("Per task download limit"), translate("in bytes/sec, You can append K or M."))
o:depends("task_speed_limit", "1") o:depends("task_speed_limit", "1")

View file

@ -1,5 +1,5 @@
<script type="text/javascript">//<![CDATA[ <script type="text/javascript">//<![CDATA[
XHR.poll(5, '<%=url([[admin]], [[services]], [[aria2]], [[status]])%>', null, XHR.poll(5, '<%=luci.dispatcher.build_url("admin/services/aria2/status")%>', null,
function(x, data) { function(x, data) {
var tb = document.getElementById('aria2_status'); var tb = document.getElementById('aria2_status');
if (data && tb) { if (data && tb) {

View file

@ -67,6 +67,30 @@ msgstr ""
msgid "Generate Randomly" msgid "Generate Randomly"
msgstr "" msgstr ""
msgid "Enable log"
msgstr ""
msgid "Log file is in the config file dir."
msgstr ""
msgid "Log level"
msgstr ""
msgid "Debug"
msgstr ""
msgid "Info"
msgstr ""
msgid "Notice"
msgstr ""
msgid "Warn"
msgstr ""
msgid "Error"
msgstr ""
msgid "Config file directory" msgid "Config file directory"
msgstr "" msgstr ""

View file

@ -2,7 +2,7 @@ msgid "Aria2"
msgstr "" msgstr ""
msgid "Aria2 is a multi-protocol &amp; multi-source download utility, here you can configure the settings." msgid "Aria2 is a multi-protocol &amp; multi-source download utility, here you can configure the settings."
msgstr "Aria2 是一个支持多协议多线程的下载器, 你可以在这里对其进行配置." msgstr "Aria2 是一个支持多协议多线程的下载器, 你可以在这里对其进行配置"
msgid "Aria2 Status" msgid "Aria2 Status"
msgstr "Aria2 状态" msgstr "Aria2 状态"
@ -67,6 +67,30 @@ msgstr "RPC令牌"
msgid "Generate Randomly" msgid "Generate Randomly"
msgstr "随机生成" msgstr "随机生成"
msgid "Enable log"
msgstr "启用日志"
msgid "Log file is in the config file dir."
msgstr "日志文件在配置文件目录下"
msgid "Log level"
msgstr "日志记录等级"
msgid "Debug"
msgstr "调试"
msgid "Info"
msgstr "信息"
msgid "Notice"
msgstr "注意"
msgid "Warn"
msgstr "警告"
msgid "Error"
msgstr "错误"
msgid "Config file directory" msgid "Config file directory"
msgstr "配置文件目录" msgstr "配置文件目录"
@ -77,7 +101,7 @@ msgid "Disk cache"
msgstr "磁盘缓存" msgstr "磁盘缓存"
msgid "in bytes, You can append K or M." msgid "in bytes, You can append K or M."
msgstr "单位 B, 你可以在数字后跟上 K 或 M." msgstr "单位 B, 你可以在数字后跟上 K 或 M"
msgid "Preallocation" msgid "Preallocation"
msgstr "磁盘预分配" msgstr "磁盘预分配"
@ -95,7 +119,7 @@ msgid "Falloc"
msgstr "" msgstr ""
msgid "\"Falloc\" is not available in all cases." msgid "\"Falloc\" is not available in all cases."
msgstr "\"Falloc\" 并不是在所有情况下都可用." msgstr "\"Falloc\" 并不是在所有情况下都可用"
msgid "Overall speed limit enabled" msgid "Overall speed limit enabled"
msgstr "启用全局限速" msgstr "启用全局限速"
@ -104,7 +128,7 @@ msgid "Overall download limit"
msgstr "全局下载限速" msgstr "全局下载限速"
msgid "in bytes/sec, You can append K or M." msgid "in bytes/sec, You can append K or M."
msgstr "单位 B/s, 你可以在数字后跟上 K 或 M." msgstr "单位 B/s, 你可以在数字后跟上 K 或 M"
msgid "Overall upload limit" msgid "Overall upload limit"
msgstr "全局上传限速" msgstr "全局上传限速"