This commit is contained in:
Olia Lisa 2025-12-29 23:42:30 +08:00
parent 37353ee6dd
commit bc00879ac8
2 changed files with 7 additions and 15 deletions

View File

@ -1,10 +1,10 @@
#!/bin/bash
# todo
create_config_with_tls_cert() {
local script_dir=$(cd "$(dirname "$0")"; pwd)
local config_file="$script_dir/../config/config.json"
cp "$script_dir/../config/template/tls_cert_config.json" "$script_dir/../config/config.json"
cp "$script_dir/../config/template/tls_cert_config.json" "$config_file"
# 设置端口
bash "$script_dir/update_port.sh"
@ -16,11 +16,10 @@ create_config_with_tls_cert() {
bash "$script_dir/update_uuid.sh"
# 获取邮箱
read -p "请输入你的邮箱: " user_email
while [[ -z "$user_email" ]]; do
echo "[错误] 邮箱不能为空"
read -p "请输入你的邮箱: " user_email
done
read -p "请输入你的邮箱(可留空): " user_email
if [[ -z "$user_email" ]]; then
user_email="example@example.com"
fi
# 获取域名
read -p "请输入你的域名 (例如: example.com): " user_domain
@ -36,16 +35,9 @@ create_config_with_tls_cert() {
read -p "请输入你的 Cloudflare API Token: " cloudflare_token
done
# 替换配置文件中的占位符
local config_file="$script_dir/../config/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 "初始化设置完成"

View File

@ -26,7 +26,7 @@ print_share_link() {
local port=$(echo "$config" | jq -r '.inbounds[0].listen_port')
local password=$(echo "$config" | jq -r '.inbounds[0].users[0].password')
local congestion_control=$(echo "$config" | jq -r '.inbounds[0].congestion_control')
local allowInsecure=1
local allowInsecure=1 # 是否跳过证书验证1表示跳过0表示不跳过
# 检查sni
if [ "$sni" = "你的域名或伪装域名" ] || [ -z "$sni" ] || [[ "$sni" == null ]]; then