openwrt_helloworld/luci-app-nikki/root/usr/libexec/nikki-call
2025-02-11 18:56:59 +08:00

58 lines
871 B
Bash
Executable File

#!/bin/sh
. $IPKG_INSTROOT/etc/nikki/scripts/include.sh
action=$1
shift
case "$action" in
clear_log)
case "$1" in
app)
echo -n > "$APP_LOG_PATH"
;;
core)
echo -n > "$CORE_LOG_PATH"
;;
esac
;;
subscription)
case "$1" in
update)
/etc/init.d/nikki update_subscription "$2"
;;
esac
;;
load)
case "$1" in
profile)
yq -M -o json < "$RUN_PROFILE_PATH"
;;
esac
;;
service)
case "$1" in
reload)
/etc/init.d/nikki reload
;;
restart)
/etc/init.d/nikki restart
;;
esac
;;
version)
case "$1" in
app)
if [ -x "/bin/opkg" ]; then
opkg list-installed "luci-app-nikki" | cut -d " " -f 3
elif [ -x "/usr/bin/apk" ]; then
apk list -I "luci-app-nikki" | cut -d ' ' -f 1 | cut -d '-' -f 4
fi
;;
core)
mihomo -v | grep "Mihomo" | cut -d " " -f 3
;;
esac
;;
esac