diff --git a/install.sh b/install.sh index fc400fa..3514d82 100755 --- a/install.sh +++ b/install.sh @@ -227,8 +227,8 @@ if command -v systemctl >/dev/null 2>&1; then echo -e "🟢 服务状态:${Service_Started}" echo echo -e "常用命令:" - echo -e " sudo systemctl status ${Service_Name}.service" - echo -e " sudo systemctl restart ${Service_Name}.service" + echo -e "sudo systemctl status ${Service_Name}.service" + echo -e "sudo systemctl restart ${Service_Name}.service" fi echo @@ -241,25 +241,25 @@ if [ -z "$api_host" ] || [ "$api_host" = "$EXTERNAL_CONTROLLER" ]; then fi # ---- Secret 展示(脱敏)---- -CONF_DIR="${CLASH_INSTALL_DIR:-/opt/clash-for-linux}/conf" +CONF_DIR="$Install_Dir/conf" CONF_FILE="$CONF_DIR/config.yaml" # 读取 secret(如果 clash 还没生成 config,就先不显示) SECRET_VAL="" if [ -f "$CONF_FILE" ]; then - SECRET_VAL="$(awk -F': *' '/^secret:/{print $2; exit}' "$CONF_FILE" | tr -d '"' | tr -d "'" )" + SECRET_VAL="$(awk -F': *' '/^[[:space:]]*secret:/{print $2; exit}' "$CONF_FILE" | tr -d '"' | tr -d "'" )" fi if [ -n "$SECRET_VAL" ]; then # 脱敏显示:前4后4 MASKED="${SECRET_VAL:0:4}****${SECRET_VAL: -4}" echo "" - echo -e "🌐 Dashboard:http://${api_host}:${api_port}/ui" + echo -e "🌐 Dashboard:http://${api_host}:${api_port}/ui/" echo "🔐 Secret:${MASKED}" - echo " 查看完整 Secret:sudo awk -F': *' '/^secret:/{print \$2; exit}' $CONF_FILE" + echo " 查看完整 Secret:sudo awk -F': *' '/^[[:space:]]*secret:/{print \$2; exit}' $CONF_FILE" else echo "" - echo -e "🌐 Dashboard:http://${api_host}:${api_port}/ui" + echo -e "🌐 Dashboard:http://${api_host}:${api_port}/ui/" echo "🔐 Secret:未配置(当前为无鉴权模式,仅限本机访问),可用以下命令查看:" echo " sudo awk -F': *' '/^secret:/{print \$2; exit}' $CONF_FILE" fi