31 lines
716 B
Bash
31 lines
716 B
Bash
#!/bin/bash
|
|
|
|
# 修改域名
|
|
update_domain(){
|
|
source "$script_dir/utils/jq_util.sh"
|
|
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # 脚本文件夹绝对路径
|
|
local config_file="$script_dir/../config/config.json"
|
|
|
|
# 获取旧的domain
|
|
local old_domain=$(jq -r ".inbounds[0].tls.server_name" "$config_file")
|
|
|
|
# 输入新的domain
|
|
local domain
|
|
read -p "请输入域名[当前域名: $old_domain]: " domain
|
|
|
|
# 如果输入为空,退出脚本
|
|
if [[ -z "$domain" ]]; then
|
|
echo "输入域名为空,退出脚本"
|
|
exit 1
|
|
fi
|
|
|
|
# 修改域名
|
|
modify_json_file "$config_file" ".inbounds[0].tls.server_name" "$domain"
|
|
|
|
echo "修改域名成功"
|
|
}
|
|
|
|
|
|
|
|
update_domain
|