增加配置文件检查和重新生成提示

This commit is contained in:
Olia Lisa 2026-01-14 00:34:18 +08:00
parent e1488af75e
commit fc5257a341

View File

@ -50,6 +50,22 @@ create_config(){
# 检查jq是否安装
check_jq
# 如果配置文件不存在, 创建空白配置文件
local config_file="$script_dir/../conf/config.json" # 配置文件绝对路径
if [ ! -e "$config_file" ]; then
touch "$config_file"
fi
# 如果配置文件已存在, 询问是否重新生成
if [ -e "$config_file" ]; then
local regenerate
read -p "检测到配置已存在,是否重新生成配置?(y/n): " regenerate
if [ "$regenerate" != "y" ] && [ "$regenerate" != "Y" ]; then
echo "取消重新生成配置."
return
fi
fi
echo "请选择配置文件类型:"
echo "1. 创建reality配置"
echo "2. 创建xhttp_reality配置"