summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-aria2/root/usr/libexec/aria2-call
diff options
context:
space:
mode:
authorVan Waholtz <vanwaholtz@gmail.com>2020-07-28 07:14:52 -0700
committerVan Waholtz <vanwaholtz@gmail.com>2021-11-17 15:36:41 +0800
commit9dda104ee7136d805dfb3ab965f020b21cdea3bc (patch)
tree05134587d021211a6dff4d197b95f064c736fcb7 /applications/luci-app-aria2/root/usr/libexec/aria2-call
parent8d35d78c61782b393e2f0a9aebb9ae91abca3a2c (diff)
luci-app-aria2: convert to client side
Signed-off-by: Van Waholtz <vanwaholtz@gmail.com>
Diffstat (limited to 'applications/luci-app-aria2/root/usr/libexec/aria2-call')
-rwxr-xr-xapplications/luci-app-aria2/root/usr/libexec/aria2-call25
1 files changed, 25 insertions, 0 deletions
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