From d85dd808a9d62343c89d7657c26ba75b62b63048 Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Thu, 29 Jun 2023 13:36:50 +0800 Subject: [PATCH] fix no-auto-tls err --- src/caddy.sh | 1 - src/core.sh | 8 ++++---- src/init.sh | 1 + xray.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/caddy.sh b/src/caddy.sh index bd25fd1..177da84 100644 --- a/src/caddy.sh +++ b/src/caddy.sh @@ -1,6 +1,5 @@ caddy_config() { is_caddy_site_file=$is_caddy_conf/${host}.conf - [[ ! $tlsport ]] && tlsport=443 case $1 in new) mkdir -p $is_caddy_dir $is_caddy_dir/sites $is_caddy_conf diff --git a/src/core.sh b/src/core.sh index 20acc35..6c367d8 100644 --- a/src/core.sh +++ b/src/core.sh @@ -372,7 +372,7 @@ create() { api add $is_json_file $is_dynamic_port_link_file &>/dev/null fi # caddy auto tls - [[ $is_caddy && $host ]] && { + [[ $is_caddy && $host && ! $is_no_auto_tls ]] && { create caddy $net } # restart core @@ -1205,10 +1205,10 @@ get() { is_dynamic_port_range=$(jq -r '.inbounds[0].port' $is_dynamic_port_file) [[ $? != 0 ]] && err "无法读取动态端口文件: $is_dynamic_port" fi - if [[ $is_caddy && $host ]]; then - tlsport=$(egrep -o "$host:[1-9][0-9]?+" $is_caddy_conf/$host.conf | sed s/.*://) + if [[ $is_caddy && $host && -f $is_caddy_conf/$host.conf ]]; then + tmp_tlsport=$(egrep -o "$host:[1-9][0-9]?+" $is_caddy_conf/$host.conf | sed s/.*://) fi - [[ ! $tlsport ]] && tlsport=443 + [[ $tmp_tlsport ]] && tlsport=$tmp_tlsport [[ $is_client && $host ]] && port=$tlsport get protocol $is_protocol-$net fi diff --git a/src/init.sh b/src/init.sh index 2308e3f..f2b5868 100644 --- a/src/init.sh +++ b/src/init.sh @@ -83,6 +83,7 @@ is_caddy_repo=caddyserver/caddy is_caddyfile=$is_caddy_dir/Caddyfile is_caddy_conf=$is_caddy_dir/$author is_caddy_service=$(systemctl list-units --full -all | grep caddy.service) +tlsport=443 # core ver is_core_ver=$($is_core_bin version | head -n1 | cut -d " " -f1-2) diff --git a/xray.sh b/xray.sh index 525e3e9..3d0b556 100644 --- a/xray.sh +++ b/xray.sh @@ -1,6 +1,6 @@ #!/bin/bash args=$@ -is_sh_ver=v1.10 +is_sh_ver=v1.11 . /etc/xray/sh/src/init.sh \ No newline at end of file