feat(install): add config validation checks for uuid and file integrity

- Added comments for clarity on config file existence and blank checks
- Included UUID validation to prevent uninitialized config usage
- Improves robustness by prompting users to create proper configs upfront
This commit is contained in:
Olia Lisa 2025-11-23 14:18:44 +08:00
parent 9a3e20082c
commit bf72ff2521

View File

@ -8,10 +8,17 @@ restart_docker(){
check_config(){
# 如果配置文件不存在或者空白
if [ ! -e "$config_dir/config.json" ] || [ ! -s "$config_dir/config.json" ];then
echo "请先'创建配置'"
exit 0
fi
# 如果配置未初始化
uuid=$(jq -r '.inbounds[0].settings.clients[0].id' "$config_dir/config.json")
if [ "$uuid" = "你的UUID" ] || [ -z "$uuid" ]; then
echo "请先'创建配置'"
exit 0
fi
}