#!/bin/bash

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

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

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

# 设置基础 URL
base_url="https://github.com/chen08209/FlClash/releases/download/v${version}"

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

wget -O "${download_dir}/FlClash-${version}-android-arm64-v8a.apk" "${base_url}/FlClash-${version}-android-arm64-v8a.apk"
wget -O "${download_dir}/FlClash-${version}-android-armeabi-v7a.apk" "${base_url}/FlClash-${version}-android-armeabi-v7a.apk"
wget -O "${download_dir}/FlClash-${version}-android-x86_64.apk" "${base_url}/FlClash-${version}-android-x86_64.apk"
wget -O "${download_dir}/FlClash-${version}-linux-amd64.AppImage" "${base_url}/FlClash-${version}-linux-amd64.AppImage"
wget -O "${download_dir}/FlClash-${version}-linux-amd64.deb" "${base_url}/FlClash-${version}-linux-amd64.deb"
wget -O "${download_dir}/FlClash-${version}-linux-amd64.rpm" "${base_url}/FlClash-${version}-linux-amd64.rpm"
wget -O "${download_dir}/FlClash-${version}-macos-amd64.dmg" "${base_url}/FlClash-${version}-macos-amd64.dmg"
wget -O "${download_dir}/FlClash-${version}-macos-arm64.dmg" "${base_url}/FlClash-${version}-macos-arm64.dmg"
wget -O "${download_dir}/FlClash-${version}-windows-amd64-setup.exe" "${base_url}/FlClash-${version}-windows-amd64-setup.exe"
wget -O "${download_dir}/FlClash-${version}-windows-amd64.zip" "${base_url}/FlClash-${version}-windows-amd64.zip"

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

