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:
parent
9a3e20082c
commit
bf72ff2521
@ -8,10 +8,17 @@ restart_docker(){
|
|||||||
|
|
||||||
|
|
||||||
check_config(){
|
check_config(){
|
||||||
|
# 如果配置文件不存在或者空白
|
||||||
if [ ! -e "$config_dir/config.json" ] || [ ! -s "$config_dir/config.json" ];then
|
if [ ! -e "$config_dir/config.json" ] || [ ! -s "$config_dir/config.json" ];then
|
||||||
echo "请先'创建配置'"
|
echo "请先'创建配置'"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
# 如果配置未初始化
|
||||||
|
uuid=$(jq -r '.inbounds[0].settings.clients[0].id' "$config_dir/config.json")
|
||||||
|
if [ "$uuid" = "你的UUID" ] || [ -z "$uuid" ]; then
|
||||||
|
echo "请先'创建配置'"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user