diff options
Diffstat (limited to 'applications/luci-app-aria2/root')
4 files changed, 74 insertions, 17 deletions
diff --git a/applications/luci-app-aria2/root/etc/uci-defaults/40_luci-aria2 b/applications/luci-app-aria2/root/etc/uci-defaults/40_luci-aria2 deleted file mode 100755 index becc1c6995..0000000000 --- a/applications/luci-app-aria2/root/etc/uci-defaults/40_luci-aria2 +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -if [ ."$(uci -q get aria2.main)" != ."aria2" ]; then - uci -q batch <<-EOF >/dev/null - add aria2 aria2 - rename aria2.@aria2[-1]="main" - set aria2.main.enabled=0 - set aria2.main.dir="/var/run/aria2" - set aria2.main.config_dir="/var/etc/aria2" - add_list aria2.main.header="" - add_list aria2.main.bt_tracker="" - add_list aria2.main.extra_settings="" - commit aria2 - EOF -fi - -exit 0 diff --git a/applications/luci-app-aria2/root/usr/libexec/aria2-call b/applications/luci-app-aria2/root/usr/libexec/aria2-call new file mode 100755 index 0000000000..eba7aea5ec --- /dev/null +++ b/applications/luci-app-aria2/root/usr/libexec/aria2-call @@ -0,0 +1,25 @@ +#!/bin/sh + +. "$IPKG_INSTROOT/usr/share/libubox/jshn.sh" + +action=$1 +shift + +case "$action" in + cat) + case "$1" in + conf|session) + config_dir="$(uci -q get aria2.main.config_dir)" + list_file="${config_dir:-/var/etc/aria2}/aria2.$1.main" + json_init + json_add_string file "$list_file" + json_add_string content "$(cat "$list_file")" + json_dump + ;; + esac + ;; + tail) + log_file=$(uci -q get aria2.main.log) + tail -n 50 "${log_file:-/var/log/aria2.log}" + ;; +esac diff --git a/applications/luci-app-aria2/root/usr/share/luci/menu.d/luci-app-aria2.json b/applications/luci-app-aria2/root/usr/share/luci/menu.d/luci-app-aria2.json new file mode 100644 index 0000000000..8728252501 --- /dev/null +++ b/applications/luci-app-aria2/root/usr/share/luci/menu.d/luci-app-aria2.json @@ -0,0 +1,40 @@ +{ + "admin/services/aria2": { + "title": "Aria2", + "order": 30, + "action": { + "type": "firstchild" + }, + "depends": { + "acl": [ "luci-app-aria2" ], + "uci": { "aria2": true } + } + }, + + "admin/services/aria2/config": { + "title": "Configuration", + "order": 10, + "action": { + "type": "view", + "path": "aria2/config" + } + }, + + "admin/services/aria2/files": { + "title": "Files", + "order": 20, + "action": { + "type": "view", + "path": "aria2/files" + } + }, + + "admin/services/aria2/log": { + "title": "Log", + "order": 30, + "action": { + "type": "view", + "path": "aria2/log" + } + } +} diff --git a/applications/luci-app-aria2/root/usr/share/rpcd/acl.d/luci-app-aria2.json b/applications/luci-app-aria2/root/usr/share/rpcd/acl.d/luci-app-aria2.json index 891f97c28f..af5d31e9bd 100644 --- a/applications/luci-app-aria2/root/usr/share/rpcd/acl.d/luci-app-aria2.json +++ b/applications/luci-app-aria2/root/usr/share/rpcd/acl.d/luci-app-aria2.json @@ -2,6 +2,15 @@ "luci-app-aria2": { "description": "Grant UCI access for luci-app-aria2", "read": { + "ubus": { + "service": [ "list" ] + }, + "file": { + "/etc/passwd": [ "read" ], + "/sbin/logread": [ "exec" ], + "/usr/bin/aria2c": [ "exec" ], + "/usr/libexec/aria2-call": [ "exec" ] + }, "uci": [ "aria2" ] }, "write": { |