From 8018062882e58201a2d7c5af4179bd5b437e5e6f Mon Sep 17 00:00:00 2001 From: Olia Lisa Date: Sat, 10 Jan 2026 21:05:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9B=B4=E6=96=B0=E5=9F=9F?= =?UTF-8?q?=E5=90=8D=E7=9A=84=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/update_domain.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 bin/update_domain.sh diff --git a/bin/update_domain.sh b/bin/update_domain.sh new file mode 100644 index 0000000..ff9d1f8 --- /dev/null +++ b/bin/update_domain.sh @@ -0,0 +1,30 @@ +#!/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