#!/bin/bash

# 获取版本号输入
echo "请输入版本号 (例如: 1.5.12)："
read version

# 配置下载路径，使用版本号作为目录
download_dir="./v${version}"

# 创建下载目录
mkdir -p "$download_dir"

# 设置基础 URL
base_url="https://github.com/mihomo-party-org/mihomo-party/releases/download/v${version}"

# 开始下载文件
echo "开始下载版本 ${version} 文件..."

# Windows
echo "下载 Windows 安装版..."
wget -O "${download_dir}/mihomo-party-windows-${version}-x64-setup.exe" "${base_url}/mihomo-party-windows-${version}-x64-setup.exe"

echo "下载 Windows 便携版..."
wget -O "${download_dir}/mihomo-party-windows-${version}-x64-portable.7z" "${base_url}/mihomo-party-windows-${version}-x64-portable.7z"

echo "下载 Windows 7 安装版..."
wget -O "${download_dir}/mihomo-party-win7-${version}-x64-setup.exe" "${base_url}/mihomo-party-win7-${version}-x64-setup.exe"

echo "下载 Windows 7 便携版..."
wget -O "${download_dir}/mihomo-party-win7-${version}-x64-portable.7z" "${base_url}/mihomo-party-win7-${version}-x64-portable.7z"

# macOS
echo "下载 macOS x64 安装包..."
wget -O "${download_dir}/mihomo-party-macos-${version}-x64.pkg" "${base_url}/mihomo-party-macos-${version}-x64.pkg"

echo "下载 macOS arm64 安装包..."
wget -O "${download_dir}/mihomo-party-macos-${version}-arm64.pkg" "${base_url}/mihomo-party-macos-${version}-arm64.pkg"

echo "下载 macOS Catalina x64 安装包..."
wget -O "${download_dir}/mihomo-party-catalina-${version}-x64.pkg" "${base_url}/mihomo-party-catalina-${version}-x64.pkg"

echo "下载 macOS Catalina arm64 安装包..."
wget -O "${download_dir}/mihomo-party-catalina-${version}-arm64.pkg" "${base_url}/mihomo-party-catalina-${version}-arm64.pkg"

# Linux
echo "下载 Linux DEB 安装包..."
wget -O "${download_dir}/mihomo-party-linux-${version}-amd64.deb" "${base_url}/mihomo-party-linux-${version}-amd64.deb"

echo "下载 Linux RPM 安装包..."
wget -O "${download_dir}/mihomo-party-linux-${version}-x86_64.rpm" "${base_url}/mihomo-party-linux-${version}-x86_64.rpm"

echo "下载完成，所有文件保存在 ${download_dir} 目录中。"

