重构代码, 抽取变量
This commit is contained in:
parent
abab251aa1
commit
73a6dd2111
@ -14,11 +14,12 @@ run() {
|
||||
check_bash_installed
|
||||
|
||||
# 如果配置没有创建
|
||||
if [ ! -e "$config_dir/config.json" ]; then
|
||||
touch "$config_dir/config.json"
|
||||
local config_file="$config_dir/config.json"
|
||||
if [ ! -e "$config_file" ]; then
|
||||
touch "$config_file"
|
||||
fi
|
||||
local password=$(jq -r '.inbounds[0].users[0].password' "$config_dir/config.json")
|
||||
if [ ! -s "$config_dir/config.json" ] || [ "$password" = "你的密码" ]; then
|
||||
local password=$(jq -r '.inbounds[0].users[0].password' "$config_file")
|
||||
if [ ! -s "$config_file" ] || [ "$password" = "你的密码" ]; then
|
||||
bash "$script_dir/create_config.sh" # 创建配置
|
||||
fi
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user