Skip to content

Commit

Permalink
Mirror Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tearmoon committed Mar 7, 2024
1 parent 78f6d2d commit 5ffac72
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
11 changes: 6 additions & 5 deletions box/scripts/box.tool
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ upkernel() {
url_down="https://github.com/SagerNet/sing-box/releases"

latest_version=$(busybox wget --no-check-certificate -qO- "${api_url}" | grep "tag_name" | busybox grep -oE "v[0-9].*" | head -1 | cut -d'"' -f1)
download_link="${url_down}/download/${latest_version}/sing-box-${latest_version#v}-android-${arch}.tar.gz"
download_link="${url_down}/download/${latest_version}/sing-box-${latest_version#v}-${platform}-${arch}.tar.gz"
log Debug "download ${download_link}"
upfile "${box_dir}/${file_kernel}.tar.gz" "${download_link}" && xkernel
;;
Expand All @@ -360,6 +360,7 @@ upkernel() {
if [ "${mihomo_stable}" = "enable" ]; then
latest_version=$(busybox wget --no-check-certificate -qO- "https://api.github.com/repos/MetaCubeX/mihomo/releases" | grep "tag_name" | busybox grep -oE "v[0-9.]*" | head -1)
tag="$latest_version"
arch=${arch%-v8}
else
if [ "$use_ghproxy" == true ]; then
download_link="${url_ghproxy}/${download_link}"
Expand All @@ -368,7 +369,7 @@ upkernel() {
latest_version=$(busybox wget --no-check-certificate -qO- "${download_link}/expanded_assets/${tag}" | busybox grep -oE "alpha-[0-9a-z]+" | head -1)
fi
# set the filename based on platform and architecture
filename="mihomo-android-${arch}-${latest_version}"
filename="mihomo-${platform}-${arch}-${latest_version}"
# download and update the file
log Debug "download ${download_link}/download/${tag}/${filename}.gz"
upfile "${box_dir}/${file_kernel}.gz" "${download_link}/download/${tag}/${filename}.gz" && xkernel
Expand Down Expand Up @@ -432,7 +433,7 @@ xkernel() {
tar_command="busybox tar"
fi
if ${tar_command} -xf "${box_dir}/${file_kernel}.tar.gz" -C "${bin_dir}" >&2; then
mv "${bin_dir}/sing-box-${latest_version#v}-android-${arch}/sing-box" "${bin_dir}/${bin_name}"
mv "${bin_dir}/sing-box-${latest_version#v}-${platform}-${arch}/sing-box" "${bin_dir}/${bin_name}"
if [ -f "${box_pid}" ]; then
rm -rf /data/adb/box/sing-box/cache.db
restart_box
Expand All @@ -442,8 +443,8 @@ xkernel() {
else
log Error "Failed to extract ${box_dir}/${file_kernel}.tar.gz."
fi
[ -d "${bin_dir}/sing-box-${latest_version#v}-android-${arch}" ] && \
rm -r "${bin_dir}/sing-box-${latest_version#v}-android-${arch}"
[ -d "${bin_dir}/sing-box-${latest_version#v}-${platform}-${arch}" ] && \
rm -r "${bin_dir}/sing-box-${latest_version#v}-${platform}-${arch}"
;;
"v2fly"|"xray")
bin="xray"
Expand Down
4 changes: 2 additions & 2 deletions box/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ blue="\033[1;34m"
# eg: notify $title $content
notify() {
# using Xposed edge app toast
am start -a android.intent.action.VIEW -n com.jozein.xedgepro/.ui.ActivityPerformAction --ei __0 111 --es __1 "$2"
am start -a android.intent.action.VIEW -n com.jozein.xedgepro/.ui.ActivityPerformAction --ei __0 111 --es __1 "$2" >/dev/null 2>&1

# using system notification
#su -lp "2000" -c "cmd notification post -S messaging --conversation '$1' --message '$1':'$2' 'Tag' '$(echo $RANDOM)' " >/dev/null 2>&1
# su -lp "2000" -c "cmd notification post -S messaging --conversation '$1' --message '$1':'$2' 'Tag' '$(echo $RANDOM)' " >/dev/null 2>&1
}

log() {
Expand Down
4 changes: 2 additions & 2 deletions customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ while true ; do
timeout 1 getevent -lc 1 2>&1 | grep KEY_VOLUME > "$TMPDIR/events"
if [ $(( NOW_TIME - START_TIME )) -gt 9 ] ; then
ui_print "- No input detected after 10 seconds"
ui_print "- Downloading Kernel Anyway...."
/data/adb/box/scripts/box.tool all
# ui_print "- Downloading Kernel Anyway...."
# /data/adb/box/scripts/box.tool all
break
else
if $(cat $TMPDIR/events | grep -q KEY_VOLUMEUP) ; then
Expand Down

0 comments on commit 5ffac72

Please sign in to comment.