From ed4a86997dcae36d4e1f84bf6973b2bdc0ae698c Mon Sep 17 00:00:00 2001 From: Olia Lisa Date: Thu, 20 Nov 2025 18:36:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A7=E7=9A=84=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/init.sh | 24 ----------------- bin/init_with_tls_cert.sh | 55 --------------------------------------- bin/run.sh | 5 ++-- 3 files changed, 2 insertions(+), 82 deletions(-) delete mode 100644 bin/init.sh delete mode 100644 bin/init_with_tls_cert.sh diff --git a/bin/init.sh b/bin/init.sh deleted file mode 100644 index 1bca7ba..0000000 --- a/bin/init.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# 使用自签名证书初始化 -init() { - local script_dir=$(cd "$(dirname "$0")"; pwd) - - cp "$script_dir/../config_template/self_cert_config.json" "$script_dir/../config.json" - - # 设置端口 - bash "$script_dir/update_port.sh" - - # 设置密码 - bash "$script_dir/update_password.sh" - - # 设置混淆密码 - bash "$script_dir/update_obfs_password.sh" - - # 生成自签名证书和设置域名 - bash "$script_dir/set_domain.sh" "bing.com" - - echo "初始化设置完成" -} - -init \ No newline at end of file diff --git a/bin/init_with_tls_cert.sh b/bin/init_with_tls_cert.sh deleted file mode 100644 index cdaad33..0000000 --- a/bin/init_with_tls_cert.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - - -# 使用域名证书初始化 -init_with_tls_cert() { - local script_dir=$(cd "$(dirname "$0")"; pwd) - - cp "$script_dir/../config_template/tls_cert_config.json" "$script_dir/../config.json" - - # 设置端口 - bash "$script_dir/update_port.sh" - - # 设置密码 - bash "$script_dir/update_password.sh" - - # 设置混淆密码 - bash "$script_dir/update_obfs_password.sh" - - # 获取邮箱 - read -p "请输入你的邮箱: " user_email - while [[ -z "$user_email" ]]; do - echo "[错误] 邮箱不能为空" - read -p "请输入你的邮箱: " user_email - done - - # 获取域名 - read -p "请输入你的域名 (例如: example.com): " user_domain - while [[ -z "$user_domain" ]]; do - echo "[错误] 域名不能为空" - read -p "请输入你的域名: " user_domain - done - - # 获取 Cloudflare API Token - read -p "请输入你的 Cloudflare API Token: " cloudflare_token - while [[ -z "$cloudflare_token" ]]; do - echo "[错误] Cloudflare API Token 不能为空" - read -p "请输入你的 Cloudflare API Token: " cloudflare_token - done - - # 替换配置文件中的占位符 - local config_file="$script_dir/../config.json" - - # 使用 sed 替换邮箱 - sed -i "s/你的邮箱/$user_email/g" "$config_file" - - # 替换域名 (在 domains 数组和 masquerade url 中) - sed -i "s/你的域名/$user_domain/g" "$config_file" - - # 替换 Cloudflare API Token - sed -i "s/你的cloudflare_api_token/$cloudflare_token/g" "$config_file" - - echo "初始化设置完成" -} - -init_with_tls_cert \ No newline at end of file diff --git a/bin/run.sh b/bin/run.sh index 8669f2d..2173f60 100644 --- a/bin/run.sh +++ b/bin/run.sh @@ -13,11 +13,10 @@ run() { # 检查bash是否安装 check_bash_installed - # 如果配置未初始化 + # 如果配置没有创建 local password=$(jq -r '.auth.password' "$config_dir/config.json") if [ "$password" = "你的密码" ]; then - # 执行初始化脚本 - bash "$script_dir/init.sh" + bash "$script_dir/create_config.sh" # 创建配置 fi # 启动docker容器