mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-02-27 20:53:01 +00:00
Fix install.sh: support prerelease when fetching latest version
/releases/latest API endpoint skips prereleases and drafts. Fall back to /releases (all releases) to find the first available tag, which includes prereleases created by our workflow. https://claude.ai/code/session_01RQBndg4ZPmYAToK4KKcBzp
This commit is contained in:
parent
764311a94c
commit
83e50b217e
1 changed files with 11 additions and 6 deletions
17
install.sh
17
install.sh
|
|
@ -769,14 +769,19 @@ install_x-ui() {
|
||||||
|
|
||||||
# Download resources
|
# Download resources
|
||||||
if [ $# == 0 ]; then
|
if [ $# == 0 ]; then
|
||||||
|
# Try /releases/latest first (skips prereleases), then fall back to first entry in /releases
|
||||||
tag_version=$(curl -Ls "https://api.github.com/repos/${GH_REPO}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
tag_version=$(curl -Ls "https://api.github.com/repos/${GH_REPO}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
if [[ ! -n "$tag_version" ]]; then
|
if [[ ! -n "$tag_version" ]]; then
|
||||||
echo -e "${yellow}Trying to fetch version with IPv4...${plain}"
|
echo -e "${yellow}No stable release found, checking all releases (including pre-releases)...${plain}"
|
||||||
tag_version=$(curl -4 -Ls "https://api.github.com/repos/${GH_REPO}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
tag_version=$(curl -Ls "https://api.github.com/repos/${GH_REPO}/releases" | grep '"tag_name":' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
if [[ ! -n "$tag_version" ]]; then
|
fi
|
||||||
echo -e "${red}Failed to fetch x-ui version, it may be due to GitHub API restrictions, please try it later${plain}"
|
if [[ ! -n "$tag_version" ]]; then
|
||||||
exit 1
|
echo -e "${yellow}Trying with IPv4...${plain}"
|
||||||
fi
|
tag_version=$(curl -4 -Ls "https://api.github.com/repos/${GH_REPO}/releases" | grep '"tag_name":' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
|
fi
|
||||||
|
if [[ ! -n "$tag_version" ]]; then
|
||||||
|
echo -e "${red}Failed to fetch x-ui version, it may be due to GitHub API restrictions, please try it later${plain}"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo -e "Got x-ui latest version: ${tag_version}, beginning the installation..."
|
echo -e "Got x-ui latest version: ${tag_version}, beginning the installation..."
|
||||||
curl -4fLRo ${xui_folder}-linux-$(arch).tar.gz "https://github.com/${GH_REPO}/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz"
|
curl -4fLRo ${xui_folder}-linux-$(arch).tar.gz "https://github.com/${GH_REPO}/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue