[box.tool] Add option to download sing-box "Pre-release" and "Latest release" https://github.com/taamarin/box_for_magisk/issues/133
This commit is contained in:
@@ -10,6 +10,7 @@ url_ghproxy="https://mirror.ghproxy.com"
|
||||
use_ghproxy="true"
|
||||
# to enable/disable download the stable mihomo kernel
|
||||
mihomo_stable="enable"
|
||||
singbox_stable="disable"
|
||||
|
||||
# Updating files from URLs
|
||||
upfile() {
|
||||
@@ -349,7 +350,21 @@ upkernel() {
|
||||
api_url="https://api.github.com/repos/SagerNet/sing-box/releases"
|
||||
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)
|
||||
if [ "${singbox_stable}" = "disable" ]; then
|
||||
# Pre-release
|
||||
log Debug "download ${bin_name} Pre-release"
|
||||
latest_version=$(busybox wget --no-check-certificate -qO- "${api_url}" | grep "tag_name" | busybox grep -oE "v[0-9].*" | head -1 | cut -d'"' -f1)
|
||||
else
|
||||
# Latest
|
||||
log Debug "download ${bin_name} Latest-stable"
|
||||
latest_version=$(busybox wget --no-check-certificate -qO- "${api_url}/latest" | grep "tag_name" | busybox grep -oE "v[0-9.]*" | head -1)
|
||||
fi
|
||||
|
||||
if [ -z "$latest_version" ]; then
|
||||
log Error "Failed to get latest stable/beta/alpha version of sing-box"
|
||||
return 1
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user