update all

This commit is contained in:
gaofei 2024-08-30 11:39:11 +08:00
parent 9bda957428
commit a4f2ef126c
4 changed files with 39 additions and 14 deletions

View File

@ -19,7 +19,7 @@ bash <(curl -fsSL https://raw.githubusercontent.com/xxoommd/magic/main/quick_ser
- Gitea:
```shell
bash <(curl -fsSL https://gitee.com/xxoommd/magic/raw/main/quick_server.sh)
DOWNLOAD_SRC=gitee bash <(curl -fsSL https://gitee.com/xxoommd/magic/raw/main/quick_server.sh)
```
#### client

View File

@ -24,7 +24,7 @@ fi
TAG=${TAG:-latest}
github_download_url_prefix="https://gitee.com/xxoommd/magic/releases/download"
github_download_url_prefix="https://github.com/xxoommd/magic/releases/download"
gitee_download_url_prefix="https://github.com/xxoommd/ultimate_collection/releases/download"
naive_bin_name=""

View File

@ -7,16 +7,15 @@ YELLOW='\033[0;33m'
UNDERLINE='\033[4m' # 下划线
NC='\033[0m' # No Color
if [[ -z $DEPLOY_DOMAIN ]]; then
echo
echo "[${RED}Err${NC}] DEPLOY_DOMAIN is not set"
echo
# 仅root用户执行
if [ "$(id -u)" -eq 0 ]; then
echo "当前用户是 root"
else
echo -e "${RED}[Err]${NC}当前用户不是 root"
exit 1
fi
caddy_download_url="https://gitee.com/xxoommd/magic/releases/download/v0.1/caddy-linux-amd64"
hysteria_download_url="https://gitee.com/xxoommd/magic/releases/download/v0.1/hysteria-linxu-amd64-avx"
# 验证域名格式是否合法
function is_valid_domain() {
local str="$1"
@ -28,9 +27,15 @@ function is_valid_domain() {
fi
}
# 验证域名格式是否合法
echo -e "\n[INFO] Validate DOMAN: ${BLUE}${DEPLOY_DOMAIN}${NC} ..."
if [[ -z $DEPLOY_DOMAIN ]]; then
echo
echo "[${RED}Err${NC}] DEPLOY_DOMAIN is not set"
echo
exit 1
fi
if is_valid_domain "$DEPLOY_DOMAIN"; then
echo -e "[INFO] ${BLUE}${UNDERLINE}$DEPLOY_DOMAIN${NC} is a valid domain.\n"
else
@ -38,6 +43,23 @@ else
exit 1
fi
TAG=${TAG:-"latest"}
echo -e "[INFO] Using TAG: ${YELLOW}${TAG}${NC}"
caddy_download_url=""
hysteria_download_url=""
if [ "$DOWNLOAD_SRC" = "gitee" ]; then
echo -e "[INFO] Download from ${YELLOW}Gitee${NC} ..."
caddy_download_url="https://gitee.com/xxoommd/magic/releases/download/${TAG}/caddy-linux-amd64"
hysteria_download_url="https://gitee.com/xxoommd/magic/releases/download/${TAG}/hysteria-linxu-amd64-avx"
else
echo -e "[INFO] Download from ${YELLOW}Github${NC} ..."
caddy_download_url="https://github.com/xxoommd/magic/releases/download/${TAG}/caddy-linux-amd64"
hysteria_download_url="https://github.com/xxoommd/magic/releases/download/${TAG}/hysteria-linxu-amd64-avx"
fi
# 设置工作目录
WORKING_DIR="/root/.local/magic"
if [ ! -d "${WORKING_DIR}" ]; then

View File

@ -97,11 +97,14 @@ function update_naive() {
chmod +x $BIN_PATH/naive* && ls -lhF $BIN_PATH/naive*
}
function update_hysteria() {
function download_hysteria() {
echo "- Downloading hysteria-linxu-amd64-avx ..." &&
curl -s -L -o $BIN_PATH/hysteria-linxu-amd64-avx https://download.hysteria.network/app/latest/hysteria-linux-amd64-avx &&
curl -s -L -o $BIN_PATH/hysteria-darwin-amd64-avx https://download.hysteria.network/app/latest/hysteria-darwin-amd64-avx &&
echo "- Downloading hysteria-darwin-amd64 ..." &&
curl -s -L -o $BIN_PATH/hysteria-darwin-amd64 https://download.hysteria.network/app/latest/hysteria-darwin-amd64 &&
echo "- Downloading hysteria-darwin-arm64 ..." &&
curl -s -L -o $BIN_PATH/hysteria-darwin-arm64 https://download.hysteria.network/app/latest/hysteria-darwin-arm64 &&
echo "- Downloading hysteria-windows-amd64-avx.exe ..." &&
curl -s -L -o $BIN_PATH/hysteria-windows-amd64-avx.exe https://download.hysteria.network/app/latest/hysteria-windows-amd64-avx.exe &&
echo &&
chmod +x $BIN_PATH/* && ls -lhF $BIN_PATH/hy*
@ -164,7 +167,7 @@ function main() {
if [ "$up_hy" = true ]; then
echo -e "[INFO] Downloading ${GREEN}hysteria2${NC} ..."
if update_hysteria; then
if download_hysteria; then
echo -e "[INFO] Download ${GREEN}hysteria2${NC} success"
else
echo -e "[Err] Download ${GREEN}hysteria2${NC} fail"