From 8f69e33dc0b319c0daaed4db96656ebd7b7f056e Mon Sep 17 00:00:00 2001 From: taamarin Date: Thu, 8 Jun 2023 22:20:33 +0700 Subject: [PATCH] adjust: yacd autostart --- box/scripts/box.service | 3 ++- box/scripts/box.tool | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/box/scripts/box.service b/box/scripts/box.service index a0296c7..4e73caf 100755 --- a/box/scripts/box.service +++ b/box/scripts/box.service @@ -467,7 +467,8 @@ start_box() { # Open the yacd in browser if [ "${bin_name}" = "clash" ] && [ "${display_yacd_on_start}" = "true" ]; then sleep 0.5 - am start -a android.intent.action.VIEW -d http://127.0.0.1:9090/ui + ip_port=$(busybox awk '/external-controller:/ {print $2}' "${clash_config}") + am start -a android.intent.action.VIEW -d "http://${ip_port}/ui" fi } diff --git a/box/scripts/box.tool b/box/scripts/box.tool index 90b3a12..2fd7d0c 100755 --- a/box/scripts/box.tool +++ b/box/scripts/box.tool @@ -146,7 +146,7 @@ update_yq() { # Check and update geoip and geosite update_subgeo() { log info "daily updates" - geodata_mode=$(awk '/geodata-mode:*./{print $2}' "${clash_config}") + geodata_mode=$(busybox awk '/geodata-mode:*./{print $2}' "${clash_config}") case "${bin_name}" in clash) geoip_file="${data_dir}/clash/$(if [ "${geodata_mode}" = "false" ]; then echo "Country.mmdb"; else echo "GeoIP.dat"; fi)" @@ -170,8 +170,8 @@ update_subgeo() { if [ "${auto_update_geox}" = "true" ] && log debug "Downloading ${geoip_url}" && update_file "${geoip_file}" "${geoip_url}" && log debug "Downloading ${geosite_url}" && update_file "${geosite_file}" "${geosite_url}"; then log debug "Update geo $(date +"%F %R")" if [ -f "${pid_file}" ] && [ "${bin_name}" = "clash" ] && [ "${meta}" = "true" ]; then - ip_port=$(awk '/external-controller:/ {print $2}' "${clash_config}") - secret=$(awk '/secret:/ {print $2}' "${clash_config}") + ip_port=$(busybox awk '/external-controller:/ {print $2}' "${clash_config}") + secret=$(busybox awk '/secret:/ {print $2}' "${clash_config}") busybox wget --header="Authorization: Bearer ${secret}" --post-data "" -O /dev/null "http://${ip_port}/restart" # >/dev/null 2>&1 fi flag=false # if true, after the update is complete it will restart BFM @@ -210,8 +210,8 @@ update_subgeo() { rm ${update_file_name}.bak fi if [ -f "${pid_file}" ] && [ "${bin_name}" = "clash" ] && [ "${meta}" = "true" ]; then - ip_port=$(awk '/external-controller:/ {print $2}' "${clash_config}") - secret=$(awk '/secret:/ {print $2}' "${clash_config}") + ip_port=$(busybox awk '/external-controller:/ {print $2}' "${clash_config}") + secret=$(busybox awk '/secret:/ {print $2}' "${clash_config}") busybox wget --header="Authorization: Bearer ${secret}" --post-data "" -O /dev/null "http://${ip_port}/restart" # >/dev/null 2>&1 flag=false # if it's true, after the update is complete it will restart BFM, but to update proxy_provider you don't need to restart it, just reload it on the dashboard/yacd else