Skip to content

Commit

Permalink
fix: typo & [bug] dashboard update fail, will delete old dashboard file
Browse files Browse the repository at this point in the history
  • Loading branch information
taamarin committed Jun 10, 2023
1 parent c718235 commit 599c3a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
8 changes: 4 additions & 4 deletions box/scripts/box.service
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,11 @@ crontab_alive() {
busybox crontab -c ${run_path} -r
touch "${run_path}/root"
chmod 0755 "${run_path}/root"
# Displays a configuration message if bin_name is "clash|xray|sing-box|v2ray"
# Displays a configuration message if bin_name is "clash|xray|sing-box|v2fly"
case "${bin_name}" in
"clash") log info "config '${clash_config}'";;
"xray"|"sing-box"|"v2ray") log info "config '${data_dir}/${bin_name}/*.json'";;
*) log error "${bin_name}: <unknown>"; exit 1;;
"xray"|"sing-box"|"v2fly") log info "config '${data_dir}/${bin_name}/*.json'";;
*) log error "bin_name:${bin_name}<unknown>"; exit 1;;
esac
# Executes the crontab_geosub function
crontab_geosub
Expand Down Expand Up @@ -431,7 +431,7 @@ start_box() {
else
case "${bin_name}" in
"xray"|"sing-box"|"clash"|"v2fly") log info "Good day" ;;
*) log error "bin_name: '${bin_name} <unknown>' not defined"; exit 1 ;;
*) log error "bin_name:${bin_name}<unknown> not defined"; exit 1 ;;
esac
fi
# Check permissions, check for bin existence, delete old logs, create a TUN if necessary, run box, and wait for 1 second
Expand Down
17 changes: 9 additions & 8 deletions box/scripts/box.tool
Original file line number Diff line number Diff line change
Expand Up @@ -402,18 +402,19 @@ update_dashboard() {
# su -c /data/adb/box/scripts/box.tool upyacd
if [ "${bin_name}" = "clash" -o "${bin_name}" = "sing-box" ]; then
file_dashboard="${data_dir}/${bin_name}/dashboard.zip"
rm -rf "${data_dir}/${bin_name}/dashboard"
if [ ! -d "${data_dir}/${bin_name}/dashboard" ]; then
log info "dashboard folder not exist, creating it"
mkdir "${data_dir}/${bin_name}/dashboard"
fi
url="https://github.com/MetaCubeX/Yacd-meta/archive/gh-pages.zip"
url="https://github.com/MetaCubeX/yacd-meta/archive/gh-pages.zip"
if [[ "$use_ghproxy" == true ]]; then
url="https://ghproxy.com/${url}"
fi
dir_name="Yacd-meta-gh-pages"
dir_name="yacd-meta-gh-pages"
log debug "Download ${url}"
if busybox wget --no-check-certificate "${url}" -O "${file_dashboard}" >&2; then
if [ ! -d "${data_dir}/${bin_name}/dashboard" ]; then
log info "dashboard folder not exist, creating it"
mkdir "${data_dir}/${bin_name}/dashboard"
else
rm -rf "${data_dir}/${bin_name}/dashboard/"*
fi
unzip_command="$(command -v unzip >/dev/null 2>&1 ; echo $?)"
if [ $unzip_command -eq 0 ]; then
unzip_command="unzip"
Expand All @@ -425,7 +426,7 @@ update_dashboard() {
rm -f "${file_dashboard}"
rm -rf "${data_dir}/${bin_name}/dashboard/${dir_name}"
else
log error "Failed to download $url" >&2
log error "Failed to download dashboard" >&2
return 1
fi
return 0
Expand Down

0 comments on commit 599c3a9

Please sign in to comment.