include $(TOPDIR)/rules.mk
+PKG_NAME:=luci-app-aria2
+
+# Version == major.minor.patch
+# increase "minor" on new functionality and "patch" on patches/optimization
+PKG_VERSION:=1.0.1
+
+# Release == build
+# increase on changes of translation files
+PKG_RELEASE:=2
+
+PKG_LICENSE:=Apache-2.0
+PKG_MAINTAINER:=Hsing-Wang Liao <kuoruan@gmail.com>
+
+# LuCI specific settings
LUCI_TITLE:=LuCI Support for Aria2
LUCI_DEPENDS:=+aria2
+LUCI_PKGARCH:=all
+
+define Package/$(PKG_NAME)/config
+# shown in make menuconfig <Help>
+help
+ $(LUCI_TITLE)
+ .
+ Version: $(PKG_VERSION)-$(PKG_RELEASE)
+ $(PKG_MAINTAINER)
+endef
include ../../luci.mk
o = s:taboption("general", Value, "rpc_passwd", translate("RPC password"))
o:depends("rpc_auth_method", "user_pass")
o.password = true
-o.rmempty = false
+o.rmempty = true
o = s:taboption("general", Value, "rpc_secret", translate("RPC Token"), "<br/>" .. cfgbtn)
o:depends("rpc_auth_method", "token")
-o.rmempty = false
+o.rmempty = true
o = s:taboption("file", Value, "config_dir", translate("Config file directory"))
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.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:value("none", translate("Off"))
o:value("falloc", translate("Falloc"))
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: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.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:depends("task_speed_limit", "1")
--- /dev/null
+<script type="text/javascript">//<![CDATA[
+XHR.poll(5, '<%=luci.dispatcher.build_url("admin/services/aria2/status")%>', null,
+ function(x, data) {
+ var tb = document.getElementById('aria2_status');
+ if (data && tb) {
+ if (data.running) {
+ var links = '<em><%:The Aria2 service is running.%></em>';
+ if (data.yaaw) {
+ links += '<input class="cbi-button mar-10" type="button" value="<%:Open YAAW%>" onclick="openWebUI(\'yaaw\');" />';
+ }
+ if (data.webui) {
+ links += '<input class="cbi-button mar-10" type="button" value="<%:Open WebUI-Aria2%>" onclick="openWebUI(\'webui-aria2\');" />';
+ }
+ tb.innerHTML = links;
+ } else {
+ tb.innerHTML = '<em><%:The Aria2 service is not running.%></em>';
+ }
+ }
+ }
+);
+
+function randomString(len) {
+ len = len || 32;
+ var $chars = 'abcdefghijklmnopqrstuvwxyz1234567890';
+ var maxPos = $chars.length;
+ var pwd = '';
+ for (i = 0; i < len; i++) {
+ pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
+ }
+ return pwd;
+};
+
+function randomSecret() {
+ var Token = document.getElementById("cbid.aria2.main.rpc_secret");
+ Token.value = randomString(32);
+};
+
+function showRPCURL() {
+ var websocket = document.getElementById("use_websocket");
+ var protocol = (websocket.checked) ? "ws" : "http";
+ var newTextNode = document.getElementById("aria2rpcpath");
+ var auth_method = document.getElementById("cbid.aria2.main.rpc_auth_method");
+ var auth_port = document.getElementById("cbid.aria2.main.rpc_listen_port");
+ if (auth_port.value == "") {
+ auth_port_value = "6800"
+ } else {
+ auth_port_value = auth_port.value
+ };
+ if (auth_method.value == "token") {
+ var auth_token = document.getElementById("cbid.aria2.main.rpc_secret");
+ newTextNode.value = protocol + "://token:" + auth_token.value + "@" + document.domain + ":" + auth_port_value + "/jsonrpc";
+ } else if (auth_method.value == "user_pass") {
+ var auth_user = document.getElementById("cbid.aria2.main.rpc_user");
+ var auth_passwd = document.getElementById("cbid.aria2.main.rpc_passwd");
+ newTextNode.value = protocol + "://" + auth_user.value + ":" + auth_passwd.value + "@" + document.domain + ":" + auth_port_value + "/jsonrpc";
+ } else {
+ newTextNode.value = protocol + "://" + document.domain + ":" + auth_port_value + "/jsonrpc";
+ }
+};
+
+function openWebUI(path) {
+ var curWwwPath = window.document.location.href;
+ var pathName = window.document.location.pathname;
+ var pos = curWwwPath.indexOf(pathName);
+ var localhostPath = curWwwPath.substring(0, pos);
+ var url = "http:" + localhostPath.substring(window.location.protocol.length) + "/" + path;
+ window.open(url)
+};
+//]]>
+</script>
+<style>.mar-10 {margin-left: 10px; margin-right: 10px;}</style>
+<fieldset class="cbi-section">
+ <legend><%:Aria2 Status%></legend>
+ <p id="aria2_status">
+ <em><%:Collecting data...%></em>
+ </p>
+</fieldset>
+++ /dev/null
-<script type="text/javascript">//<![CDATA[
-XHR.poll(5, '<%=url([[admin]], [[services]], [[aria2]], [[status]])%>', null,
- function(x, data) {
- var tb = document.getElementById('aria2_status');
- if (data && tb) {
- if (data.running) {
- var links = '<em><%:The Aria2 service is running.%></em>';
- if (data.yaaw) {
- links += '<input class="cbi-button mar-10" type="button" value="<%:Open YAAW%>" onclick="openWebUI(\'yaaw\');" />';
- }
- if (data.webui) {
- links += '<input class="cbi-button mar-10" type="button" value="<%:Open WebUI-Aria2%>" onclick="openWebUI(\'webui-aria2\');" />';
- }
- tb.innerHTML = links;
- } else {
- tb.innerHTML = '<em><%:The Aria2 service is not running.%></em>';
- }
- }
- }
-);
-
-function randomString(len) {
- len = len || 32;
- var $chars = 'abcdefghijklmnopqrstuvwxyz1234567890';
- var maxPos = $chars.length;
- var pwd = '';
- for (i = 0; i < len; i++) {
- pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
- }
- return pwd;
-};
-
-function randomSecret() {
- var Token = document.getElementById("cbid.aria2.main.rpc_secret");
- Token.value = randomString(32);
-};
-
-function showRPCURL() {
- var websocket = document.getElementById("use_websocket");
- var protocol = (websocket.checked) ? "ws" : "http";
- var newTextNode = document.getElementById("aria2rpcpath");
- var auth_method = document.getElementById("cbid.aria2.main.rpc_auth_method");
- var auth_port = document.getElementById("cbid.aria2.main.rpc_listen_port");
- if (auth_port.value == "") {
- auth_port_value = "6800"
- } else {
- auth_port_value = auth_port.value
- };
- if (auth_method.value == "token") {
- var auth_token = document.getElementById("cbid.aria2.main.rpc_secret");
- newTextNode.value = protocol + "://token:" + auth_token.value + "@" + document.domain + ":" + auth_port_value + "/jsonrpc";
- } else if (auth_method.value == "user_pass") {
- var auth_user = document.getElementById("cbid.aria2.main.rpc_user");
- var auth_passwd = document.getElementById("cbid.aria2.main.rpc_passwd");
- newTextNode.value = protocol + "://" + auth_user.value + ":" + auth_passwd.value + "@" + document.domain + ":" + auth_port_value + "/jsonrpc";
- } else {
- newTextNode.value = protocol + "://" + document.domain + ":" + auth_port_value + "/jsonrpc";
- }
-};
-
-function openWebUI(path) {
- var curWwwPath = window.document.location.href;
- var pathName = window.document.location.pathname;
- var pos = curWwwPath.indexOf(pathName);
- var localhostPath = curWwwPath.substring(0, pos);
- var url = "http:" + localhostPath.substring(window.location.protocol.length) + "/" + path;
- window.open(url)
-};
-//]]>
-</script>
-<style>.mar-10 {margin-left: 10px; margin-right: 10px;}</style>
-<fieldset class="cbi-section">
- <legend><%:Aria2 Status%></legend>
- <p id="aria2_status">
- <em><%:Collecting data...%></em>
- </p>
-</fieldset>
+++ /dev/null
-msgid "Aria2"
-msgstr ""
-
-msgid "Aria2 is a multi-protocol & multi-source download utility, here you can configure the settings."
-msgstr ""
-
-msgid "Aria2 Status"
-msgstr ""
-
-msgid "Open YAAW"
-msgstr ""
-
-msgid "Open WebUI-Aria2"
-msgstr ""
-
-msgid "The Aria2 service is running."
-msgstr ""
-
-msgid "The Aria2 service is not running."
-msgstr ""
-
-msgid "Aria2 Settings"
-msgstr ""
-
-msgid "General settings"
-msgstr ""
-
-msgid "Files and Locations"
-msgstr ""
-
-msgid "Enabled"
-msgstr ""
-
-msgid "Task Settings"
-msgstr ""
-
-msgid "BitTorrent Settings"
-msgstr ""
-
-msgid "Run daemon as user"
-msgstr ""
-
-msgid "RPC port"
-msgstr ""
-
-msgid "RPC authentication method"
-msgstr ""
-
-msgid "No Authentication"
-msgstr ""
-
-msgid "Username & Password"
-msgstr ""
-
-msgid "Token"
-msgstr ""
-
-msgid "RPC username"
-msgstr ""
-
-msgid "RPC password"
-msgstr ""
-
-msgid "RPC Token"
-msgstr ""
-
-msgid "Generate Randomly"
-msgstr ""
-
-msgid "Config file directory"
-msgstr ""
-
-msgid "Default download directory"
-msgstr ""
-
-msgid "Disk cache"
-msgstr ""
-
-msgid "in bytes, You can append K or M."
-msgstr ""
-
-msgid "Preallocation"
-msgstr ""
-
-msgid "Off"
-msgstr ""
-
-msgid "Prealloc"
-msgstr ""
-
-msgid "Trunc"
-msgstr ""
-
-msgid "Falloc"
-msgstr ""
-
-msgid "\"Falloc\" is not available in all cases."
-msgstr ""
-
-msgid "Overall speed limit enabled"
-msgstr ""
-
-msgid "Overall download limit"
-msgstr ""
-
-msgid "in bytes/sec, You can append K or M."
-msgstr ""
-
-msgid "Overall upload limit"
-msgstr ""
-
-msgid "Per task speed limit enabled"
-msgstr ""
-
-msgid "Per task download limit"
-msgstr ""
-
-msgid "Per task upload limit"
-msgstr ""
-
-msgid "Max concurrent downloads"
-msgstr ""
-
-msgid "Max connection per server"
-msgstr ""
-
-msgid "Min split size"
-msgstr ""
-
-msgid "Max number of split"
-msgstr ""
-
-msgid "Autosave session interval"
-msgstr ""
-
-msgid "Sec"
-msgstr ""
-
-msgid "User agent value"
-msgstr ""
-
-msgid "<abbr title=\"Distributed Hash Table\">DHT</abbr> enabled"
-msgstr ""
-
-msgid "<abbr title=\"Local Peer Discovery\">LPD</abbr> enabled"
-msgstr ""
-
-msgid "Follow torrent"
-msgstr ""
-
-msgid "BitTorrent listen port"
-msgstr ""
-
-msgid "Max number of peers per torrent"
-msgstr ""
-
-msgid "Additional Bt tracker enabled"
-msgstr ""
-
-msgid "List of additional Bt tracker"
-msgstr ""
-
-msgid "Prefix of peer ID"
-msgstr ""
-
-msgid "Extra Settings"
-msgstr ""
-
-msgid "List of extra settings"
-msgstr ""
-
-msgid "View Json-RPC URL"
-msgstr ""
-
-msgid "Use WebSocket"
-msgstr ""
--- /dev/null
+msgid "Aria2"
+msgstr ""
+
+msgid "Aria2 is a multi-protocol & multi-source download utility, here you can configure the settings."
+msgstr ""
+
+msgid "Aria2 Status"
+msgstr ""
+
+msgid "Open YAAW"
+msgstr ""
+
+msgid "Open WebUI-Aria2"
+msgstr ""
+
+msgid "The Aria2 service is running."
+msgstr ""
+
+msgid "The Aria2 service is not running."
+msgstr ""
+
+msgid "Aria2 Settings"
+msgstr ""
+
+msgid "General settings"
+msgstr ""
+
+msgid "Files and Locations"
+msgstr ""
+
+msgid "Enabled"
+msgstr ""
+
+msgid "Task Settings"
+msgstr ""
+
+msgid "BitTorrent Settings"
+msgstr ""
+
+msgid "Run daemon as user"
+msgstr ""
+
+msgid "RPC port"
+msgstr ""
+
+msgid "RPC authentication method"
+msgstr ""
+
+msgid "No Authentication"
+msgstr ""
+
+msgid "Username & Password"
+msgstr ""
+
+msgid "Token"
+msgstr ""
+
+msgid "RPC username"
+msgstr ""
+
+msgid "RPC password"
+msgstr ""
+
+msgid "RPC Token"
+msgstr ""
+
+msgid "Generate Randomly"
+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"
+msgstr ""
+
+msgid "Default download directory"
+msgstr ""
+
+msgid "Disk cache"
+msgstr ""
+
+msgid "in bytes, You can append K or M."
+msgstr ""
+
+msgid "Preallocation"
+msgstr ""
+
+msgid "Off"
+msgstr ""
+
+msgid "Prealloc"
+msgstr ""
+
+msgid "Trunc"
+msgstr ""
+
+msgid "Falloc"
+msgstr ""
+
+msgid "\"Falloc\" is not available in all cases."
+msgstr ""
+
+msgid "Overall speed limit enabled"
+msgstr ""
+
+msgid "Overall download limit"
+msgstr ""
+
+msgid "in bytes/sec, You can append K or M."
+msgstr ""
+
+msgid "Overall upload limit"
+msgstr ""
+
+msgid "Per task speed limit enabled"
+msgstr ""
+
+msgid "Per task download limit"
+msgstr ""
+
+msgid "Per task upload limit"
+msgstr ""
+
+msgid "Max concurrent downloads"
+msgstr ""
+
+msgid "Max connection per server"
+msgstr ""
+
+msgid "Min split size"
+msgstr ""
+
+msgid "Max number of split"
+msgstr ""
+
+msgid "Autosave session interval"
+msgstr ""
+
+msgid "Sec"
+msgstr ""
+
+msgid "User agent value"
+msgstr ""
+
+msgid "<abbr title=\"Distributed Hash Table\">DHT</abbr> enabled"
+msgstr ""
+
+msgid "<abbr title=\"Local Peer Discovery\">LPD</abbr> enabled"
+msgstr ""
+
+msgid "Follow torrent"
+msgstr ""
+
+msgid "BitTorrent listen port"
+msgstr ""
+
+msgid "Max number of peers per torrent"
+msgstr ""
+
+msgid "Additional Bt tracker enabled"
+msgstr ""
+
+msgid "List of additional Bt tracker"
+msgstr ""
+
+msgid "Prefix of peer ID"
+msgstr ""
+
+msgid "Extra Settings"
+msgstr ""
+
+msgid "List of extra settings"
+msgstr ""
+
+msgid "View Json-RPC URL"
+msgstr ""
+
+msgid "Use WebSocket"
+msgstr ""
msgstr ""
msgid "Aria2 is a multi-protocol & multi-source download utility, here you can configure the settings."
-msgstr "Aria2 是一个支持多协议多线程的下载器, 你可以在这里对其进行配置."
+msgstr "Aria2 是一个支持多协议多线程的下载器, 你可以在这里对其进行配置"
msgid "Aria2 Status"
msgstr "Aria2 状态"
msgid "Generate Randomly"
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"
msgstr "配置文件目录"
msgstr "磁盘缓存"
msgid "in bytes, You can append K or M."
-msgstr "单位 B, 你可以在数字后跟上 K 或 M."
+msgstr "单位 B, 你可以在数字后跟上 K 或 M"
msgid "Preallocation"
msgstr "磁盘预分配"
msgstr ""
msgid "\"Falloc\" is not available in all cases."
-msgstr "\"Falloc\" 并不是在所有情况下都可用."
+msgstr "\"Falloc\" 并不是在所有情况下都可用"
msgid "Overall speed limit enabled"
msgstr "启用全局限速"
msgstr "全局下载限速"
msgid "in bytes/sec, You can append K or M."
-msgstr "单位 B/s, 你可以在数字后跟上 K 或 M."
+msgstr "单位 B/s, 你可以在数字后跟上 K 或 M"
msgid "Overall upload limit"
msgstr "全局上传限速"