From 8b32dc3ebedf902d57827c3263c41496cb1b480e Mon Sep 17 00:00:00 2001 From: Olia Lisa Date: Wed, 31 Dec 2025 00:52:06 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BB=A3=E7=A0=81,=20?= =?UTF-8?q?=E6=8A=BD=E5=8F=96=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/print_share_link.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/print_share_link.sh b/bin/print_share_link.sh index 3052f0b..b0974ba 100644 --- a/bin/print_share_link.sh +++ b/bin/print_share_link.sh @@ -3,20 +3,21 @@ print_share_link() { local script_dir=$(cd "$(dirname "$0")"; pwd) local config_dir=$(readlink -f "$script_dir/../") + local config_file="$config_dir/config/config.json" source "${script_dir}/utils/base.sh" # 检查jq是否安装 check_jq # 检查配置文件是否存在 - if [ ! -f "$config_dir/config/config.json" ]; then + if [ ! -f "$config_file" ]; then red "error: 配置文件未生成, 查看配置失败" echo '请选择"生成配置 / 重置配置"' exit 1 fi # 检查是否已启动过容器 - local password=$(jq -r '.auth.password' "$config_dir/config/config.json") + local password=$(jq -r '.auth.password' "$config_file") if [ "$password" = "你的密码" ]; then red "error: 容器未启动过, 查看配置失败" echo '请选择"启动容器"' @@ -25,12 +26,12 @@ print_share_link() { # 检查是否使用ACME证书 local allowInsecure=1 # 默认跳过证书验证 - if jq -e '.acme' "$config_dir/config/config.json" > /dev/null 2>&1; then + if jq -e '.acme' "$config_file" > /dev/null 2>&1; then allowInsecure=0 # 不跳过证书验证 fi # 读取配置文件内容 - local config=$(cat "$config_dir/config/config.json") + local config=$(cat "$config_file") # 提取所需信息 password=$(echo "$config" | jq -r '.auth.password')